Files
floci/src
Allen Sanborn af3dc4866e fix(kms): page ListKeys and ListAliases with Limit and Marker (#6269)
* fix(kms): page ListKeys and ListAliases with Limit and Marker

Both handlers ignored Limit and Marker and always returned every entry with
Truncated=false. They now page the way ListGrants does: entries sorted by id
(KeyId, AliasName), Marker is the base64 id of the last entry returned, an
unknown or undecodable Marker is InvalidMarkerException, and Limit is clamped
to the documented range (ListKeys 1-1000, ListAliases 1-100). ListAliases
applies the KeyId filter before paging. Without a Limit both still return
every entry.

* fix(kms): resume ListKeys and ListAliases after the marked entry is deleted

The Marker named the last entry returned and was rejected with
InvalidMarkerException when that entry was gone, so deleting while listing
(as Terraform and cloud-nuke do) broke the listing. Markers are now signed
cursors from core/common/SignedMarkers, as IAM and Lambda layers use, and the
next page starts at the first id sorting after the cursor. Only a marker this
instance did not issue is InvalidMarkerException.

* fix(kms): reject a ListKeys or ListAliases Limit outside the model

Limit was read with asInt() and clamped, so 0, a negative number, a string
or a decimal came back as a one-item page. The model types Limit as an
integer in LimitType [1..1000]: a non-integer is now SerializationException
and an out-of-range value is ValidationException with Smithy's wording.
ListAliases still clamps a Limit above its documented 100 page size.

* fix(kms): refuse a blank ListKeys or ListAliases Marker

A present but blank Marker was treated as omitted and restarted the listing.
An empty Marker now fails MarkerType's length >= 1 with ValidationException,
and a whitespace-only one is InvalidMarkerException, as for any marker this
instance did not issue.

* fix(kms): accept a ListKeys or ListAliases Marker only in the listing that issued it

The signed cursor named only the last id, so a marker from one listing was
accepted by another action, region or KeyId filter and silently skipped
every entry sorting before it. The cursor now carries the action, region and
resolved KeyId filter, and a marker presented anywhere else is
InvalidMarkerException. Resuming after the marked entry is deleted still
works.

* fix(kms): resolve the ListAliases KeyId filter once per page

ListAliases resolved the KeyId filter twice, once to filter and once for the
marker context. If an alias given as KeyId was repointed between the two
lookups, the page held one key's aliases while NextMarker was signed for
another, and the next page skipped entries. The filter is now resolved once
and that key id is used for both.

* fix(kms): refuse a non-string ListKeys or ListAliases Marker

MarkerType is a string, but the handler coerced other JSON values with
asText: an object or array became an empty marker (ValidationException) and
a number or boolean an unissued one (InvalidMarkerException). A non-string
Marker is now SerializationException, matching how a non-integer Limit is
refused.

* fix(kms): bind ListKeys and ListAliases markers to the account

KMS keys and aliases are stored per account, but the signed cursor named
only the action, region and filter, so a marker issued in one account was
accepted in another and skipped its entries sorting before the cursor. The
cursor now carries the request account, and a marker presented in another
account is InvalidMarkerException.
2026-10-22 16:53:23 -04:00
..