diff --git a/docs/services/iam.md b/docs/services/iam.md index 08c1db96cd..9724700c36 100644 --- a/docs/services/iam.md +++ b/docs/services/iam.md @@ -411,8 +411,22 @@ model. A comma is therefore still admitted, and an empty principal is still refu same split the enum order above takes, the captured rendering over the model's, and one object decides which text any violation quotes, so no other member moves with it. -What a second capture would settle is the comma: `CreateServiceLinkedRole` with one in the -principal, which AWS either refuses as a pattern violation or takes. +The comma was the half left open, and what settles it is what AWS publishes rather than a second +capture. The API Reference entry for `CreateServiceLinkedRole`, read on 2026-11-03, gives +`AWSServiceName` a minimum length of 1 and the pattern `[\w+=,.@-]+`, the comma included, which is +the pattern botocore declares for the shape it aliases the member to as well. The comma is +therefore what AWS documents for this member rather than an artifact of that aliasing, and the +captured message is the only source that drops it: a message is evidence of the text a violation +carries, not of what a value is held to. The minimum is published there too, so the empty principal +the message's `*` would admit stays refused for a reason of AWS's own rather than the model's alone. +A principal carrying a comma clears the shape here and reaches +the lookup, where a service no recording covers has its role name derived from the principal's +labels rather than refused, which is this emulator's own decision and the answer any unrecorded +principal gets. This paragraph is where that reasoning lives: the generator and the test that pins +the comma point here rather than repeating it. A capture of AWS refusing a comma as a pattern +violation moves the quoted-pattern entry in `tools/aws/regen_iam_shapes.py`, the +`src/main/resources/aws/iam-request-shapes.json` a regeneration writes from it, which that +generator's own test holds the entry to, the test that pins the comma, and this paragraph. ### Permission Boundaries diff --git a/src/test/java/io/floci/aws/services/iam/IamServiceLinkedRoleIntegrationTest.java b/src/test/java/io/floci/aws/services/iam/IamServiceLinkedRoleIntegrationTest.java index 49738a63fd..cf8c75dd12 100644 --- a/src/test/java/io/floci/aws/services/iam/IamServiceLinkedRoleIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/iam/IamServiceLinkedRoleIntegrationTest.java @@ -398,6 +398,29 @@ class IamServiceLinkedRoleIntegrationTest { + " pattern: [\\w+=.@-]*")); } + /** + * A comma is admitted, which is the half of this member's drift the capture did not settle: + * AWS's own message quotes {@code [\w+=.@-]*} without one and the pattern AWS publishes for the + * member carries it. Why the published pattern is what a value is held to here is in + * {@code docs/services/iam.md} rather than repeated. What this pins is where a comma lands: the + * shape takes it and the lookup derives the role name, the answer any service no recording + * covers gets, which is what {@link #aServiceTheRecordingsDoNotCoverStillTakesASuffix} pins. + */ + @Test + @Order(34) + void aPrincipalWithACommaIsHeldToThePatternAwsPublishes() { + given() + .formParam("Action", "CreateServiceLinkedRole") + .formParam("AWSServiceName", "commaprobe,test.amazonaws.com") + .header("Authorization", AUTH_HEADER) + .when() + .post("/") + .then() + .statusCode(200) + .body("CreateServiceLinkedRoleResponse.CreateServiceLinkedRoleResult.Role.RoleName", + equalTo("AWSServiceRoleForCommaprobe,test")); + } + @Test @Order(15) void aServiceNameLongerThanTheDocumentedMaximumIsRejected() { diff --git a/tools/aws/regen_iam_shapes.py b/tools/aws/regen_iam_shapes.py index 2a393ef17a..f760a61203 100644 --- a/tools/aws/regen_iam_shapes.py +++ b/tools/aws/regen_iam_shapes.py @@ -163,7 +163,13 @@ def enum_order(model: dict, orders: dict[str, tuple[str, ...]] | None = None) -> # account on 2026-10-31, quotes `[\w+=.@-]*` for it, without the comma this model admits and with a # `*` where the model sets a minimum of 1. Only AWS's message is in hand rather than its shape, so # the member carries a shape of its own here with AWS's text beside the model's: the message is the -# captured one and a comma is still admitted, which nothing in hand settles either way. +# captured one and a comma is still admitted. +# +# The comma is what AWS publishes for this member, not what aliasing it to a group name's shape +# brought along: the API Reference entry for the operation, read on 2026-11-03, gives +# `AWSServiceName` the same `[\w+=,.@-]+` and the same minimum of 1, so the pattern below stays the +# published one. Why that settles it, and what a capture of a comma refused would move, is in +# `docs/services/iam.md` rather than repeated here. QUOTED_PATTERNS = { ("CreateServiceLinkedRole", "AWSServiceName"): ("groupNameType", r"[\w+=,.@-]+", r"[\w+=.@-]*"), }