fix(iam): read a federated assume's tags in its trust policy, and sts:TagSession from the generated tables (#9721)

Under enforcement a role whose trust policy conditions AssumeRoleWithSAML or AssumeRoleWithWebIdentity on aws:RequestTag/<key> or aws:TagKeys refused every tagged assume: neither trust policy saw the tags the assertion or the token passes, which the Service Reference gives both actions and the IAM user guide's SAML ABAC tutorial's trust policy reads. And all three assumes named sts:TagSession by hand, through AssumeRolePolicyEvaluator.TAG_SESSION_ACTION, with the assertion's PrincipalTag attributes and the token's tags claim named by hand too.

The IAM user guide's page on session tags says where an identity provider passes the tags, "include the Attribute element with the Name attribute set to https://aws.amazon.com/SAML/Attributes/PrincipalTag:{TagKey}" and "the nested claim format uses a structure within the https://aws.amazon.com/tags namespace in the JWT", and what passing them needs, "trust policies for all roles connected to the identity provider (IdP) passing tags must have the sts:TagSession permission". tools/aws/fetch_sts_session_tags.py vendors it into tools/aws/sources/sts-session-tags.json, and regen_iam_authorized_actions.py gives both operations a companion naming the attribute or the claim, sts:TagSession, and the reference's aws:RequestTag/${TagKey}, where the reference's action of the operation's name takes that key.

The SAML and web identity trust policies now read the tags as aws:RequestTag/<key> and aws:TagKeys, written as an AssumeRole's are, and check the companion's action for them; the assertion and token verifiers read the companion's attribute and claim. AssumeRole's trust check takes the tagging action the tag-on-create table gives it. TAG_SESSION_ACTION and the allowsTagging methods are gone.

Closes #6640.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-29 00:16:10 -04:00
1 parent b7a12c146b
commit 5ed7187e28
21 files changed
+603 -102

No files matched your search

+17 -5
View File
@@ -483,7 +483,23 @@ sts:TagSession permission. For roles without this permission in the trust policy
operation fails." All three assume operations read their trust policy for `sts:TagSession` when the
request, the assertion or the token carries a tag, with the same principals and conditions as the
assume itself, and answer `AccessDenied` naming that action when it is not allowed. An untagged
request is not held to it. `AssumeRole` reads its trust policy under the enforcement this section
request is not held to it. The action is generated data: `AssumeRole`'s is the tagging action the
generated `iam-tag-on-create.json` gives it, and the federated operations', which the Service
Authorization Reference lists no authorized actions for, is the companion the generated
`iam-authorized-actions.json` gives each from the session tags page, vendored into
`tools/aws/sources/sts-session-tags.json` by `tools/aws/fetch_sts_session_tags.py`. The same
companions name where the tags arrive, the assertion's
`https://aws.amazon.com/SAML/Attributes/PrincipalTag:{TagKey}` attributes and the token's
`https://aws.amazon.com/tags` claim, which is what the assertion and the token are read under.
The tags an assertion or a token passes are request tags of its trust policy as well, as
`aws:RequestTag/<key>` and `aws:TagKeys`, the keys the Service Authorization Reference gives both
actions, written as an `AssumeRole`'s are. The IAM user guide's SAML ABAC tutorial has a trust
policy reading them on the assume and the tagging alike, "aws:RequestTag/access-team" required to be
`eng` or `qas`, so a statement requiring a tag allows an assertion passing one of its values and not
one passing another or none. The federated trust policies read the `String` operators; a set
operator such as `ForAllValues` is not read by them, so a statement using one does not allow the
assume. `AssumeRole` reads its trust policy under the enforcement this section
describes, so the permission is read there too; the assertion and the token are read against their
trust policy on every call, as they always have been.
@@ -697,10 +713,6 @@ AssumeRoleWithSAML does not require the use of AWS security credentials", and so
`SourceIdentity` attribute carrying several values or one outside botocore's type, and a token's
`source_identity` claim that is not one such string, answer `InvalidIdentityToken` with a sentence
of Floci's own: nothing published says what AWS answers.
- **A federated assume's tags are not request tags of its trust policy.** The trust policy of an
`AssumeRoleWithSAML` or `AssumeRoleWithWebIdentity` does not see the tags the assertion or the
token passes as `aws:RequestTag/<key>` and `aws:TagKeys`, which the Service Authorization Reference
gives both actions; [Session tags](#session-tags) says how they reach the session.
## Web Identity Validation (IRSA)