Files
floci/docs/services
Priamo Germosen a3118eb42b fix(sts): evaluate GetSessionToken and GetFederationToken sessions as the user that minted them (#5081)
Under IAM enforcement, credentials from the two STS operations that mint a
session from a long-term key were evaluated as the wrong identity:

- A GetSessionToken session was stored with no role ARN, which
  resolveCallerContext answered with null, and the enforcement filter lets a
  known credential it cannot map to policies through. A user allowed only
  sts:GetSessionToken got credentials that passed every check, IAM calls
  included, and since the session had no caller ARN, AssumeRole took it for
  the account root and let it assume any role whose trust policy names the
  account. AppSync's IAM authorization and RDS IAM database authentication
  also read a null context as allowed, so they let these sessions through too.
- A GetFederationToken session was stored with the federated user's ARN where a
  role session keeps its role's, and its permissions were read from the role
  whose name followed the last slash. A user allowed only
  sts:GetFederationToken that federated under an existing role's name got that
  role's permissions; any other name got none, even with a session policy.

The STS API Reference says GetSessionToken credentials "have the same
permissions as the IAM user", and that a GetFederationToken session with no
session policy "has no permissions", and otherwise the intersection of "the IAM
user policies and the session policies". Both handlers now record the identity
whose key signed the request. An active key of a user in the request's account
names that user, by ARN and unique ID. A key no account holds, the legacy test
key or the account id among them, names the account root, which is how Floci
already treats such a key.

A GetSessionToken session is evaluated as that user, policies and boundary
included, or as the root, whose context the filter still bounds by the
account's service control policies. A federated session is evaluated as that
user intersected with its session policy. Without one it has no permissions of
its own, but keeps the Deny statements of its user's policies and boundary: a
resource policy naming the federated user grants to the session past implicit
denies, not past explicit ones (IAM User Guide, "Resource-based policies for AWS
STS federated user principal sessions"). Whatever its policies allow, a
federated session cannot call any IAM operation, nor any STS operation except
GetCallerIdentity (STS API Reference, GetFederationToken), so its context
always carries an explicit Deny for iam:* and sts:*; the filter answers
GetCallerIdentity before reading any policy.

A session whose issuer is gone is no credential at all, refused like an unknown
access key, so neither a resource policy nor S3's fallback to the account root
acts on its behalf. That covers a session minted with any other key IAM holds
(another session's, which AWS does not accept here, or an inactive key or
another account's, which account routing can land in the default account), a
session whose user was deleted and recreated under the same name, and one
stored before the issuer was recorded.

The caller identity follows: a GetSessionToken session's caller and principal
ARN are its user's, and a federated session's are its federated-user ARN, with
account:name as its user ID, as GetCallerIdentity reports for a federated user.

The unit test that pinned the GetSessionToken bypass now checks that a session
stored without an issuer is no credential; unit tests cover each kind of
issuer, the deny-only context of a federated session without a policy, and
that the issuer survives persistence. Integration tests (IAM and S3
enforcement, real SigV4) cover the role-name federation, the intersection, the
no-policy session, the GetSessionToken session and its AssumeRole, a
bucket-policy Deny keyed on the user's aws:PrincipalArn, both kinds of session
staying within the user's permissions boundary, a session of a recreated user
under a bucket policy granting everyone, and a bucket policy naming a federated
user against its user's explicit Deny, and a federated session refused IAM
and AssumeRole although both its user and session policy allow them; the SCP integration test now also checks
a root-minted session. All of them fail on main. Tests that built an STS
session credential as a role-less session with no issuer, a shape Floci no
longer creates, now build one the account root minted, or a presigned-URL
session, as production does.
2026-10-05 17:12:00 -05:00
..
2026-08-21 00:09:04 -04:00