mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(partition): read strict-mode service availability from endpoint rulesets too (#5231)
* fix(partition): read strict-mode service availability from endpoint rulesets too Strict partition mode refused services AWS serves. The per-partition service list came from botocore's endpoints.json alone, which leaves out IAM, Route 53, Budgets and Cost Explorer in aws-eusc and IAM and Cost Explorer in aws-iso-e, although each service's endpoint ruleset has an explicit branch for the partition (iam.eusc-de-east-1.amazonaws.eu). The generator now adds those partitions, for services endpoints.json lists somewhere, and records them under servicesFromRulesets. The execute-api signing name was mapped to Connect Participant only, so IAM-authorized API Gateway invokes were refused in China, EUSC and the ISO partitions. A signing name is now left out of the alias map when a service whose own endpoint prefix is that name is listed nowhere, so strict mode no longer judges execute-api. The docs and config comments no longer say IAM is absent from aws-eusc. * test(partition): assert API Gateway answers the strict-mode execute-api probe The execute-api strict-mode test accepted any response but a 200 that lacked the strict-mode error, so a 500 or an unrelated rejection would also pass. It now requires API Gateway's own answer for a missing API: a 404 NotFoundException with "Invalid API id specified".
This commit is contained in:
1 parent
e1cd6fe6d4
commit
8a1d1ddcd3
12 files changed
+284
-31
No files matched your search
@@ -77,7 +77,7 @@ public interface EmulatorConfig {
|
||||
|
||||
/**
|
||||
* Refuse requests signed for a service AWS does not publish in the request's partition
|
||||
* (CloudFront in GovCloud, IAM in {@code aws-eusc}). On AWS such a request never reaches
|
||||
* (CloudFront in GovCloud, Lightsail in China). On AWS such a request never reaches
|
||||
* an API because its endpoint does not resolve; Floci serves every enabled service in
|
||||
* every partition unless this is set.
|
||||
*/
|
||||
|
||||
@@ -169,7 +169,7 @@ public class AccountContextFilter implements ContainerRequestFilter {
|
||||
|
||||
/**
|
||||
* Strict partition mode. AWS publishes no endpoint for a service outside the partitions it
|
||||
* exists in (CloudFront in GovCloud, IAM in {@code aws-eusc}); a client there never reaches
|
||||
* exists in (CloudFront in GovCloud, Lightsail in China); a client there never reaches
|
||||
* an API because the host does not resolve, which the SDKs surface as an
|
||||
* {@code UnknownHostException}. Floci cannot fail DNS, so it answers the request with the
|
||||
* same 404 shape the unknown-service-scope guard uses. Only a service the published data
|
||||
|
||||
@@ -24,7 +24,8 @@ import java.util.regex.Pattern;
|
||||
* @param globalPseudoRegion the {@code <partition>-global} label the SDKs accept as a region,
|
||||
* or {@code null} where the partition has none ({@code aws-eusc})
|
||||
* @param regions the published regions, in botocore order
|
||||
* @param services every service key {@code endpoints.json} lists for the partition
|
||||
* @param services every service key {@code endpoints.json} lists for the partition,
|
||||
* plus those whose endpoint ruleset names it explicitly
|
||||
* @param globalServices services with a partition-wide endpoint, by service key
|
||||
* @param supportsDualStack whether the partition publishes dual-stack endpoints
|
||||
* @param supportsFips whether the partition publishes FIPS endpoints
|
||||
@@ -86,7 +87,7 @@ public record AwsPartition(
|
||||
return region != null && s3DualStackRegions.contains(region.trim().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/** True when {@code endpoints.json} lists {@code service} for this partition. */
|
||||
/** True when the published data lists {@code service} for this partition (see {@link #services()}). */
|
||||
public boolean offers(String service) {
|
||||
return service != null && services.contains(service);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user