Repository navigation
Description
What
GetCallerIdentity reports the caller's friendly name in UserId, where AWS reports a unique
ID.
getCallerIdentity (emulator/sts_plugin.go:66-110) parses the principal ARN and sets
userID = entityNamefor the IAM-user, assumed-role and default cases — so a call as alice answers
<UserId>alice</UserId>.
AWS's unique IDs are documented at
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html, which also names
GetCallerIdentity as the way to obtain one:
| caller | UserId |
|---|---|
| IAM user | the user's AIDA… unique ID |
| assumed role | AROA…:<role-session-name> |
| account root | the account ID |
A consumer that keys anything off UserId — a policy variable, an audit assertion, a session
identity check — sees a value whose shape is nothing AWS produces. aws:userid, published by
authzPrincipalContext since #771, already carries the right value for the same caller, so the two
substrate surfaces disagree with each other as well as with AWS.
Why it is cheap now
#771 recorded the unique ID on the credential precisely so the authorization path would not have to
derive it: Principal.UserID (emulator/types.go:118-175) holds the AIDA… for an access key
(copied from IAMAccessKey.UserID at CreateAccessKey time) and the AROA…:<session> for an STS
session (STSSessionCredentials.PrincipalID, computed by AssumeRole at sts_plugin.go:213).
getCallerIdentity does not read it.
The one case needing a fallback is a credential minted before #771, whose record has the field
empty. GetCallerIdentity is not a hot path, so reading the entity's record for its
UserId/RoleId is affordable there; a credential with no IAM entity behind it has no unique ID to
report and must not regress to an empty member.
Acceptance criteria
- An IAM user's
GetCallerIdentityreports theirAIDA…unique ID - An assumed role reports
AROA…:<role-session-name>, and the account root reports the account
ID — each cited against the reference above - A credential minted before iam: produce aws:userid and aws:PrincipalTag/, the two caller keys still without a producer #771 (empty
UserIDon the record) still reports a unique ID, via
the entity's own record - A credential with no IAM entity behind it reports something rather than an empty member, and
what it reports is documented as substrate's choice -
Arn,Accountand the response shape are unchanged
Found while planning v0.112.0, tracing what Principal.UserID is read by after #771.
Activity