mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 22:37:55 -05:00
A session's tags are principal tags of its requests, "when you request a session, you can specify principal tags as the session tags. The tags apply to requests that you make using the session's credentials", and this package read none of them. AssumeRole and GetFederationToken counted the Tags member toward the token size and then dropped it, and the two operations that take session tags inside a SAML assertion or a web identity token, where the model declares no Tags member at all, had nowhere to take them from, so aws:PrincipalTag held only what was stored on the user or the role. A session records the tags it was minted with now, from wherever its own operation takes them: the Tags member on AssumeRole and GetFederationToken, the assertion's https://aws.amazon.com/SAML/Attributes/PrincipalTag:<key> attributes on AssumeRoleWithSAML, and the token's https://aws.amazon.com/tags claims on AssumeRoleWithWebIdentity, in both formats AWS reads those in, the nested object under principal_tags and the flattened claims prefixed https://aws.amazon.com/tags/principal_tags/. GetSessionToken and AssumeRoot declare no way to pass one and record none. What a request publishes is the identity's tags with the session's own over them: the role's tags for a role session, and for a federated user the tags of the user whose key minted it, where it carried none at all, "the session principal tags include the user tags and the passed session tags". A session tag "overrides the role" tag of the same key, matched without case as IAM matches a tag key on a user or a role, "not case sensitive, but case is preserved", so the session's own spelling is the one published. One value per tag: "you must pass a single value for each session tag" and STS "does not support multi-valued session tags". The published nested example writes each value as an array holding one string and the flattened format as a plain claim, so both are read, while a tag carrying more than one value is left unread rather than cut down to its first. A role's trust policy has to permit the tagging as well as the assume: "trust policies for all roles connected to the identity provider passing tags must have the sts:TagSession permission. For roles without this permission in the trust policy, the AssumeRole operation fails." All three assume operations read their own trust policy for that action when the request, the assertion or the token carries a tag, with the same principals and conditions as the assume, and answer AccessDenied naming it. Without that reading a caller the policy lets assume a role could choose the principal tags downstream permissions are conditioned on, which is the whole point of the permission. The caller's own half was already here, the generated tagging table requiring sts:TagSession of a request that carries Tags, so a tagged AssumeRole is held to both policies and a tagged GetFederationToken to the caller's alone, having no trust policy to read. A tag that is not one key with one value is refused rather than read as the first value or dropped: an attribute with several AttributeValue elements or none, an attribute whose name ends at the colon, and a token claim that is neither a string nor a one-element array. Nothing published says what AWS answers a malformed session tag, so those sentences are this package's own, and a tag a policy would have been evaluated with cannot go missing quietly. An assertion's value is stored as it was signed, spaces included, where trimming it would hand a policy a value the provider never asserted. Two tags of one request whose keys differ only in case are one tag, the later winning, as a tag key on an identity is: kept as two they would reach a policy as one key with the other's value dropped, and a Deny on that value would stop matching. Session tags are state the token carries, "session policies and session tags add to the session token size", so they count against the limit and into what the session reports. The two operations that take them from a message measure that once the assertion or the token has been verified, which is the first point the tags exist, rather than before the operation runs where the declared members are read. Two published pieces are left, named on the page rather than guessed at here. The transitive tag keys beside the tags are not read, so no tag passes into a chained session, which is AWS's own default and leaves only the opt-in missing; a key stored unread would have said otherwise. And the plaintext limits a session tag is held to are read where the model declares the members that carry them, which leaves the number and the length of a tag inside an assertion or a token unchecked, nothing published saying what AWS answers there; what does hold them is the token size. Covered end to end under enforcement by a session tag that decides a call and overrides the role's tag of that key, by one that brings a Deny on, by a caller whose trust policy permits the assume but not the tagging, and by a federated session whose tag is the whole of what decides it; over the API by a signed assertion whose attributes reach the session, by a spaced value kept as signed, by an attribute carrying no single value and one naming no key, and by a tag set too large for the token it would be carried in; at the service level by the merge, the case-insensitive replacement within a request and across the identity's tags, and the federated user's two halves; on the handler by the Tags member reaching the session it mints, by the token's tags counting toward what the session reports, and by the long-term session recording nothing; and on the token verifier by both claim formats, a multi-valued tag, a tag with no key and a token that passes none.