From 3a9f5291584774529fa8f11afa8c99d07b93d4d4 Mon Sep 17 00:00:00 2001 From: Jeremy Chapeau <113923302+jychp@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:17:17 -0800 Subject: [PATCH] fix(sts): give AssumeRole's identity-based policies the sts:RoleSessionName and sts:ExternalId keys (#8922) With IAM enforcement on, the caller's identity-based policy, permissions boundary, session policy and SCPs were evaluated for sts:AssumeRole without the request's sts:RoleSessionName and sts:ExternalId, which the role's trust policy already sees, so a condition on either never matched. The Service Authorization Reference lists both among the condition keys of AssumeRole. STS now joins the generated request condition key table, which reads them from the AssumeRole form; an AssumeRole without ExternalId names no sts:ExternalId. AssumeRoleWithSAML carries no session name member, so it is listed as not reading it from the request. sts:SourceIdentity, sts:TransitiveTagKeys and the session tag keys are not read: Floci does not model source identity or session tags, as the STS page already says. Closes #8921 --- Makefile | 2 +- docs/services/iam.md | 7 ++ docs/services/sts.md | 5 + .../resources/aws/request-condition-keys.json | 33 ++++- .../IamConditionContextResolverTest.java | 11 ++ ...eIdentityConditionKeysIntegrationTest.java | 118 ++++++++++++++++++ tools/aws/regen_request_condition_keys.py | 15 +++ .../aws/test_regen_request_condition_keys.py | 12 +- 8 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 src/test/java/io/floci/aws/services/iam/StsAssumeRoleIdentityConditionKeysIntegrationTest.java diff --git a/Makefile b/Makefile index 4414b52574..100abd3644 100644 --- a/Makefile +++ b/Makefile @@ -930,7 +930,7 @@ s3control-tag-condition-keys-verify: ## Check the S3 Control tag condition actio $(PYTHON) tools/aws/regen_s3control_tag_condition_keys.py --verify .PHONY: request-condition-keys-sync request-condition-keys-check request-condition-keys-verify -request-condition-keys-sync: ## Regenerate the Lambda Web, Redshift and Route 53 request condition keys from AWS and botocore +request-condition-keys-sync: ## Regenerate the Lambda Web, Redshift, Route 53 and STS request condition keys from AWS and botocore $(PYTHON) tools/aws/regen_request_condition_keys.py request-condition-keys-check: ## Check the request condition key members against pinned botocore $(PYTHON) tools/aws/regen_request_condition_keys.py --check diff --git a/docs/services/iam.md b/docs/services/iam.md index ebc0196207..e04afc553a 100644 --- a/docs/services/iam.md +++ b/docs/services/iam.md @@ -3745,6 +3745,13 @@ floci populates: given a JSON null is absent, never the cluster's stored value. The actions, members and protocol come from the same `request-condition-keys.json`. A boolean member given anything but a boolean or its text is refused before it is read (see [EKS](eks.md)), so the key never misses a value the cluster takes. +- `sts:RoleSessionName` and `sts:ExternalId`: the `RoleSessionName` and `ExternalId` an `AssumeRole` request + passes, as given, for the caller's identity-based policies, permissions boundary, session policy and SCPs, as + the role's trust policy reads them (see [STS](sts.md)); `sts:ExternalId` is absent when the request passes none. + The actions and request members come from the same `request-condition-keys.json`. + `AssumeRoleWithWebIdentity` and `AssumeRoleWithSAML` are not signed, so no identity-based policy is + evaluated for them. `sts:SourceIdentity`, `sts:TransitiveTagKeys`, `aws:RequestTag/` and `aws:TagKeys` + are not populated for `AssumeRole`: Floci does not model source identity or session tags. **Any other condition key is absent from the request context.** A positive scalar operator without `IfExists` on an absent key makes the whole statement *not apply*: it neither matches nor diff --git a/docs/services/sts.md b/docs/services/sts.md index 01b90488c8..fa3be3381a 100644 --- a/docs/services/sts.md +++ b/docs/services/sts.md @@ -394,6 +394,11 @@ forms are matched: `"*"`, an account id, an account-root ARN (`arn:aws:iam::