mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(iam): refuse a service namespace that names no AWS service (#8865)
The member's pattern admits anything word-shaped, so a value like amazon-s3 satisfied everything the model declares and was answered 200 with an empty policy list, telling a caller the identity reaches nothing rather than that the question was wrong. Both operations that take a namespace hold it to the vendored catalog now, through AwsServiceNamespaces.isPublished so nothing keeps a second list, and each answers the sentence recorded for it: the list operation names the rejected values inside AWS's own brackets, and the entity reader carries AWS's own misspelling of namepace. ServiceNamespaces is vendored for that to hold. The generator held the whole member back because the operation answered an empty list with a sentence of its own, and the cost was that no value in the list was read at all: one breaking the published pattern reached the catalog check and was answered InvalidInput where AWS answers ValidationError. The member is read now, each value held to serviceNamespaceType and the list to its bounds of 1 to 200, which also retires two answers that were this package's own: an absent list is the required member the model declares, and a list over 200 is the model's bound rather than a check beside it. A namespace the job itself reports stays readable on GetServiceLastAccessedDetailsWithEntities whether the catalog publishes it or not, so the job is read first. The catalog is vendored, and a policy may grant a service published after it: the report keeps the namespace that policy names, so refusing it there would be this package disagreeing with itself. Nothing else is exempt, and the list operation, which takes namespaces rather than reporting them, holds every value to the catalog.
This commit is contained in:
1 parent
a72aedfbb0
commit
4fe226c253
7 files changed
+336
-14
No files matched your search
@@ -1317,6 +1317,51 @@ The generator's only modeled error, `ReportGenerationLimitExceeded`, reports con
|
||||
for the account and stays unreachable here: a job is complete the moment it is created, so two can
|
||||
never overlap.
|
||||
|
||||
### A service namespace that names no service
|
||||
|
||||
`ServiceNamespace` and `ServiceNamespaces` are patterned `^[\w-]*$`, so a word-shaped value such as
|
||||
`amazon-s3` satisfies everything the model declares and still names no AWS service. AWS checks the
|
||||
value against its own namespaces and refuses what it does not publish, where this emulator used to
|
||||
answer 200 with an empty policy list per namespace asked for, telling a caller the identity reaches
|
||||
nothing rather than that the question was wrong.
|
||||
|
||||
The two operations that take one word it differently, and both are recorded against a real account
|
||||
on 2026-11-03, each `InvalidInput` 400 with a sender fault:
|
||||
|
||||
- `ListPoliciesGrantingServiceAccess` answers `Invalid service namespace: [<namespace>]`, the
|
||||
brackets being AWS's own. The recording covers one rejected value; several are rendered inside
|
||||
the one pair of brackets, which is this emulator's reading of a sentence AWS writes for the
|
||||
plural.
|
||||
- `GetServiceLastAccessedDetailsWithEntities` answers `Service namepace <namespace> is either
|
||||
invalid or unsupported.` The misspelling of `namespace` is AWS's and is kept: a client matching
|
||||
the message has to match what the service sends.
|
||||
|
||||
The catalog is the vendored one generated from AWS's Service Reference index, read through
|
||||
`AwsServiceNamespaces.isPublished`, so nothing hand-maintains a second list. The check runs after
|
||||
the declared constraints, which is the order this package refuses request inputs in: a value that
|
||||
breaks the published pattern `[\w-]*` is answered that pattern, and only a well-formed value
|
||||
reaches the catalog.
|
||||
|
||||
Both members are vendored for that to hold. `ServiceNamespace` always was.
|
||||
`ListPoliciesGrantingServiceAccess` carried no entry for `ServiceNamespaces` at all, so nothing
|
||||
held its members to anything, and a value with a space in it used to reach the catalog check and be
|
||||
answered `InvalidInput` where AWS answers `ValidationError`. The member is read now, each value
|
||||
held to `serviceNamespaceType` and the list to its own bounds of 1 to 200, which also moves two
|
||||
answers that were this emulator's own: a request carrying no namespace is the required member the
|
||||
model declares rather than `InvalidInput` and a sentence AWS writes nowhere, and a list over 200 is
|
||||
the model's bound rather than a check beside it.
|
||||
|
||||
A namespace the job itself reports is readable on `GetServiceLastAccessedDetailsWithEntities`
|
||||
whether the catalog publishes it or not, which is why the job is read before the namespace is
|
||||
judged, and why a job id naming nothing is answered as a missing job rather than as a bad
|
||||
namespace. Which of the two a request breaking both is answered is recorded nowhere. The catalog is vendored, so it is as new as the last regeneration, where a policy may grant
|
||||
a service published after it: `GenerateServiceLastAccessedDetails` keeps the namespaces the
|
||||
policies name, so the report would list that service and a request for its entities would then be
|
||||
refused, which is this emulator disagreeing with itself. Nothing else is exempt: a namespace the
|
||||
job does not report and the catalog does not publish is still refused, and the list operation,
|
||||
which takes namespaces as input rather than reporting them, holds every value to the catalog. A
|
||||
service published after the vendored index is a regeneration away, not a runtime lookup.
|
||||
|
||||
### Multi-Factor Authentication
|
||||
|
||||
| Action | Description |
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Every IAM service namespace, read once from the vendored {@code aws/iam-service-namespaces.json}.
|
||||
@@ -34,6 +35,7 @@ public final class AwsServiceNamespaces {
|
||||
|
||||
private static final class Holder {
|
||||
static final List<String> NAMESPACES = load();
|
||||
static final Set<String> LOOKUP = Set.copyOf(NAMESPACES);
|
||||
}
|
||||
|
||||
private AwsServiceNamespaces() {
|
||||
@@ -50,6 +52,15 @@ public final class AwsServiceNamespaces {
|
||||
return Holder.NAMESPACES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether AWS publishes {@code namespace} as a service namespace, for an operation that takes
|
||||
* one from a caller and has to refuse what names no service. The test lives here rather than
|
||||
* in the caller so the catalog is read in one place and nothing hand-maintains a second list.
|
||||
*/
|
||||
public static boolean isPublished(String namespace) {
|
||||
return namespace != null && Holder.LOOKUP.contains(namespace);
|
||||
}
|
||||
|
||||
private static List<String> load() {
|
||||
try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_NAME)) {
|
||||
if (in == null) {
|
||||
|
||||
@@ -88,8 +88,6 @@ public class IamQueryHandler {
|
||||
private static final Set<String> SORT_KEYS = Set.of("SERVICE_NAMESPACE_ASCENDING",
|
||||
"SERVICE_NAMESPACE_DESCENDING", "LAST_AUTHENTICATED_TIME_ASCENDING",
|
||||
"LAST_AUTHENTICATED_TIME_DESCENDING");
|
||||
/** {@code serviceNamespaceListType}: minimum 1 item, maximum 200. */
|
||||
private static final int MAX_SERVICE_NAMESPACES = 200;
|
||||
private static final int MAX_TAG_LIST_MEMBERS = 50;
|
||||
private static final int MAX_TAG_KEY_LENGTH = 128;
|
||||
private static final int MAX_TAG_VALUE_LENGTH = 256;
|
||||
@@ -2835,6 +2833,47 @@ public class IamQueryHandler {
|
||||
return arn;
|
||||
}
|
||||
|
||||
/**
|
||||
* The namespaces a request names, held to the ones AWS publishes. The member's pattern admits
|
||||
* anything word-shaped, so a value like {@code amazon-s3} satisfies the model and still names
|
||||
* no service, and AWS refuses it rather than reporting that the identity reaches nothing.
|
||||
*
|
||||
* <p>Recorded on {@code ListPoliciesGrantingServiceAccess} on 2026-11-03: {@code InvalidInput}
|
||||
* 400 with a sender fault and {@code Invalid service namespace: [<namespace>]}, the brackets
|
||||
* being AWS's own. The recording covers one bad value; several are rendered inside the one
|
||||
* pair of brackets, which is this emulator's reading of a sentence AWS writes for the plural.
|
||||
*/
|
||||
private static void requirePublishedNamespaces(List<String> namespaces) {
|
||||
List<String> unknown = namespaces.stream()
|
||||
.filter(namespace -> !AwsServiceNamespaces.isPublished(namespace))
|
||||
.toList();
|
||||
if (!unknown.isEmpty()) {
|
||||
throw new AwsException("InvalidInput",
|
||||
"Invalid service namespace: [" + String.join(", ", unknown) + "]", 400);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The same rule for the member that takes one namespace, which AWS words differently and
|
||||
* spells {@code namepace}, recorded on {@code GetServiceLastAccessedDetailsWithEntities} on
|
||||
* 2026-11-03. The misspelling is AWS's and is kept, a client matching the message having to
|
||||
* match what the service sends.
|
||||
*
|
||||
* <p>A namespace the job itself reports is readable whether the catalog publishes it or not.
|
||||
* The catalog is vendored, so it is as new as the last regeneration, where a policy may grant
|
||||
* a service published after it: the report would list that namespace and a request for its
|
||||
* entities would then be refused, which is this emulator disagreeing with itself. The job is
|
||||
* what decides, which is why it is read first. Nothing else is exempt: a namespace the job
|
||||
* does not report and the catalog does not publish is still refused.
|
||||
*/
|
||||
private static void requireReadableNamespace(String namespace, ServiceLastAccessedJob job) {
|
||||
if (AwsServiceNamespaces.isPublished(namespace) || job.getServiceNamespaces().contains(namespace)) {
|
||||
return;
|
||||
}
|
||||
throw new AwsException("InvalidInput",
|
||||
"Service namepace " + namespace + " is either invalid or unsupported.", 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code SortKey} if the request carries one the enum permits, null if it carries none. A
|
||||
* request that carries the member is held to the enum whatever it carries: an empty value is
|
||||
@@ -2883,6 +2922,7 @@ public class IamQueryHandler {
|
||||
validatePagingInputs("GetServiceLastAccessedDetailsWithEntities", params);
|
||||
ServiceLastAccessedJob job = serviceLastAccessedService.get(
|
||||
accountResolver.resolve(authorization), jobId);
|
||||
requireReadableNamespace(namespace, job);
|
||||
// The report named the services it covers, so an entity is only reported for one of those.
|
||||
List<ServiceLastAccessedEntity> reported = job.getServiceNamespaces().contains(namespace)
|
||||
? job.getEntities() : List.of();
|
||||
@@ -2917,12 +2957,12 @@ public class IamQueryHandler {
|
||||
String authorization) {
|
||||
String accountId = accountResolver.resolve(authorization);
|
||||
String arn = requireParam(params, "Arn");
|
||||
// The vendored request shape carries the member now, so the declared constraints are read
|
||||
// ahead of this method: an absent list is the required member it declares, a list over 200
|
||||
// is its own bound, and a value breaking the published pattern is that pattern. What is
|
||||
// left here is the one rule the model cannot state, which services AWS publishes.
|
||||
List<String> namespaces = getMemberList(params, "ServiceNamespaces");
|
||||
if (namespaces.isEmpty()) {
|
||||
throw new AwsException("InvalidInput",
|
||||
"The request must include at least one service namespace.", 400);
|
||||
}
|
||||
checkListLength(namespaces.size(), "serviceNamespaces", MAX_SERVICE_NAMESPACES);
|
||||
requirePublishedNamespaces(namespaces);
|
||||
List<GrantingPolicy> candidates = policiesForIdentity(accountId, arn);
|
||||
// The response list carries one entry per requested namespace, so that is what a Marker
|
||||
// walks through. The request models no MaxItems, so the table gives it no limit and the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_source": {
|
||||
"generator": "tools/aws/regen_iam_shapes.py",
|
||||
"botocore": "botocore 1.43.118 (local/aws/botocore)"
|
||||
"botocore": "botocore 1.43.118 (installed package)"
|
||||
},
|
||||
"operations": {
|
||||
"AcceptDelegationRequest": "AcceptDelegationRequestRequest",
|
||||
@@ -1233,11 +1233,13 @@
|
||||
"ListPoliciesGrantingServiceAccessRequest": {
|
||||
"type": "structure",
|
||||
"required": [
|
||||
"Arn"
|
||||
"Arn",
|
||||
"ServiceNamespaces"
|
||||
],
|
||||
"members": {
|
||||
"Marker": "markerType",
|
||||
"Arn": "arnType"
|
||||
"Arn": "arnType",
|
||||
"ServiceNamespaces": "serviceNamespaceListType"
|
||||
}
|
||||
},
|
||||
"ListPoliciesRequest": {
|
||||
@@ -2418,6 +2420,12 @@
|
||||
"serviceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"serviceNamespaceListType": {
|
||||
"type": "list",
|
||||
"min": 1,
|
||||
"max": 200,
|
||||
"member": "serviceNamespaceType"
|
||||
},
|
||||
"serviceNamespaceType": {
|
||||
"type": "string",
|
||||
"min": 1,
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
package io.floci.aws.services.iam;
|
||||
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
* A service namespace a request names has to be one AWS publishes. The member's pattern admits
|
||||
* anything word-shaped, so a value like {@code amazon-s3} satisfies the model and names no service,
|
||||
* and AWS refuses it rather than reporting that the identity reaches nothing. The two operations
|
||||
* that take one word the refusal differently, and both sentences are recorded.
|
||||
*
|
||||
* <p>{@code docs/services/iam.md} carries the recordings.
|
||||
*/
|
||||
@QuarkusTest
|
||||
class IamServiceNamespaceCheckIntegrationTest {
|
||||
|
||||
private static final String IAM_AUTH =
|
||||
"AWS4-HMAC-SHA256 Credential=test/20261118/us-east-1/iam/aws4_request";
|
||||
|
||||
private static final String CODE = "ErrorResponse.Error.Code";
|
||||
private static final String MESSAGE = "ErrorResponse.Error.Message";
|
||||
private static final String TYPE = "ErrorResponse.Error.Type";
|
||||
|
||||
/** Word-shaped, so the declared pattern admits it, and no service of AWS's. */
|
||||
private static final String NOT_A_SERVICE = "amazon-s3";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
private static RequestSpecification iam(String action) {
|
||||
return given().header("Authorization", IAM_AUTH).formParam("Action", action);
|
||||
}
|
||||
|
||||
private static String unique(String prefix) {
|
||||
return prefix + "-" + Long.toString(System.nanoTime(), 36);
|
||||
}
|
||||
|
||||
private String createUser() {
|
||||
String userName = unique("namespace-user");
|
||||
iam("CreateUser").formParam("UserName", userName).when().post("/").then().statusCode(200);
|
||||
cleanup.register(() -> iam("DeleteUser").formParam("UserName", userName)
|
||||
.when().post("/").then().statusCode(200));
|
||||
return "arn:aws:iam::000000000000:user/" + userName;
|
||||
}
|
||||
|
||||
private String jobFor(String arn) {
|
||||
return iam("GenerateServiceLastAccessedDetails").formParam("Arn", arn)
|
||||
.when().post("/").then().statusCode(200)
|
||||
.extract().path("GenerateServiceLastAccessedDetailsResponse."
|
||||
+ "GenerateServiceLastAccessedDetailsResult.JobId");
|
||||
}
|
||||
|
||||
/** The list operation names the rejected value inside AWS's own brackets. */
|
||||
@Test
|
||||
void aNamespaceThatNamesNoServiceIsRefusedByTheListOperation() {
|
||||
iam("ListPoliciesGrantingServiceAccess").formParam("Arn", createUser())
|
||||
.formParam("ServiceNamespaces.member.1", NOT_A_SERVICE)
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("InvalidInput"))
|
||||
.body(TYPE, equalTo("Sender"))
|
||||
.body(MESSAGE, equalTo("Invalid service namespace: [" + NOT_A_SERVICE + "]"));
|
||||
}
|
||||
|
||||
/** Several bad values go inside the one pair of brackets, which is the reading. */
|
||||
@Test
|
||||
void severalRejectedNamespacesShareTheBrackets() {
|
||||
iam("ListPoliciesGrantingServiceAccess").formParam("Arn", createUser())
|
||||
.formParam("ServiceNamespaces.member.1", NOT_A_SERVICE)
|
||||
.formParam("ServiceNamespaces.member.2", "s3")
|
||||
.formParam("ServiceNamespaces.member.3", "not-a-service")
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("InvalidInput"))
|
||||
.body(MESSAGE, equalTo("Invalid service namespace: ["
|
||||
+ NOT_A_SERVICE + ", not-a-service]"));
|
||||
}
|
||||
|
||||
/** The single-namespace reader words it differently, AWS's own misspelling included. */
|
||||
@Test
|
||||
void aNamespaceThatNamesNoServiceIsRefusedByTheEntityReader() {
|
||||
String arn = createUser();
|
||||
iam("GetServiceLastAccessedDetailsWithEntities").formParam("JobId", jobFor(arn))
|
||||
.formParam("ServiceNamespace", NOT_A_SERVICE)
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("InvalidInput"))
|
||||
.body(MESSAGE, equalTo("Service namepace " + NOT_A_SERVICE
|
||||
+ " is either invalid or unsupported."));
|
||||
}
|
||||
|
||||
/**
|
||||
* The job is read ahead of the namespace, because the job is part of what decides whether a
|
||||
* namespace can be read: one the report lists is readable whatever the catalog says. So a job
|
||||
* that does not exist is answered as a missing job, and the namespace is judged against a
|
||||
* report that exists. Which of the two a request breaking both is answered is recorded
|
||||
* nowhere, and this is the order that lets the two readers agree.
|
||||
*/
|
||||
@Test
|
||||
void aJobThatDoesNotExistIsAnsweredBeforeTheNamespace() {
|
||||
iam("GetServiceLastAccessedDetailsWithEntities")
|
||||
.formParam("JobId", "00000000-0000-4000-8000-000000000000")
|
||||
.formParam("ServiceNamespace", NOT_A_SERVICE)
|
||||
.when().post("/").then().statusCode(404)
|
||||
.body(CODE, equalTo("NoSuchEntity"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Where the vendored shape carries the member, a value breaking its published pattern still
|
||||
* answers the constraint, which runs ahead of this check.
|
||||
*/
|
||||
@Test
|
||||
void aValueBreakingTheDeclaredPatternStillAnswersTheConstraint() {
|
||||
iam("GetServiceLastAccessedDetailsWithEntities")
|
||||
.formParam("JobId", "00000000-0000-4000-8000-000000000000")
|
||||
.formParam("ServiceNamespace", "not a namespace")
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"));
|
||||
}
|
||||
|
||||
/**
|
||||
* A value breaking the published pattern is answered that pattern, not the catalog. The list
|
||||
* member is vendored now, so the declared constraints are read ahead of the catalog check and
|
||||
* only a well-formed value reaches it.
|
||||
*/
|
||||
@Test
|
||||
void aMalformedListMemberIsAnsweredThePublishedPattern() {
|
||||
iam("ListPoliciesGrantingServiceAccess").formParam("Arn", createUser())
|
||||
.formParam("ServiceNamespaces.member.1", "not a namespace")
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"))
|
||||
.body(MESSAGE, equalTo("1 validation error detected: Value at"
|
||||
+ " 'serviceNamespaces.1.member' failed to satisfy constraint: Member must"
|
||||
+ " satisfy regular expression pattern: [\\w-]*"));
|
||||
}
|
||||
|
||||
/**
|
||||
* An absent list is how an empty one arrives on this protocol, and the model requires the
|
||||
* member, so that is what answers it. This package used to answer `InvalidInput` and a
|
||||
* sentence of its own here, which no recording carries.
|
||||
*/
|
||||
@Test
|
||||
void anAbsentListIsTheRequiredMemberTheModelDeclares() {
|
||||
iam("ListPoliciesGrantingServiceAccess").formParam("Arn", createUser())
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"))
|
||||
.body(MESSAGE, equalTo("1 validation error detected: Value at"
|
||||
+ " 'serviceNamespaces' failed to satisfy constraint: Member must not be"
|
||||
+ " null"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The catalog is vendored, so a policy may grant a service published after it. The report
|
||||
* keeps the namespace that policy names, and a request for its entities is answered rather
|
||||
* than refused: the job is what decides, so this emulator cannot report a service and then
|
||||
* refuse to read it.
|
||||
*/
|
||||
@Test
|
||||
void aNamespaceTheJobItselfReportsIsReadable() {
|
||||
String userName = unique("namespace-future");
|
||||
iam("CreateUser").formParam("UserName", userName).when().post("/").then().statusCode(200);
|
||||
cleanup.register(() -> iam("DeleteUser").formParam("UserName", userName)
|
||||
.when().post("/").then().statusCode(200));
|
||||
iam("PutUserPolicy").formParam("UserName", userName)
|
||||
.formParam("PolicyName", "grants-a-later-service")
|
||||
.formParam("PolicyDocument", "{\"Version\":\"2012-10-17\",\"Statement\":"
|
||||
+ "[{\"Effect\":\"Allow\",\"Action\":\"somefutureservice:DoThing\","
|
||||
+ "\"Resource\":\"*\"}]}")
|
||||
.when().post("/").then().statusCode(200);
|
||||
cleanup.register(() -> iam("DeleteUserPolicy").formParam("UserName", userName)
|
||||
.formParam("PolicyName", "grants-a-later-service")
|
||||
.when().post("/").then().statusCode(200));
|
||||
|
||||
String jobId = jobFor("arn:aws:iam::000000000000:user/" + userName);
|
||||
iam("GetServiceLastAccessedDetailsWithEntities").formParam("JobId", jobId)
|
||||
.formParam("ServiceNamespace", "somefutureservice")
|
||||
.when().post("/").then().statusCode(200)
|
||||
.body(containsString("EntityDetailsList"));
|
||||
|
||||
// Nothing else is exempt: a namespace neither the job nor the catalog knows is refused.
|
||||
iam("GetServiceLastAccessedDetailsWithEntities").formParam("JobId", jobId)
|
||||
.formParam("ServiceNamespace", NOT_A_SERVICE)
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("InvalidInput"));
|
||||
}
|
||||
|
||||
/** The control: published namespaces are answered as before, on both operations. */
|
||||
@Test
|
||||
void publishedNamespacesAreUntouched() {
|
||||
String arn = createUser();
|
||||
iam("ListPoliciesGrantingServiceAccess").formParam("Arn", arn)
|
||||
.formParam("ServiceNamespaces.member.1", "s3")
|
||||
.formParam("ServiceNamespaces.member.2", "dynamodb")
|
||||
.when().post("/").then().statusCode(200);
|
||||
iam("GetServiceLastAccessedDetailsWithEntities").formParam("JobId", jobFor(arn))
|
||||
.formParam("ServiceNamespace", "s3")
|
||||
.when().post("/").then().statusCode(200);
|
||||
}
|
||||
}
|
||||
@@ -648,6 +648,12 @@ class ServiceLastAccessedIntegrationTest {
|
||||
.body(not(containsString(denyName)));
|
||||
}
|
||||
|
||||
/**
|
||||
* An absent list is how an empty one arrives on this protocol, and the vendored request shape
|
||||
* carries the member as the model declares it, required. So the required-member violation is
|
||||
* what answers this, where this package used to answer `InvalidInput` and a sentence of its
|
||||
* own that no recording carries.
|
||||
*/
|
||||
@Test
|
||||
void listPoliciesGrantingServiceAccessRequiresAtLeastOneServiceNamespace() {
|
||||
String arn = createUser("laa-nonamespace-" + suffix());
|
||||
@@ -655,7 +661,10 @@ class ServiceLastAccessedIntegrationTest {
|
||||
iam("ListPoliciesGrantingServiceAccess").formParam("Arn", arn)
|
||||
.when().post("/").then()
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("InvalidInput"));
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", equalTo("1 validation error detected: Value at"
|
||||
+ " 'serviceNamespaces' failed to satisfy constraint: Member must not be"
|
||||
+ " null"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,8 +95,7 @@ REQUIRED_BY_HAND = (
|
||||
#
|
||||
# A service-linked role's custom suffix answers `InvalidInput` rather than a validation error at
|
||||
# all, "Custom suffix is not allowed for <service>", which is a recorded refusal across roughly
|
||||
# eighty principals. `ServiceNamespaces` on `ListPoliciesGrantingServiceAccess` answers
|
||||
# `InvalidInput` too when the list arrives empty, and `Encoding` on `GetSSHPublicKey` is answered
|
||||
# eighty principals. `Encoding` on `GetSSHPublicKey` is answered
|
||||
# with the modelled `UnrecognizedPublicKeyEncoding` rather than as a constraint at all. The
|
||||
# simulators answer an empty `ActionNames`, `PolicyInputList` or `PolicySourceArn` with a sentence
|
||||
# of their own, "At least one ActionNames member is required.", which no capture here moves.
|
||||
@@ -116,9 +115,16 @@ REQUIRED_BY_HAND = (
|
||||
# because a 2025 recording carried neither the offending value nor the permitted set; AWS names the
|
||||
# set, and answers an omitted `Status` as a required member rather than as a value outside it, so
|
||||
# all four are read here with their `required` lists intact.
|
||||
#
|
||||
# `ServiceNamespaces` on `ListPoliciesGrantingServiceAccess` came off this list on 2026-11-18. It
|
||||
# was held back because the operation answered an empty list with a sentence of its own, where the
|
||||
# cost of holding the whole member back is that no member of the list is read at all: a value
|
||||
# breaking the published pattern was answered `InvalidInput` where AWS answers `ValidationError`.
|
||||
# The member is read here now, each value held to `serviceNamespaceType` and the list to its own
|
||||
# bounds. An absent list is how an empty one arrives on this protocol, so it reads as the required
|
||||
# member the model declares rather than as the sentence that was never AWS's.
|
||||
MEMBERS_BY_HAND = {
|
||||
"CreateServiceLinkedRole": ("CustomSuffix",),
|
||||
"ListPoliciesGrantingServiceAccess": ("ServiceNamespaces",),
|
||||
"GetSSHPublicKey": ("Encoding",),
|
||||
"SimulateCustomPolicy": ("ActionNames", "PolicyInputList"),
|
||||
"SimulatePrincipalPolicy": ("ActionNames", "PolicySourceArn"),
|
||||
|
||||
Reference in new issue
Block a user