With IAM enforcement on, AssumeRole matched a trust policy on its Action and Principal only. The Condition block was never read and the ExternalId request parameter was ignored, so a role guarded by sts:ExternalId, the documented confused-deputy guard, could be assumed without it, and a conditional Deny applied whether or not its condition held. Trust-policy conditions now go through IamPolicyEvaluator's condition engine, through a new package-private conditionMatches, so they get the same operators as identity and resource policies. The request context holds sts:RoleSessionName, sts:ExternalId when the caller sends one, the global keys the enforcement filter already provides, and aws:PrincipalArn. A role session is now matched as the role that issued it, through that role's own ARN, path included. AssumeRole records it on the session when it issues one, and a new IamService.resolvePrincipalArn reads it back as is, so an old session keeps naming its role even after a same-named role replaces it. The evaluator used to rebuild the role ARN from the assumed-role session ARN, which names the role without its path, so a session of role/team/App was compared as role/App: a Principal naming the role refused it, and a condition on aws:PrincipalArn saw the wrong value. IAM stores a Principal naming a role as the role's unique ID, and aws:PrincipalArn is the ARN of the role that was assumed, so both are the full role ARN. A negated operator on an absent key now holds, as the IAM User Guide says for every condition operator but the IfExists forms and Null: "If the policy condition requires that the key is not matched, such as StringNotLike or ArnNotLike, and the right key is not present, the condition is true." evaluateConditionBlock failed every operator on an absent key, so once trust conditions were evaluated a Deny with StringNotEquals on sts:ExternalId stopped refusing a call that omits ExternalId. The change is in the shared engine, so identity, resource and SCP conditions get the same rule; the set operators keep their own rule for an absent key. The AppSync service-trust path from #4555 had its own small condition evaluator for aws:SourceArn and aws:SourceAccount. It now uses the same engine with those two keys as its context, which also makes negated operators such as StringNotEquals work there instead of refusing the document. A Condition that is not an object of non-empty operator objects still invalidates the whole trust document, now on every path. The trust check also resolved the caller's account from the Authorization header alone, where only a 12-digit key names an account. An IAM user's or a role session's key, and any presigned request, therefore counted as the default account and could assume a role that trusts only that account. The check now uses the account the request was resolved to, and reads a presigned caller's key from X-Amz-Credential.
5.3 KiB
STS
Protocol: Query (XML) — POST http://localhost:4566/ with Action= parameter
Supported Actions
| Action | Description |
|---|---|
GetCallerIdentity |
Returns the account ID, user ID, and ARN |
AssumeRole |
Assume an IAM role, returns temporary credentials |
AssumeRoleWithWebIdentity |
Assume a role using a web identity token (OIDC) |
AssumeRoleWithSAML |
Assume a role using a SAML assertion |
GetSessionToken |
Get temporary credentials for an IAM user |
GetFederationToken |
Get temporary credentials for a federated user |
DecodeAuthorizationMessage |
Decode an encoded authorization failure message |
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_STS_ENABLED |
true |
Enable or disable the service |
Trust Policy Enforcement
By default AssumeRole succeeds for any caller. When FLOCI_SERVICES_IAM_ENFORCEMENT_ENABLED=true,
AssumeRole evaluates the target role's trust policy (AssumeRolePolicyDocument) against the caller
and returns AccessDenied if it is not permitted. AWS principal forms are matched — "*", an
account id, an account-root ARN (arn:aws:iam::<acct>:root), and exact principal ARNs — and an
explicit Deny always wins. Both Action and NotAction elements are honored when matching
sts:AssumeRole. Roles that Floci has no record of stay permissive, so this only affects roles
created through IAM with a real trust policy.
The caller is the account that owns the request's credentials, whether they sign the
Authorization header or a presigned query string: an IAM user's or a role session's access key
belongs to its own account, not to the default one. A role session matches a Principal that
names its session ARN or its role's ARN, path included.
Condition blocks are evaluated with the same operators as identity and resource policies. The
request context holds sts:RoleSessionName, sts:ExternalId when the caller passes ExternalId,
aws:PrincipalArn (for a caller using assumed-role credentials, the role's ARN with its path, as on AWS),
aws:PrincipalAccount, aws:ResourceAccount, aws:RequestedRegion and
aws:PrincipalIsAWSService. A trust policy that requires sts:ExternalId, the confused-deputy
guard, refuses a call that omits it or passes another value, and a conditional Deny applies only
when its condition matches.
Known limitations
- Session tags and source identity are not modelled.
aws:RequestTag/*,aws:TagKeys,sts:TransitiveTagKeysandsts:SourceIdentityare not in the request context, so a condition on them does not match, andsts:TagSessionandsts:SetSourceIdentityare not checked. - The caller's own permission is checked against
*. The caller's identity policy must allowsts:AssumeRole, but it is evaluated for resource*rather than the role's ARN, so a policy that names the role inResourcedoes not grant it.
Web Identity Validation (IRSA)
AssumeRoleWithWebIdentity validates tokens minted by an OIDC issuer Floci hosts - currently an EKS cluster's IRSA provider.
When the token's iss names a known Floci issuer, all of the following are enforced:
- the RS256 signature, against the issuer's public key
issmatches that issuer exactlyaudcontainssts.amazonaws.comexp/nbf, with 60s of clock-skew tolerance- the role's trust policy —
Principal.Federatedplus theConditionblock, comparing<oidcProvider>:suband<oidcProvider>:audwith exact, case-sensitive equality (StringEquals,StringNotEquals,StringLike, andStringNotLikeare supported)
The response carries the token's real claims in SubjectFromWebIdentityToken, Provider, and Audience. A bad token returns InvalidIdentityToken (400), an expired one returns ExpiredTokenException (400), and a trust policy that does not permit the subject returns AccessDenied (403).
By default, tokens from an issuer Floci does not host, or tokens that are not parseable JWTs, are treated as opaque and accepted for compatibility with existing workflows. When FLOCI_SERVICES_IAM_ENFORCEMENT_ENABLED=true, those tokens return InvalidIdentityToken because Floci cannot verify a third-party provider's signature. See EKS for the full IRSA walkthrough and the token-minting endpoint.
Examples
export AWS_ENDPOINT_URL=http://localhost:4566
# Get caller identity (always works, useful for smoke testing)
aws sts get-caller-identity --endpoint-url $AWS_ENDPOINT_URL
# Assume a role
aws sts assume-role \
--role-arn arn:aws:iam::000000000000:role/my-role \
--role-session-name dev-session \
--endpoint-url $AWS_ENDPOINT_URL
# Get a session token
aws sts get-session-token --endpoint-url $AWS_ENDPOINT_URL
GetCallerIdentity is commonly used in CI pipelines and integration tests as a quick connectivity check before running more complex tests.
For temporary credentials returned by an assumed-role action, its Arn and UserId match
the AssumedRoleUser.Arn and AssumedRoleUser.AssumedRoleId returned when the session was created.
When FLOCI_SERVICES_IAM_SEED_DEPLOYER_PRINCIPAL=true, requests signed with the seeded floci access key return arn:aws:iam::000000000000:user/floci-deployer. Other unknown local credentials continue to return the account root ARN for backward compatibility.