Files
floci/docs
Priamo Germosen 62c202f073 fix(iam): read declared constraints before the lookup they precede (#6402)
The validation AWS runs ahead of an operation never reaches its store, so a
request that breaks a declared constraint is refused whether or not the thing it
names exists. Four places here had the order the other way round, and each one
answered a 404 for a request AWS answers with a 400.

The three Access Advisor and Organizations report readers looked the job up
before reading JobId, MaxItems and Marker, so an unknown job carrying a
MaxItems of 0 answered NoSuchEntity, and a JobId of the wrong length was never
held to its shape at all. jobIDType is min 36 and max 36, and the fixed length
reports as one constraint, "Member must have length equal to 36", which is the
form lifecycleActionToken already uses for the same shape in Auto Scaling. The
MaxItems check moves out of paginate so a reader can run it early, and paginate
still runs it, being reached from readers that look nothing up.

GenerateServiceLastAccessedDetails had the same order on its Granularity enum,
reading it inside the generate that sits behind the ARN resolution, so a
granularity AWS refuses answered NoSuchEntity for an ARN that named nothing.
The check is its own method now and the handler runs it first.

PolicySourceArn is arnType, min 20, and the simulators resolved the entity out
of whatever followed the last slash, so ":user/bob" simulated against a user
named bob. A value too short to be any ARN is now the length ValidationError
IAM answers for a short ARN member. A value that clears 20 characters and still
parses as no ARN is left alone: the member publishes no pattern, and no source
records what AWS answers for one.

The service-specific credential id reported both of its length bounds in one
violation, so a short id was told about a 128-character ceiling it was nowhere
near. Each message names the one bound the value broke, which is how every
recorded IAM length violation reads: "Member must have length less than or
equal to 64" for a user name over 64, and "Member must have length greater than
or equal to 20" for an ARN under 20.

Seven tests. Four over the wire on the readers: a JobId of the wrong length
refused before any lookup on both the last-accessed reader and the entities
reader, the same on the Organizations reader with no organization built at all,
and an unknown job carrying a bad MaxItems, a bad Marker and then nothing wrong,
which pins the 400s and the surviving 404. One on the generator, where the
granularity is refused for an ARN that names nothing. One on both simulators for
a PolicySourceArn under 20. And the credential id's two bounds, each asserting
the other bound is absent from the message, with the credential itself still
listed once the refusals are done: a validation error that deleted something on
its way out would read the same from the response alone.
2026-10-24 08:38:33 -05:00
..
2026-03-15 17:43:56 -05:00