GetAccessKeyInfo answered UnsupportedOperation 400. It takes one member and answers one: "when you pass an access key ID to this operation, it returns the ID of the AWS account to which the keys belong", and it models no errors at all, so the whole operation is that lookup plus the shape of its input. The lookup is not the one authentication uses. resolveAccountId takes only an active long-term key and a live session, because that is what a request may be signed with, where this operation is explicit about the opposite: "this operation does not indicate the state of the access key. The key might be active, inactive, or deleted". So findAccountForAccessKeyId answers from what is stored whatever state it is in, a long-term key through the account that holds it and an ASIA key through the session that minted it, which is the split the page draws between AKIA as "long-term credentials for an IAM user or the AWS account root user" and ASIA as "temporary credentials that are created using AWS STS operations". Both long-term lookups read one scan now, the authentication one keeping the Active filter over what the new one answers whole, so the guard and the scan are written once. The id is read against accessKeyIdType first, 16 to 128 characters of [\w], which the reference glosses as "any upper- or lowercase letter or digit", so a malformed id answers for its own shape rather than for a key that could not exist. The violation is rendered the way the one recorded IAM rendering Floci already follows renders it, the member in lower camel case and the offending value quoted beside it; the older STS operations name the parameter as written instead, which is drift of its own rather than something to copy here. An absent member and a present empty one are different answers as well: only the absent one reads as null, where AccessKeyId= is a value that fails the minimum and is quoted as the empty string it is, which is what IAM answers for an empty RoleName over this same wire. One answer is chosen rather than read. The operation models no error for a key that is not there, and the page says only that "providing a deleted access key might return an error that the key doesn't exist", so a well-formed id this emulator never issued answers InvalidParameterValue, the published common error closest to that sentence. docs/services/sts.md records it as a deviation rather than a recorded behaviour, since nothing says what AWS answers for an id it never issued. Enforcement is untouched on purpose. The "No permissions are required" note appears on GetCallerIdentity and GetSessionToken and on no other page in the reference, and sts:GetAccessKeyInfo is in the service authorization reference, so this one is authorized like any other action rather than exempted the way GetCallerIdentity is. Ten tests. Five over the wire: a long-term key answering the account that holds it, an inactive key still answering it, a session key answering the account its session belongs to, four shapes refused ahead of any lookup, and a well-formed id nobody holds. Five on the handler: the account answered and the authentication path not consulted, the absent, short, long and malformed ids, a present blank id read as a value rather than an absence, and the refusal for a key the service does not hold. Docs carry the action, a section on what it does and does not say about the key, and the matrix row at 9.
11 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 |
GetDelegatedAccessToken |
Exchange a delegation request's trade-in token for temporary credentials |
GetAccessKeyInfo |
Returns the account an access key ID belongs to |
Access Key Info
GetAccessKeyInfo answers the account an access key ID belongs to, and nothing about the key
itself: AWS states that the operation "does not indicate the state of the access key. The key might
be active, inactive, or deleted", so an inactive key answers its account the same as an active one.
A long-term AKIA key resolves through the account that holds it and a temporary ASIA key through
the session that minted it. The ID is read against its own shape first, 16 to 128 characters of
[\w], which answers ValidationError before any lookup.
One answer is Floci's own. The operation models no errors at all, and the reference says only that
"providing a deleted access key might return an error that the key doesn't exist", so a well-formed
ID that this emulator never issued answers InvalidParameterValue, the published common error
closest to that sentence. Nothing in the reference says what AWS answers for an ID it never issued,
and real access key IDs are not random the way Floci's are, so treat that one as a deviation rather
than a recorded behaviour.
Delegated Access Token
GetDelegatedAccessToken takes the exchange token an IAM delegation request released and answers
credentials in the customer's account, acting as the identity that approved the request, which is
the AssumedPrincipal it returns. Accepting a request records the identity that called it, and
that is the identity mapped to the delegated credential, so a request its owner forwarded to an
administrator for approval hands over the administrator's access rather than the owner's. The
credentials expire at the moment the customer released the token plus the request's
SessionDuration, not at the exchange, so the same token can be exchanged repeatedly and every
session it mints ends at the same time.
The credentials carry the permissions of that identity. AWS bounds them by the permission policy it renders from the partner's registered policy template, which no API registers, so Floci bounds them by the approving identity's own permissions: a user's policies and boundary, the account's access where the account root approved the request, and nothing at all where that identity no longer exists.
Only the account that filed the delegation request may exchange its token; any other account gets
AccessDenied. A token past its window, and a token nothing matches, both answer
ExpiredTradeInTokenException. PackedPolicySize is not returned, the model deprecating it and
stating it is not populated for this operation. See the delegation request section of the
IAM service doc for the lifecycle that issues the token.
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_STS_ENABLED |
true |
Enable or disable the service |
Session Token and Federation Token Permissions
GetSessionToken and GetFederationToken reject temporary callers with AccessDenied before issuing credentials,
including when IAM policy enforcement is disabled. Use a long-term IAM user or account key.
For an authenticated temporary caller, GetFederationToken returns
Cannot call GetFederationToken with session credentials with either enforcement setting.
When FLOCI_SERVICES_IAM_ENFORCEMENT_ENABLED=true, credentials from GetSessionToken and GetFederationToken
are evaluated as the identity whose long-term key signed the call, as on AWS:
GetSessionTokencredentials have the permissions of that IAM user, or of the account root when its key minted them, still bounded by the account's service control policies.GetFederationTokencredentials have no permissions without a session policy (Policy). With one, they have the intersection of that policy and the permissions of the IAM user that minted them, never those of a role that shares the federated user's name. A resource policy naming the federated user's ARN can grant access on its own, but not past an explicitDenyin the user's policies or permissions boundary. Whatever their policies allow, they cannot call any IAM operation, nor any STS operation exceptGetCallerIdentity. Managed session policies (PolicyArns) are not supported yet.
A session minted with another session's temporary credentials, which AWS does not accept here, with an inactive access key or one that belongs to another account, or by an IAM user since deleted and recreated under the same name, is not a valid credential: it is refused like an unknown access key. A key IAM does not know anywhere mints sessions that act as the account root, as the key itself does.
Trust Policy Enforcement
AssumeRole and AssumeRoleWithWebIdentity require the target role to exist in IAM, returning AccessDenied (403)
if it does not.
When FLOCI_SERVICES_IAM_ENFORCEMENT_ENABLED=true, AssumeRole also 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.
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 role that does not exist or 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, provided the target role exists in IAM. 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.
For GetSessionToken credentials they are those of the IAM user that minted them, and for GetFederationToken
credentials the FederatedUser.Arn and FederatedUser.FederatedUserId (<account>:<name>).
The response resolves both header and query-string credentials, including the query session token,
so a presigned request reports the same caller identity. A nonblank Authorization header retains
precedence over query credentials.
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.
When FLOCI_AUTH_VALIDATE_SIGNATURES=true, the shared signature verifier checks presigned query
credentials for STS operations, including GetCallerIdentity, GetSessionToken, GetFederationToken
and AssumeRole. It checks the request signature, credential scope, expiry and session token before
execution. Nonblank Authorization headers retain priority. See signature checks.