mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
chore(deps): bump botocore to 1.44.9 (#9223)
Moves the pin from 1.43.118 to 1.44.9 and regenerates the data derived from it. 1.44.9 adds the me-west-1 and sa-west-1 regions, whose optIn and s3WebsiteDashForm flags come from aws-cdk's aws-entities.ts rather than botocore, so partitions.json is generated with that file; no existing region's flags change. AwsPartitionsTest, AwsRegionsTest and Ec2DescribeRegionsIntegrationTest count 36 commercial regions, 19 of them opt-in. The IAM tables aws-data-check-botocore checks are regenerated with it. The passed-role and tag-on-create tables no longer park any operation as missing from the pinned botocore, and the passed-role generator's four MEMBER_NOT_IN_BOTOCORE entries come out, as the reason asks, now that EventBridge's event sources and WAF v2's web ACLs have the member naming their role. The DynamoDB and IAM condition key tables are regenerated too. test_regen_iam_tag_on_create pinned network-firewall:CreateFirewallPolicyV2 as an operation botocore lacks; it now checks the tags its request names. with_parent_ids reads a made resource's parent id from "the one top-level ARN member named after that type", but request_members keys a member inside a structure or a list by its whole path, so the path == member test also took RAM's new permissionTemplateParameters[].permissionArn and filled the resource share CreateResourceShare makes with a permission ARN. It now takes a top-level member alone, which changes that one operation and no other. Four request members 1.44.9 models were accepted and dropped, as they were before it, when Floci read them as unknown: - ECR keeps each replication rule's deleteReplication and returns it from PutReplicationConfiguration and DescribeRegistry. - Lambda MicroVMs keep the kmsKeyIdentifier an image's create or update names on each version it builds, and the one RunMicrovm names on the MicroVM, and return them where the model has the member. - STS's GetWebIdentityToken refuses Scope unless SubjectMode is OriginIdentity with exactly one audience, and refuses OriginIdentity, which reads the calling session's trusted identity propagation context, as AWS does a session without one: no Floci session carries one. Both answer ValidationError with the reference's own sentence. LambdaMicrovmImageModeledConstraintsIntegrationTest's invalid cases follow the model: X86_64 is an architecture now, and an image takes up to 100 environment variables.
This commit is contained in:
1 parent
942cace935
commit
e394329a8b
57 files changed
+1900
-323
No files matched your search
@@ -77,8 +77,8 @@ class AwsPartitionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void theCommercialPartitionPublishesThirtyFourRegionsAndChinaTwo() {
|
||||
assertEquals(34, AwsPartitions.commercial().regions().size());
|
||||
void theCommercialPartitionPublishesThirtySixRegionsAndChinaTwo() {
|
||||
assertEquals(36, AwsPartitions.commercial().regions().size());
|
||||
assertEquals(List.of("cn-north-1", "cn-northwest-1"), AwsPartitions.byId("aws-cn").regionIds());
|
||||
assertEquals(List.of("us-gov-east-1", "us-gov-west-1"), AwsPartitions.byId("aws-us-gov").regionIds());
|
||||
}
|
||||
@@ -225,7 +225,7 @@ class AwsPartitionsTest {
|
||||
assertFalse(aws.region("ap-east-1").orElseThrow().s3WebsiteDashForm());
|
||||
assertTrue(AwsPartitions.byId("aws-us-gov").region("us-gov-west-1").orElseThrow().s3WebsiteDashForm());
|
||||
assertFalse(AwsPartitions.byId("aws-cn").region("cn-north-1").orElseThrow().optIn());
|
||||
assertEquals(17, aws.regions().stream().filter(AwsPartition.Region::optIn).count());
|
||||
assertEquals(19, aws.regions().stream().filter(AwsPartition.Region::optIn).count());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
||||
@@ -122,7 +122,7 @@ class AwsRegionsTest {
|
||||
|
||||
@Test
|
||||
void advertisedListsArePerPartition() {
|
||||
assertEquals(34, AwsRegions.advertised("aws").size());
|
||||
assertEquals(36, AwsRegions.advertised("aws").size());
|
||||
assertEquals(List.of("cn-north-1", "cn-northwest-1"), AwsRegions.advertised("aws-cn"));
|
||||
assertTrue(AwsRegions.KNOWN_IDS.contains("eusc-de-east-1"));
|
||||
assertTrue(AwsRegions.KNOWN_IDS.contains("us-isof-south-1"));
|
||||
|
||||
@@ -53,7 +53,7 @@ class Ec2DescribeRegionsIntegrationTest {
|
||||
void allRegionsIncludesOptInRegionsAsNotOptedIn() {
|
||||
Response response = describeRegions("us-east-1", "AllRegions", "true");
|
||||
List<String> names = response.xmlPath().getList("DescribeRegionsResponse.regionInfo.item.regionName");
|
||||
assertEquals(34, names.size(), names.toString());
|
||||
assertEquals(36, names.size(), names.toString());
|
||||
int hongKong = names.indexOf("ap-east-1");
|
||||
assertTrue(hongKong >= 0, names.toString());
|
||||
assertEquals("not-opted-in",
|
||||
|
||||
@@ -73,15 +73,19 @@ class EcrRegistrySettingsIntegrationTest {
|
||||
|
||||
String rules = "{\"replicationConfiguration\":{\"rules\":[{\"destinations\":[{\"region\":\"us-west-2\","
|
||||
+ "\"registryId\":\"000000000000\"}],\"repositoryFilters\":[{\"filter\":\"prod\","
|
||||
+ "\"filterType\":\"PREFIX_MATCH\"}]},{\"destinations\":[{\"region\":\"eu-west-1\","
|
||||
+ "\"filterType\":\"PREFIX_MATCH\"}],\"deleteReplication\":{\"enabled\":true}},"
|
||||
+ "{\"destinations\":[{\"region\":\"eu-west-1\","
|
||||
+ "\"registryId\":\"111111111111\"}]}]}}";
|
||||
call("PutReplicationConfiguration", rules, region).statusCode(200)
|
||||
.body("replicationConfiguration.rules", hasSize(2))
|
||||
.body("replicationConfiguration.rules[0].repositoryFilters[0].filter", equalTo("prod"));
|
||||
.body("replicationConfiguration.rules[0].repositoryFilters[0].filter", equalTo("prod"))
|
||||
.body("replicationConfiguration.rules[0].deleteReplication.enabled", equalTo(true));
|
||||
call("DescribeRegistry", "{}", region).statusCode(200)
|
||||
.body("replicationConfiguration.rules[0].destinations[0].region", equalTo("us-west-2"))
|
||||
.body("replicationConfiguration.rules[1].destinations[0].registryId", equalTo("111111111111"))
|
||||
.body("replicationConfiguration.rules[1].repositoryFilters", equalTo(null));
|
||||
.body("replicationConfiguration.rules[0].deleteReplication.enabled", equalTo(true))
|
||||
.body("replicationConfiguration.rules[1].repositoryFilters", equalTo(null))
|
||||
.body("replicationConfiguration.rules[1].deleteReplication", equalTo(null));
|
||||
|
||||
call("PutReplicationConfiguration", "{\"replicationConfiguration\":{\"rules\":[{\"destinations\":"
|
||||
+ "[{\"region\":\"us-west-2\",\"registryId\":\"123\"}]}]}}", region).statusCode(400)
|
||||
|
||||
@@ -2256,7 +2256,7 @@ class EcrServiceTest {
|
||||
private static RegistrySettings.ReplicationRule replicateTo(String region, String registryId, String prefix) {
|
||||
return new RegistrySettings.ReplicationRule(
|
||||
List.of(new RegistrySettings.ReplicationDestination(region, registryId)),
|
||||
prefix == null ? null : List.of(new RegistrySettings.RepositoryFilter(prefix, "PREFIX_MATCH")));
|
||||
prefix == null ? null : List.of(new RegistrySettings.RepositoryFilter(prefix, "PREFIX_MATCH")), null);
|
||||
}
|
||||
|
||||
private static RegistrySettings.ScanningRule scan(String frequency, String filter) {
|
||||
|
||||
@@ -10,9 +10,11 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.matchesPattern;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
@@ -216,6 +218,47 @@ class WebIdentityTokenIntegrationTest {
|
||||
enabledIssuer();
|
||||
}
|
||||
|
||||
/**
|
||||
* "You can specify Scope only when SubjectMode is OriginIdentity and you request exactly one
|
||||
* audience", so a scope beside the default subject mode, or beside two audiences, is refused.
|
||||
*/
|
||||
@Test
|
||||
void aScopeNeedsTheOriginIdentityModeAndOneAudience() {
|
||||
enabledIssuer();
|
||||
|
||||
token("RS256").formParam("Scope", "read write").when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"))
|
||||
.body(MESSAGE, equalTo("You can specify Scope only when SubjectMode is OriginIdentity and you"
|
||||
+ " request exactly one audience."));
|
||||
token("RS256").formParam("Scope", "read").formParam("SubjectMode", "OriginIdentity")
|
||||
.formParam("Audience.member.2", "other")
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"))
|
||||
.body(MESSAGE, containsString("You can specify Scope only when SubjectMode is OriginIdentity"));
|
||||
}
|
||||
|
||||
/**
|
||||
* OriginIdentity puts the aws:OriginIdentity/Subject key of the calling session's trusted
|
||||
* identity propagation context in the sub claim, and AWS refuses the request with a validation
|
||||
* error when the context lacks it, as every session here does. AWSIdentity, the default, is the
|
||||
* caller's ARN as before.
|
||||
*/
|
||||
@Test
|
||||
void theOriginIdentityModeNeedsAnIdentityContextTheSessionDoesNotCarry() {
|
||||
enabledIssuer();
|
||||
|
||||
for (RequestSpecification request : List.of(token("RS256").formParam("SubjectMode", "OriginIdentity"),
|
||||
token("RS256").formParam("SubjectMode", "OriginIdentity").formParam("Scope", "read"))) {
|
||||
request.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"))
|
||||
.body(MESSAGE, equalTo("To use OriginIdentity, the trusted identity propagation context of the"
|
||||
+ " calling session must contain the aws:OriginIdentity/Subject key and either the"
|
||||
+ " aws:OriginIdentity/Issuer key or the aws:OriginIdentity/FederatedProviderArn key."));
|
||||
}
|
||||
token("RS256").formParam("SubjectMode", "AWSIdentity").when().post("/").then().statusCode(200)
|
||||
.body(TOKEN, not(emptyOrNullString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The validation layer runs ahead of the operation, so a request that breaks a declared
|
||||
* constraint is the 400 even where the feature the operation reads is off.
|
||||
|
||||
+2
-2
@@ -50,8 +50,8 @@ class LambdaMicrovmImageModeledConstraintsIntegrationTest {
|
||||
return Stream.of(
|
||||
"\"additionalOsCapabilities\":[\"SYS_ADMIN\"]",
|
||||
"\"egressNetworkConnectors\":[\"one\",\"two\"]",
|
||||
"\"cpuConfigurations\":[{\"architecture\":\"X86_64\"}]",
|
||||
environment(51, "KEY", "value"),
|
||||
"\"cpuConfigurations\":[{\"architecture\":\"RISCV_64\"}]",
|
||||
environment(101, "KEY", "value"),
|
||||
environment(1, "", "value"),
|
||||
environment(1, "k".repeat(257), "value"),
|
||||
environment(1, "bad key", "value"),
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package io.floci.aws.services.lambdamicrovms;
|
||||
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.response.Response;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
/**
|
||||
* The customer managed KMS key a request names: an image version keeps the key it was built with, and a MicroVM
|
||||
* the key it was run with. Without one, AWS uses a key of its own, and nothing names a key.
|
||||
*/
|
||||
@QuarkusTest
|
||||
class LambdaMicrovmKmsKeyIntegrationTest {
|
||||
|
||||
private static final String ROOT = "/2025-09-09";
|
||||
private static final String IMAGES = ROOT + "/microvm-images";
|
||||
private static final String FIRST_KEY = "arn:aws:kms:us-east-1:000000000000:key/1234abcd-12ab-34cd-56ef-1234567890ab";
|
||||
private static final String SECOND_KEY = "arn:aws:kms:us-east-1:000000000000:alias/microvm-images";
|
||||
private static final String RUN_KEY = "arn:aws:kms:us-east-1:000000000000:key/0987dcba-09fe-87dc-65ba-ab0987654321";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
private static Map<String, Object> buildInputs(String key) {
|
||||
Map<String, Object> body = new LinkedHashMap<>();
|
||||
body.put("baseImageArn", "arn:aws:lambda:us-east-1:aws:microvm-image:al2023-1");
|
||||
body.put("buildRoleArn", "arn:aws:iam::000000000000:role/microvm-build");
|
||||
body.put("codeArtifact", Map.of("uri", "s3://bucket/code.zip"));
|
||||
if (key != null) {
|
||||
body.put("kmsKeyIdentifier", key);
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
private String createImage(String key) {
|
||||
String name = "kms-key-" + UUID.randomUUID();
|
||||
Map<String, Object> body = buildInputs(key);
|
||||
body.put("name", name);
|
||||
given().contentType("application/json").body(body)
|
||||
.when().post(IMAGES).then().statusCode(201)
|
||||
.body("kmsKeyIdentifier", key == null ? nullValue() : equalTo(key));
|
||||
cleanup.register(() -> given().when().delete(IMAGES + "/" + name).then().statusCode(200));
|
||||
return name;
|
||||
}
|
||||
|
||||
private void versionHasKey(String image, String version, String key) {
|
||||
given().when().get(IMAGES + "/" + image + "/versions/" + version).then().statusCode(200)
|
||||
.body("kmsKeyIdentifier", key == null ? nullValue() : equalTo(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
void eachImageVersionKeepsTheKeyItWasBuiltWith() {
|
||||
String image = createImage(FIRST_KEY);
|
||||
versionHasKey(image, "1.0", FIRST_KEY);
|
||||
|
||||
given().contentType("application/json").body(buildInputs(SECOND_KEY))
|
||||
.when().put(IMAGES + "/" + image).then().statusCode(200)
|
||||
.body("kmsKeyIdentifier", equalTo(SECOND_KEY));
|
||||
versionHasKey(image, "2.0", SECOND_KEY);
|
||||
versionHasKey(image, "1.0", FIRST_KEY);
|
||||
|
||||
// The update is a full replace, so leaving the key out builds the next version with an AWS owned key.
|
||||
given().contentType("application/json").body(buildInputs(null))
|
||||
.when().put(IMAGES + "/" + image).then().statusCode(200)
|
||||
.body("kmsKeyIdentifier", nullValue());
|
||||
versionHasKey(image, "3.0", null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void anImageWithoutAKeyNamesNone() {
|
||||
versionHasKey(createImage(null), "1.0", null);
|
||||
}
|
||||
|
||||
private Response run(String image, String fields) {
|
||||
Response response = given().contentType("application/json")
|
||||
.body("{\"imageIdentifier\":\"" + image + "\"" + fields + "}")
|
||||
.when().post(ROOT + "/microvms").then().statusCode(200).extract().response();
|
||||
String id = response.path("microvmId");
|
||||
cleanup.register(() -> given().when().delete(ROOT + "/microvms/" + id).then().statusCode(200));
|
||||
return response;
|
||||
}
|
||||
|
||||
@Test
|
||||
void aMicrovmKeepsTheKeyItWasRunWith() {
|
||||
String image = createImage(null);
|
||||
Response keyed = run(image, ",\"kmsKeyIdentifier\":\"" + RUN_KEY + "\"");
|
||||
keyed.then().body("kmsKeyIdentifier", equalTo(RUN_KEY));
|
||||
given().when().get(ROOT + "/microvms/" + keyed.path("microvmId")).then().statusCode(200)
|
||||
.body("kmsKeyIdentifier", equalTo(RUN_KEY));
|
||||
|
||||
Response unkeyed = run(image, "");
|
||||
unkeyed.then().body("kmsKeyIdentifier", nullValue());
|
||||
given().when().get(ROOT + "/microvms/" + unkeyed.path("microvmId")).then().statusCode(200)
|
||||
.body("kmsKeyIdentifier", nullValue());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -231,7 +231,7 @@ class LambdaMicrovmsServicePersistenceTest {
|
||||
"arn:aws:iam::000000000000:role/build", "s3://bucket/next.zip", null);
|
||||
LambdaMicrovmsService.RunSettings settings = new LambdaMicrovmsService.RunSettings(
|
||||
"1.0", "arn:aws:iam::000000000000:role/runtime", List.of("ingress"), List.of("egress"),
|
||||
3600, false, 60, 0);
|
||||
3600, false, 60, 0, "arn:aws:kms:us-east-1:000000000000:key/run-key");
|
||||
LambdaMicrovmsService.Microvm created = first.runMicrovm(REGION, ACCOUNT_ID, "run-image", settings);
|
||||
assertEquals("PENDING", created.state);
|
||||
assertEquals(settings, created.runSettings);
|
||||
|
||||
Reference in new issue
Block a user