docs(iam): close the service principal's comma on what AWS publishes (#7617)

`CreateServiceLinkedRole`'s AWSServiceName was left with one question open.
The capture on #6042 quotes [\w+=.@-]* for it, without the comma the
vendored shape admits, and nothing recorded said whether AWS takes a comma
or refuses one, so the shape kept the model's pattern and the message the
captured text.

AWS's own API Reference entry for the operation answers the part that
matters. It gives the member a minimum length of 1 and the pattern
[\w+=,.@-]+, the comma included, which is what botocore declares for the
shape it aliases the member to as well. The comma is therefore what AWS
documents for this member rather than something that aliasing brought
along, the captured message is the only source that drops it, and a message
answers for the text a violation carries rather than for what a value is
held to. So what a principal is held to stays the published pattern and
nothing moves about what this service admits. The minimum is published
there too, which is why an empty principal stays refused for a reason of
AWS's own rather than the model's alone.

What is left is a reading worth pinning rather than inferred again: a
principal carrying a comma clears the shape and reaches the lookup, where a
service no recording covers has its role name derived from the principal's
labels, the answer any unrecorded principal gets. That reasoning lives in the
docs page alone, with the generator's comment and the test's javadoc pointing
at it, and a capture of AWS refusing a comma as a pattern violation moves the
quoted-pattern entry, the shapes file a regeneration writes from it, and that
test.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-06 23:02:22 -06:00
1 parent 6110825561
commit ee2cdfc4f8
3 files changed
+46 -3

No files matched your search

+16 -2
View File
@@ -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
@@ -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() {
+7 -1
View File
@@ -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+=.@-]*"),
}