# Security in Identity and Access Management

The IAM actions, which of them amount to administrator rights, what is recorded, and how credentials are kept.

## IAM actions

IAM is not regional: its resource names leave the region empty, such as
`rn:ews::org-EXAMPLE1234:iam:user/<user id>`, `…:iam:group/<id>`, `…:iam:role/<id>`,
`…:iam:policy/<id>` and `…:iam:access-key/<id>`.

(The table of IAM actions is generated on the web page.)
## Actions that amount to administrator rights

- `iam:CreatePolicy` or `iam:UpdatePolicy` together with `iam:AttachUserPolicy` (or the group and
  role variants) lets a principal write any document and attach it, also to itself. Give them only
  to administrators.
- A grant made on a resource's **Access** panel is checked against your own permissions: you
  cannot hand out an action you are not allowed yourself. Attaching a policy you wrote is not
  checked this way.
- `iam:AssignUserRole` gives the user every policy of the role, and `iam:AddUserToGroup` every
  policy of the group.
- `iam:CreateAccessKey` on another user creates a credential that acts as that user.

`PowerUserAccess` and `DeveloperAccess` include no IAM action, so neither can change anybody's
permissions.

## Audit

Every IAM write is recorded in the audit log with its outcome, allowed or refused, and so are
sensitive reads such as `iam:GetInvitationLink`. A refused ordinary read that ends in `403` is
recorded at most once a minute per principal and action. Sign-ins, sign-in failures, CLI sign-in
approvals (`auth:ApproveDeviceLogin`), organization switches, single sign-on group changes
(`auth:SsoGroupSync`) and token exchanges for a role that exists
(`iam:AssumeRoleWithWebIdentity`, with the token's claims once the token is verified) are recorded
too. See [Monitoring](monitoring.md).

## Credentials

- **Access keys.** The secret is shown once, at creation, and cannot be read again. A SHA-256 hash
  of it checks API requests; an encrypted copy lets S3 requests signed with it be checked. A key
  can be made inactive or deleted, and expires; see [Manage access keys](manage-access-keys.md).
- **Console passwords** of IAM users follow the organization's password policy and lock after
  wrong attempts; see [Set the password policy](set-the-password-policy.md).
- **Second factors.** An authenticator app or a passkey, which an organization can require; see
  [Turn on two-factor sign-in](turn-on-two-factor-sign-in.md).
- **Single sign-on.** An OIDC connection's client secret is stored encrypted and never returned.
  SCIM tokens are shown once and stored as a hash.
- **Role sessions.** A token exchange mints a key that lasts at most one hour. Exchanges are limited
  to 30 a minute per client address and 60 a minute per role.

## Isolation between organizations

A credential belongs to one organization, and every request acts in that organization. An
organization id in a request body or path is never used to decide access. A grant or a simulation
that names another organization's resource is refused.

## Related

- [How a request is decided](how-a-request-is-decided.md)
- [Web identity federation](web-identity-federation.md)
- [Single sign-on](single-sign-on.md)
