Files
floci/docs
Priamo Germosen 96fafbd4dc fix(iam): answer three refusals with their captured codes (#7364)
Captures from a real account on issue 6042 answer three refusals this
emulator had written for itself, each wrong in its code or its status
rather than only in its wording.

ChangePassword answered InvalidParameterValue 400 naming the user for a
wrong old password. AWS answers AccessDenied 403 and "Either the new
password does not conform to the account password policy or the old
password was incorrect.", which is now what it sends, as captured. The
sentence names both of the operation's causes without saying which one
refused the call, so a caller who cannot prove the current password
learns nothing about the policy either.

That it names the policy half does not settle the policy half. The
capture covers a wrong old password with a conforming new one, nothing
records AWS answering it for a password the policy refuses, and the
model declares PasswordPolicyViolation on this operation for exactly
that case, so a new password the account policy refuses keeps that error
and the rule it names, as it does on CreateLoginProfile and
UpdateLoginProfile. The old password is still read first, so a request
with both halves wrong answers the capture.

PolicySourceArn on SimulatePrincipalPolicy and
GetContextKeysForPrincipalPolicy resolved an entity out of whatever
followed the last slash, so arn:aws:iam:user/bob simulated as the user
bob. It is now held to AwsArnUtils.isArn before either simulator
resolves it, answering InvalidInput "Invalid ARN provided in the
request: <value>". A valid ARN that names neither a user nor a role
still answers the entity-type refusal it answered before.

GetAccessKeyInfo answered InvalidParameterValue quoting an id the
account never issued. AWS answers ValidationError "Access key ID is not
valid.", for an AKIA and an ASIA id alike, which also settles that it
refuses such an id rather than decoding the account out of it.

The wire and unit tests pin the two halves of the password refusal
answering differently and the order they are read in, both simulators
against three unparseable values and a well-formed one, and the key
refusal over both id formats. One enforcement test had pinned the
unparseable ARN resolving, which the capture overturns.
docs/services/iam.md and docs/services/sts.md carry the three answers,
what each capture covers, and what it leaves open.

Three comments that described these answers before the captures are
corrected with them: handleGetAccessKeyInfo's Javadoc, which still
called its old refusal a documented deviation,
StsAccessKeyInfoIntegrationTest's class comment, which said the same,
and validatedPolicySourceArn's, which said a value clearing 20
characters and parsing as no ARN is left alone and that what AWS answers
for one is not recorded.
2026-11-03 17:14:20 -06:00
..
2026-03-15 17:43:56 -05:00