View a markdown version of this page

Security controls for federated access - AWS Context

Security controls for federated access

The identity that your IdP sends decides which data each user receives. Apply the following controls to the IdP, the IAM identity provider, and the roles that users federate into.

Send a stable, verified Subject

Choose a Subject that is unique to each user and doesn’t change over time. For more information about choosing the Subject, see How TIP for IAM federation uses identity information in the IAM User Guide. Set the Subject type to user. Without this Subject type, Amazon Bedrock Managed Knowledge Bases connections and third-party catalogs handle the request as a request without a user, even when the session includes an email address.

Map only email attributes that your IdP verifies

Amazon Bedrock managed knowledge bases match the user’s email address against document access control lists (ACLs). If users can change the attribute that you map, a user can enter another user’s email address and receive that user’s documents.

Don’t reuse identifiers

If your IdP reassigns an email address or username to a new user, that user receives the access that your sources grant to the identifier. Retire identifiers when users leave, or remove them from source ACLs and grants first.

Limit the role trust policy to your identity provider

The trust policy of each role that users federate into must allow only your IAM identity provider, and must check the audience of the SAML assertion or OIDC token.

For a SAML identity provider, the following IAM JSON trust policy allows only one SAML identity provider and checks the SAML audience. Before you use it, replace the example account ID with your AWS account ID, and the example identity provider name with the name of your SAML identity provider in IAM.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowFederationFromAnyCompanyIdP", "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::111122223333:saml-provider/AnyCompanyIdP" }, "Action": "sts:AssumeRoleWithSAML", "Condition": { "StringEquals": { "SAML:aud": "https://signin.aws.amazon.com/saml" } } } ] }

For an OIDC identity provider, the following IAM JSON trust policy allows only one OIDC identity provider and checks that the token’s audience is your application’s client ID. Before you use it, replace the example account ID with your AWS account ID, the example provider URL with the URL of your OIDC identity provider in IAM, without https://, and the example client ID with the client ID that your IdP issued to your application.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowFederationFromAnyCompanyOidcIdP", "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::111122223333:oidc-provider/idp.example.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "idp.example.com:aud": "example-client-id" } } } ] }
Separate administrator and user roles

Grant roles that users federate into only the AWS Context operations that retrieve context, and only on the Agent Contexts that those users need. Grant operations that create or change AWS Context resources only to administrator roles. Assign each role to the IdP groups whose members need it.

Plan the change when you turn on TIP for an existing identity provider

TIP applies to every session that federates through the identity provider. If an assertion or token lacks the Subject, or a valid value for a claim that you map, AWS STS rejects the sign-in. Confirm that your IdP sends these values for every user before you turn on TIP.

Keep sessions short

Disabling a user in your IdP stops new sign-ins. Role sessions that already exist stay valid until they expire. Set the maximum session duration of each role to the shortest duration that your users can work with.

Keep identity providers and roles inside your organization

AWS STS attaches the user’s identity to a data access role session only if the role is in an allowed account. The role must be in the identity provider’s account, or in another account in the same organization. If the identity provider’s account isn’t in an organization, the role must be in that account. Otherwise, AWS STS drops the identity, the AssumeRole call still succeeds, and the user’s identity doesn’t reach the sources that AWS Context reads through that role. To check, find the AssumeRole event for the data access role in CloudTrail. A trustedIdentityPropagationSuppressed value of true means that AWS STS dropped the identity.

For more information, see Configure TIP for an IAM identity provider and Control TIP for IAM federation with IAM policies in the IAM User Guide.