From 13640785a9ceda57a9aa4262d49afa8d8d39e730 Mon Sep 17 00:00:00 2001 From: dgl-ai Date: Mon, 9 Nov 2026 14:08:00 +0100 Subject: [PATCH] feat(signer): serve the Signer control plane for profiles, permissions and job records (#7680) Signer was the last control plane Floci's CloudFormation provisioner stubbed: SignerCfnProvisioner recorded only the identifiers a template handed it, with a comment saying Floci has no Signer API. This serves the API, so an SDK, the CLI or a stack sees the profile it actually created. Cancellation keeps the profile, as AWS does: it stays readable through GetSigningProfile with the same ARN and version and the status Canceled, it stops accepting jobs, and ListSigningProfiles hides it unless includeCanceled is set or statuses names Canceled. A PutSigningProfile on the same name brings it back as a new active version. A signing job fails by default, and says why. Nothing on this machine signs the artifact, so a succeeded job would advertise a signedObject key that does not exist and every download of it would fail; the job instead completes as Failed with a statusReason naming the object that was not written, and RevokeSignature refuses it because there is no signature to revoke. Metadata-only callers can set floci.services.signer.mock-signing-jobs=true, which records jobs as succeeded and is documented as a mock rather than as AWS behaviour. Signer routes collide with S3's path-style ones, so a request signed for the signer scope is rewritten onto an internal prefix before matching. That rewrite used to happen before IAM resolved the action from the path, which left every Signer call unchecked; IamActionRegistry now strips the internal prefix the signing service owns, and SignerIamEnforcementIntegrationTest proves a key with no policy is refused while one with signer:* is allowed. Co-authored-by: David Guardiola --- README.md | 3 +- compatibility-tests/sdk-test-java/pom.xml | 5 + .../java/com/floci/test/TestFixtures.java | 9 + .../test/java/com/floci/test/SignerTest.java | 281 ++++++ docs/services/index.md | 1 + docs/services/signer.md | 142 +++ mkdocs.yml | 1 + .../io/floci/aws/config/EmulatorConfig.java | 14 + .../core/common/ResolvedServiceCatalog.java | 5 + .../provisioners/SignerCfnProvisioner.java | 216 ++++- .../aws/services/signer/SignerController.java | 364 +++++++ .../aws/services/signer/SignerPlatforms.java | 101 ++ .../services/signer/SignerRouteFilter.java | 43 + .../aws/services/signer/SignerService.java | 905 ++++++++++++++++++ .../aws/services/signer/model/SigningJob.java | 250 +++++ .../services/signer/model/SigningProfile.java | 244 +++++ src/main/resources/application.yml | 2 + .../resources/aws/iam-authorized-actions.json | 21 +- .../resources/aws/iam-request-resources.json | 27 +- src/main/resources/aws/iam-tag-on-create.json | 5 +- src/main/resources/aws/rest-routes.json | 26 + ...itionCrossServiceSmokeIntegrationTest.java | 19 +- .../cloudformation/CfnProvisionerFixture.java | 11 +- ...ationLambdaCodeSigningIntegrationTest.java | 25 + .../SignerCfnProvisionerTest.java | 189 +++- .../SignerIamEnforcementIntegrationTest.java | 144 +++ .../signer/SignerIntegrationTest.java | 325 +++++++ .../services/signer/SignerServiceTest.java | 421 ++++++++ src/test/resources/application.yml | 2 + .../cloudformation/writable-property-gaps.tsv | 1 - tools/aws/regen_iam_request_resources.py | 2 +- tools/aws/regen_iam_tag_on_create.py | 2 +- tools/aws/regen_rest_routes.py | 23 +- tools/docs/services.yaml | 13 + 34 files changed, 3804 insertions(+), 38 deletions(-) create mode 100644 compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java create mode 100644 docs/services/signer.md create mode 100644 src/main/java/io/floci/aws/services/signer/SignerController.java create mode 100644 src/main/java/io/floci/aws/services/signer/SignerPlatforms.java create mode 100644 src/main/java/io/floci/aws/services/signer/SignerRouteFilter.java create mode 100644 src/main/java/io/floci/aws/services/signer/SignerService.java create mode 100644 src/main/java/io/floci/aws/services/signer/model/SigningJob.java create mode 100644 src/main/java/io/floci/aws/services/signer/model/SigningProfile.java create mode 100644 src/test/java/io/floci/aws/services/signer/SignerIamEnforcementIntegrationTest.java create mode 100644 src/test/java/io/floci/aws/services/signer/SignerIntegrationTest.java create mode 100644 src/test/java/io/floci/aws/services/signer/SignerServiceTest.java diff --git a/README.md b/README.md index 05834a89c8..24b9056f73 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,7 @@ Floci supports local emulation for application services, data services, eventing | Data, analytics, and AI | Athena, Glue, Lake Formation, EMR, EMR Serverless, Redshift, Redshift Data API, Redshift Serverless, Firehose, Managed Service for Apache Flink, OpenSearch, S3 Tables, S3 Vectors, Textract, Transcribe, Comprehend, Rekognition, Translate, Bedrock, Bedrock Runtime, Bedrock AgentCore, Bedrock AgentCore Control, SageMaker | | Databases and caching | Aurora DSQL, RDS, RDS Data API, Neptune, DocumentDB, DMS, MemoryDB, ElastiCache, Timestream for InfluxDB | | Messaging and transfer | SES, Kinesis, MSK, Amazon MQ, Transfer Family, DataSync, IoT Core, Amazon Connect, Amazon AppIntegrations | -| Security and governance | AWS Network Firewall, AWS RAM, Service Quotas, WAF v2, GuardDuty, Amazon Inspector, CloudTrail, CloudFront, Resource Groups Tagging API, Resource Explorer 2, CloudHSM v2, Organizations, AWS Account Management, IAM Access Analyzer, IAM Identity Center (SSO Admin, OIDC, Access Portal, SCIM), Identity Store, Amazon Macie, Amazon Detective, Security Hub, Amazon Verified Permissions, Control Catalog, Control Tower, Service Catalog, AWS Marketplace | +| Security and governance | AWS Signer, AWS Network Firewall, AWS RAM, Service Quotas, WAF v2, GuardDuty, Amazon Inspector, CloudTrail, CloudFront, Resource Groups Tagging API, Resource Explorer 2, CloudHSM v2, Organizations, AWS Account Management, IAM Access Analyzer, IAM Identity Center (SSO Admin, OIDC, Access Portal, SCIM), Identity Store, Amazon Macie, Amazon Detective, Security Hub, Amazon Verified Permissions, Control Catalog, Control Tower, Service Catalog, AWS Marketplace | | Cost and billing | AWS Budgets, Pricing, Cost Explorer, Cost and Usage Reports, BCM Pricing Calculator, BCM Data Exports | | Resilience, backup, and config | AWS FIS, AWS Backup, Amazon Data Lifecycle Manager, AWS Config, AppConfig, AppConfigData, CloudFormation, Cloud Control API | @@ -384,6 +384,7 @@ For operation-level compatibility, see the [Services Overview](https://floci.io/ | Elastic Beanstalk | In-process | Applications, application versions, environments, configuration templates, platform and solution stack metadata | | AWS Backup | In-process | Vaults, backup plans, selections, simulated job lifecycle, recovery points | | Amazon Data Lifecycle Manager | In-process | Lifecycle policy and tag management; schedules are stored but do not create snapshots or AMIs | +| AWS Signer | In-process | Signing profiles with versioning, cross-account permissions, the three AWS signing platforms, and signing job records; a job completes as `Succeeded` without producing a signature or writing to S3 | | AWS FIS | In-process | All 26 management APIs for templates, experiments, target accounts, action and target discovery, safety lever, tagging, and pagination; experiment execution is a safe control-plane simulation and does not inject faults into other services | | AWS Config | In-process | Config rules, evaluation-driven compliance (PutEvaluations, compliance details and summaries), configuration recorders, delivery channels, retention configuration, conformance packs, tagging | | Organizations | In-process | Organizations, roots, nested OUs, member accounts, all policy types with `FullAWSAccess` and effective-policy inheritance, trusted service access, delegated administrators, resource policy, and the full invitation/handshake flow; created accounts are usable Floci accounts and member accounts can read the organization they belong to | diff --git a/compatibility-tests/sdk-test-java/pom.xml b/compatibility-tests/sdk-test-java/pom.xml index 199807826a..875c538521 100644 --- a/compatibility-tests/sdk-test-java/pom.xml +++ b/compatibility-tests/sdk-test-java/pom.xml @@ -655,6 +655,11 @@ software.amazon.awssdk dlm + + + software.amazon.awssdk + signer + software.amazon.awssdk diff --git a/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java b/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java index b86838d539..e011a46530 100644 --- a/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java +++ b/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java @@ -161,6 +161,7 @@ import software.amazon.awssdk.services.sesv2.model.GetEmailIdentityRequest; import software.amazon.awssdk.services.sfn.SfnClient; import software.amazon.awssdk.services.sfn.model.DescribeExecutionResponse; import software.amazon.awssdk.services.sfn.model.ExecutionStatus; +import software.amazon.awssdk.services.signer.SignerClient; import software.amazon.awssdk.services.signin.SigninClient; import software.amazon.awssdk.services.sns.SnsClient; import software.amazon.awssdk.services.sqs.SqsClient; @@ -1628,6 +1629,14 @@ public final class TestFixtures { .build(); } + public static SignerClient signerClient() { + return SignerClient.builder() + .endpointOverride(ENDPOINT) + .region(REGION) + .credentialsProvider(CREDENTIALS) + .build(); + } + public static PipesClient pipesClient() { return PipesClient.builder() .endpointOverride(ENDPOINT) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java new file mode 100644 index 0000000000..2019456f1d --- /dev/null +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java @@ -0,0 +1,281 @@ +package com.floci.test; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import software.amazon.awssdk.services.signer.SignerClient; +import software.amazon.awssdk.services.signer.model.DescribeSigningJobResponse; +import software.amazon.awssdk.services.signer.model.Destination; +import software.amazon.awssdk.services.signer.model.GetSigningPlatformResponse; +import software.amazon.awssdk.services.signer.model.GetSigningProfileResponse; +import software.amazon.awssdk.services.signer.model.ListSigningPlatformsResponse; +import software.amazon.awssdk.services.signer.model.ListSigningProfilesResponse; +import software.amazon.awssdk.services.signer.model.PutSigningProfileResponse; +import software.amazon.awssdk.services.signer.model.ResourceNotFoundException; +import software.amazon.awssdk.services.signer.model.S3Destination; +import software.amazon.awssdk.services.signer.model.S3Source; +import software.amazon.awssdk.services.signer.model.SignatureValidityPeriod; +import software.amazon.awssdk.services.signer.model.SigningJob; +import software.amazon.awssdk.services.signer.model.SigningPlatform; +import software.amazon.awssdk.services.signer.model.SigningProfile; +import software.amazon.awssdk.services.signer.model.SigningProfileStatus; +import software.amazon.awssdk.services.signer.model.SigningStatus; +import software.amazon.awssdk.services.signer.model.Source; +import software.amazon.awssdk.services.signer.model.ValidationException; +import software.amazon.awssdk.services.signer.model.ValidityType; + +import java.time.Instant; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +@DisplayName("AWS Signer") +class SignerTest { + + private static final String PROFILE = "SdkTestProfile"; + private static final String OTHER_PROFILE = "SdkTestNotation"; + private static final String PLATFORM_LAMBDA = "AWSLambda-SHA384-ECDSA"; + private static final String PLATFORM_NOTATION = "Notation-OCI-SHA384-ECDSA"; + + private static SignerClient signer; + private static String jobId; + + @BeforeAll + static void setup() { + signer = TestFixtures.signerClient(); + } + + @AfterAll + static void cleanup() { + if (signer == null) { + return; + } + for (String profileName : new String[] {PROFILE, OTHER_PROFILE}) { + try { + signer.cancelSigningProfile(r -> r.profileName(profileName)); + } catch (RuntimeException e) { + System.out.println("Signer cleanup skipped " + profileName + ": " + e); + } + } + signer.close(); + } + + @Test + @DisplayName("PutSigningProfile creates a profile that GetSigningProfile reports") + void putAndGetSigningProfile() { + PutSigningProfileResponse created = signer.putSigningProfile(r -> r + .profileName(PROFILE) + .platformId(PLATFORM_LAMBDA) + .signatureValidityPeriod(SignatureValidityPeriod.builder() + .type(ValidityType.DAYS) + .value(135) + .build()) + .tags(Map.of("env", "sdk"))); + + assertThat(created.arn()).startsWith("arn:aws:signer:") + .endsWith(":/signing-profiles/" + PROFILE); + assertThat(created.profileVersion()).hasSize(10); + assertThat(created.profileVersionArn()).isEqualTo( + created.arn() + "/" + created.profileVersion()); + + GetSigningProfileResponse profile = signer.getSigningProfile(r -> r.profileName(PROFILE)); + + assertThat(profile.profileName()).isEqualTo(PROFILE); + assertThat(profile.platformId()).isEqualTo(PLATFORM_LAMBDA); + assertThat(profile.platformDisplayName()).isEqualTo("AWS Lambda"); + assertThat(profile.status()).isEqualTo(SigningProfileStatus.ACTIVE); + assertThat(profile.signatureValidityPeriod().type()).isEqualTo(ValidityType.DAYS); + assertThat(profile.signatureValidityPeriod().value()).isEqualTo(135); + assertThat(profile.tags()).containsEntry("env", "sdk"); + } + + @Test + @DisplayName("PutSigningProfile on an existing name mints a version and keeps omitted tags") + void putMintsANewVersion() { + String firstVersion = signer.putSigningProfile(r -> r + .profileName(PROFILE) + .platformId(PLATFORM_LAMBDA) + .tags(Map.of("env", "sdk"))) + .profileVersion(); + + String secondVersion = signer.putSigningProfile(r -> r + .profileName(PROFILE) + .platformId(PLATFORM_LAMBDA)) + .profileVersion(); + + assertThat(secondVersion).isNotEqualTo(firstVersion); + assertThat(signer.getSigningProfile(r -> r.profileName(PROFILE)).tags()) + .containsEntry("env", "sdk"); + } + + @Test + @DisplayName("ListSigningProfiles filters by platform and pages with a token") + void listSigningProfiles() { + signer.putSigningProfile(r -> r.profileName(PROFILE).platformId(PLATFORM_LAMBDA)); + signer.putSigningProfile(r -> r.profileName(OTHER_PROFILE).platformId(PLATFORM_NOTATION)); + + List lambdaProfiles = signer.listSigningProfiles( + r -> r.platformId(PLATFORM_LAMBDA)).profiles(); + assertThat(lambdaProfiles).extracting(SigningProfile::profileName).contains(PROFILE); + assertThat(lambdaProfiles).allMatch(profile -> PLATFORM_LAMBDA.equals(profile.platformId())); + + ListSigningProfilesResponse firstPage = signer.listSigningProfiles(r -> r.maxResults(1)); + assertThat(firstPage.profiles()).hasSize(1); + assertThat(firstPage.nextToken()).isNotNull(); + + ListSigningProfilesResponse secondPage = signer.listSigningProfiles( + r -> r.maxResults(1).nextToken(firstPage.nextToken())); + assertThat(secondPage.profiles()).hasSize(1); + assertThat(secondPage.profiles().get(0).profileName()) + .isNotEqualTo(firstPage.profiles().get(0).profileName()); + } + + @Test + @DisplayName("Profile permissions move the revision id the removal requires") + void profilePermissions() { + signer.putSigningProfile(r -> r.profileName(PROFILE).platformId(PLATFORM_LAMBDA)); + + String revisionId = signer.addProfilePermission(r -> r + .profileName(PROFILE) + .action("signer:SignPayload") + .principal("123456789012") + .statementId("cross-account")) + .revisionId(); + + assertThat(signer.listProfilePermissions(r -> r.profileName(PROFILE)).permissions()) + .singleElement() + .satisfies(permission -> { + assertThat(permission.action()).isEqualTo("signer:SignPayload"); + assertThat(permission.principal()).isEqualTo("123456789012"); + assertThat(permission.statementId()).isEqualTo("cross-account"); + }); + + String nextRevisionId = signer.removeProfilePermission(r -> r + .profileName(PROFILE) + .statementId("cross-account") + .revisionId(revisionId)).revisionId(); + + assertThat(nextRevisionId).isNotEqualTo(revisionId); + assertThat(signer.listProfilePermissions(r -> r.profileName(PROFILE)).permissions()).isEmpty(); + } + + @Test + @DisplayName("A signing job is recorded, described, and can be revoked") + void signingJobLifecycle() { + signer.putSigningProfile(r -> r.profileName(PROFILE).platformId(PLATFORM_LAMBDA)); + + jobId = signer.startSigningJob(r -> r + .profileName(PROFILE) + .source(Source.builder() + .s3(S3Source.builder() + .bucketName("artifacts") + .key("app.zip") + .version("1") + .build()) + .build()) + .destination(Destination.builder() + .s3(S3Destination.builder() + .bucketName("signed") + .prefix("out/") + .build()) + .build()) + .clientRequestToken("sdk-token-1")) + .jobId(); + + DescribeSigningJobResponse job = signer.describeSigningJob(r -> r.jobId(jobId)); + + assertThat(job.status()).isEqualTo(SigningStatus.FAILED); + assertThat(job.statusReason()).contains("does not sign artifacts"); + assertThat(job.profileName()).isEqualTo(PROFILE); + assertThat(job.platformId()).isEqualTo(PLATFORM_LAMBDA); + assertThat(job.source().s3().bucketName()).isEqualTo("artifacts"); + assertThat(job.source().s3().key()).isEqualTo("app.zip"); + assertThat(job.signedObject()).isNull(); + assertThat(job.createdAt()).isNotNull(); + assertThat(job.signatureExpiresAt()).isNull(); + assertThat(job.revocationRecord()).isNull(); + + assertThat(signer.listSigningJobs(r -> r.status(SigningStatus.FAILED)).jobs()) + .extracting(SigningJob::jobId) + .contains(jobId); + + // A job with no signature has nothing to revoke. + assertThatThrownBy(() -> signer.revokeSignature( + r -> r.jobId(jobId).reason("artifact withdrawn"))) + .isInstanceOf(ValidationException.class); + } + + @Test + @DisplayName("Revoking a profile stops it accepting new jobs") + void revokeSigningProfile() { + String profileVersion = signer.putSigningProfile(r -> r + .profileName(PROFILE) + .platformId(PLATFORM_LAMBDA)) + .profileVersion(); + + signer.revokeSigningProfile(r -> r + .profileName(PROFILE) + .profileVersion(profileVersion) + .reason("key compromised") + .effectiveTime(Instant.parse("2026-01-01T00:00:00Z"))); + + GetSigningProfileResponse revoked = signer.getSigningProfile(r -> r.profileName(PROFILE)); + assertThat(revoked.status()).isEqualTo(SigningProfileStatus.REVOKED); + assertThat(revoked.revocationRecord().revocationEffectiveFrom()).isNotNull(); + + assertThatThrownBy(() -> signer.startSigningJob(r -> r + .profileName(PROFILE) + .source(Source.builder().s3(S3Source.builder() + .bucketName("artifacts").key("app.zip").version("1").build()).build()) + .destination(Destination.builder().s3(S3Destination.builder() + .bucketName("signed").build()).build()) + .clientRequestToken("sdk-token-revoked"))) + .isInstanceOf(ValidationException.class); + } + + @Test + @DisplayName("ListSigningPlatforms and GetSigningPlatform describe the AWS platforms") + void signingPlatforms() { + ListSigningPlatformsResponse platforms = signer.listSigningPlatforms(); + assertThat(platforms.platforms()) + .extracting(SigningPlatform::platformId) + .contains(PLATFORM_LAMBDA, PLATFORM_NOTATION); + + GetSigningPlatformResponse platform = signer.getSigningPlatform(r -> r.platformId(PLATFORM_LAMBDA)); + assertThat(platform.displayName()).isEqualTo("AWS Lambda"); + assertThat(platform.categoryAsString()).isEqualTo("AWSLambda"); + assertThat(platform.signingConfiguration().hashAlgorithmOptions().allowedValuesAsStrings()) + .contains("SHA-384"); + assertThat(platform.signingImageFormat().defaultFormatAsString()).isEqualTo("JSON"); + assertThat(platform.maxSizeInMB()).isEqualTo(50); + } + + @Test + @DisplayName("The profile ARN carries tags for the shared tagging actions") + void tagsThroughTheResourceArn() { + String arn = signer.putSigningProfile(r -> r + .profileName(PROFILE) + .platformId(PLATFORM_LAMBDA)) + .arn(); + + signer.tagResource(r -> r.resourceArn(arn).tags(Map.of("team", "platform"))); + + assertThat(signer.listTagsForResource(r -> r.resourceArn(arn)).tags()) + .containsEntry("team", "platform"); + + signer.untagResource(r -> r.resourceArn(arn).tagKeys("team")); + + assertThat(signer.listTagsForResource(r -> r.resourceArn(arn)).tags()) + .doesNotContainKey("team"); + } + + @Test + @DisplayName("A missing profile answers ResourceNotFoundException") + void missingProfile() { + assertThatThrownBy(() -> signer.getSigningProfile(r -> r.profileName("SdkTestMissing"))) + .isInstanceOf(ResourceNotFoundException.class); + } +} diff --git a/docs/services/index.md b/docs/services/index.md index d630c4be8d..6f2d977d12 100644 --- a/docs/services/index.md +++ b/docs/services/index.md @@ -117,6 +117,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac | [AWS Batch](batch.md) | `/v1/...` | REST JSON | 10 | | [CodeDeploy](codedeploy.md) | `POST /` + `X-Amz-Target: CodeDeploy_20141006.*` | JSON 1.1 | 35 | | [CodePipeline](codepipeline.md) | `POST /` + `X-Amz-Target: CodePipeline_20150709.*` | JSON 1.1 | 44 | +| [AWS Signer](signer.md) | `/signing-profiles`, `/signing-jobs`, `/signing-platforms`, `/revocations` | REST JSON | 18 | | [AWS Network Firewall](network-firewall.md) | `POST /` + `X-Amz-Target: NetworkFirewall_20201112.*` | JSON 1.0 | 27 | | [AWS Service Catalog](service-catalog.md) | `POST /` + `X-Amz-Target: AWS242ServiceCatalogService.*` | JSON 1.1 | 89 | | [Service Quotas](servicequotas.md) | `POST /` + `X-Amz-Target: ServiceQuotasV20190624.*` | JSON 1.1 | 8 | diff --git a/docs/services/signer.md b/docs/services/signer.md new file mode 100644 index 0000000000..723bcedd28 --- /dev/null +++ b/docs/services/signer.md @@ -0,0 +1,142 @@ +# AWS Signer + +**Protocol:** REST JSON +**Endpoint:** `http://localhost:4566/signing-profiles` (SigV4 service `signer`) + +Floci emulates the AWS Signer control plane: signing profiles, the permissions granted on them, the +platforms AWS publishes, and the signing jobs started against a profile. Profiles, permissions, and +jobs are persisted and isolated by account and region, and the `/tags/{resourceArn}` actions are +served by the shared tag routes. + +## Supported Actions + + +| Action | Description | +| --- | --- | +| `PutSigningProfile` | Creates a signing profile, or mints a new version of an existing one. | +| `GetSigningProfile` | Returns one signing profile, its platform, overrides, tags and revocation record. | +| `ListSigningProfiles` | Lists signing profiles with the platform and status filters and paged results. | +| `CancelSigningProfile` | Deletes a signing profile. | +| `RevokeSigningProfile` | Revokes a profile version, recording the reason and the effective time. | +| `AddProfilePermission` | Grants a cross-account permission on a profile and moves its revision. | +| `ListProfilePermissions` | Lists the permissions granted on a profile. | +| `RemoveProfilePermission` | Removes a permission, requiring the profile's current revision id. | +| `StartSigningJob` | Records a signing job against a profile and completes it. | +| `ListSigningJobs` | Lists signing jobs with the status, platform and revocation filters. | +| `DescribeSigningJob` | Returns one signing job with its S3 source, destination and revocation record. | +| `RevokeSignature` | Marks a signing job's signature revoked, recording the reason. | +| `GetRevocationStatus` | Reports the revocation status of the signatures named in the request. | +| `ListSigningPlatforms` | Lists the signing platforms Floci serves, with their algorithms and image formats. | +| `GetSigningPlatform` | Returns one signing platform. | +| `ListTagsForResource` | Lists the tags attached to a signing profile. | +| `TagResource` | Adds or replaces tags on a signing profile. | +| `UntagResource` | Removes selected tags from a signing profile. | + + +`PutSigningProfile` behaves as an upsert: the first call creates the profile and every later call +mints a new ten-character `profileVersion`, leaving the previous version superseded, which is what +AWS does with one exception. AWS returns the members the request omits to their defaults on the new +version; Floci keeps the values the profile already had, so a client that re-puts a profile with only +a `platformId` does not lose its certificate, overrides or validity period. Tags live on the profile +rather than on a version, and a put that sends no `tags` member leaves them untouched. + +The signing platforms are `AWSLambda-SHA384-ECDSA`, `Notation-OCI-SHA384-ECDSA` and +`AWSIoTDeviceManagement-SHA256-ECDSA`. A profile naming any other `platformId` is refused with +`ValidationException`, and so is an override or signing parameter the platform does not accept: a +`SHA-256` hash on the Lambda platform, for instance. + +`GetRevocationStatus` always answers with an empty `revokedEntities` list. It reports on signatures +whose bytes a caller already holds, and Floci produces none (see below), so there is nothing that +could have been revoked. + +Both list operations paginate with the model's `maxResults` (1 to 25) and an opaque `nextToken` +that names the last item returned, so a page stays resumable when profiles or jobs are added +between requests. + +A job carries its `clientRequestToken`, and a second `StartSigningJob` with the same token answers +the job the first one created instead of starting another, so a client that retries after a timeout +does not duplicate work. + +A profile that sets no `signatureValidityPeriod` gets the period Signer applies by default, 135 +months, on the platforms whose signatures expire; a job started from it therefore reports a +`signatureExpiresAt`. The AWS IoT platform expires nothing and supports no revocation, so a job on +it reports no expiry and `RevokeSignature` refuses it. + +Every timestamp this service emits is epoch seconds, as a JSON number, because that is the form the +Signer model unmarshals. The AWS CLI coerces an ISO 8601 string and hides the difference, while the +Java and Go SDKs reject the whole response, so the compatibility suite asserts the numeric form. + +## Not emulated + +Floci records a signing job but does not sign, and it says so instead of reporting a success +nothing backs. `StartSigningJob` validates the profile and its S3 source and destination and +completes the job as `Failed`, with a `statusReason` naming the object that was not written, so no +caller downloads a key that is not there; `RevokeSignature` refuses a job that has no signature to +revoke. `FLOCI_SERVICES_SIGNER_MOCK_SIGNING_JOBS=true` records jobs as `Succeeded` and echoes the +destination as `signedObject`, for tools that only read job metadata; that mode is a mock, and the +artifact still does not exist. + +`SignPayload` is not served: it answers an AWS-shaped error rather than a signature, because a +payload signature is the one thing the metadata model cannot approximate. A profile permission can +still name `signer:SignPayload`, which AWS lists with the other profile actions: the grant is policy +metadata and is accepted, only the operation itself is not served. + +Cancelling a profile keeps it, as AWS does: it stays readable through `GetSigningProfile` with the +same ARN and version and the status `Canceled`, it stops accepting jobs, and `ListSigningProfiles` +hides it unless `includeCanceled=true` or `statuses` names `Canceled`. A `PutSigningProfile` on the +same name brings it back as a new `Active` version. + +IAM treats Signer as any other service: `signer` and `signer-data` are in the vendored +request-resource table, so an action is checked against the profile or job ARN the call names +rather than against `*`. A profile a CloudFormation stack provisions through +`AWS::Signer::SigningProfile` is the same record this service serves: the stack's `Ref` is the +profile ARN, `Fn::GetAtt` answers `Arn`, `ProfileName`, `ProfileVersion` and `ProfileVersionArn`, +the template's `Tags` land on the profile, and deleting the stack cancels it. + +## Configuration + +| Variable | Default | Description | +|---|---|---| +| `FLOCI_SERVICES_SIGNER_ENABLED` | `true` | Enable or disable the service | +| `FLOCI_SERVICES_SIGNER_MOCK_SIGNING_JOBS` | `false` | Record jobs as `Succeeded` without an artifact, for tools that only read job metadata | + +## Examples + +```bash +export AWS_ENDPOINT_URL=http://localhost:4566 + +aws signer put-signing-profile \ + --profile-name my-profile \ + --platform-id AWSLambda-SHA384-ECDSA \ + --signature-validity-period type=DAYS,value=135 \ + --tags env=local + +job_id=$(aws signer start-signing-job \ + --profile-name my-profile \ + --source s3={bucketName=artifacts,key=app.zip,version=1} \ + --destination s3={bucketName=signed,prefix=out/} \ + --client-request-token local-1 \ + --query jobId --output text) + +aws signer describe-signing-job --job-id "$job_id" # Failed: no artifact is written + +aws signer cancel-signing-profile --profile-name my-profile +aws signer get-signing-profile --profile-name my-profile # Canceled, same ARN +aws signer list-signing-profiles --include-canceled --query 'profiles[].profileName' +``` + +Through CloudFormation, the profile the stack reports is the profile this service serves: + +```json +{ + "Resources": { + "Profile": { + "Type": "AWS::Signer::SigningProfile", + "Properties": {"PlatformId": "AWSLambda-SHA384-ECDSA"} + } + }, + "Outputs": { + "Arn": {"Value": {"Fn::GetAtt": ["Profile", "Arn"]}} + } +} +``` diff --git a/mkdocs.yml b/mkdocs.yml index 25164c54ff..9ccddff870 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -172,6 +172,7 @@ nav: - AppIntegrations: services/appintegrations.md - Amazon Data Lifecycle Manager: services/dlm.md - ACM: services/acm.md + - AWS Signer: services/signer.md - Payment Cryptography: services/payment-cryptography.md - Payment Cryptography data plane: services/payment-cryptography-data.md - ECS: services/ecs.md diff --git a/src/main/java/io/floci/aws/config/EmulatorConfig.java b/src/main/java/io/floci/aws/config/EmulatorConfig.java index 5cd9a1baa1..5104cdbce7 100644 --- a/src/main/java/io/floci/aws/config/EmulatorConfig.java +++ b/src/main/java/io/floci/aws/config/EmulatorConfig.java @@ -874,6 +874,7 @@ public interface EmulatorConfig { ConnectServiceConfig connect(); AppIntegrationsServiceConfig appintegrations(); DlmServiceConfig dlm(); + SignerServiceConfig signer(); CognitoIdentityServiceConfig cognitoidentity(); GlobalAcceleratorServiceConfig globalaccelerator(); DataSyncServiceConfig datasync(); @@ -951,6 +952,19 @@ public interface EmulatorConfig { boolean enabled(); } + interface SignerServiceConfig { + @WithDefault("true") + boolean enabled(); + + /** + * Records signing jobs as succeeded without producing an artifact, for callers that only + * read job metadata. Off by default: a job that reports success must have something to + * download, and Floci does not sign code. + */ + @WithDefault("false") + boolean mockSigningJobs(); + } + interface CognitoIdentityServiceConfig { @WithDefault("true") boolean enabled(); diff --git a/src/main/java/io/floci/aws/core/common/ResolvedServiceCatalog.java b/src/main/java/io/floci/aws/core/common/ResolvedServiceCatalog.java index 89aade34ba..a54b1f00d5 100644 --- a/src/main/java/io/floci/aws/core/common/ResolvedServiceCatalog.java +++ b/src/main/java/io/floci/aws/core/common/ResolvedServiceCatalog.java @@ -101,6 +101,7 @@ import io.floci.aws.services.ses.SesSuppressionController; import io.floci.aws.services.ses.SesTagController; import io.floci.aws.services.ses.SesTemplateController; import io.floci.aws.services.ses.SesTenantController; +import io.floci.aws.services.signer.SignerController; import io.floci.aws.services.signin.SigninController; import io.floci.aws.services.ssooidc.SsoOidcController; import io.floci.aws.services.ssoportal.SsoPortalController; @@ -777,6 +778,10 @@ public class ResolvedServiceCatalog { "dlm", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON, protocols(ServiceProtocol.REST_JSON), Set.of(), Set.of("dlm"), Set.of(), Set.of(DlmController.class)), + descriptor("signer", "signer", config.services().signer().enabled(), true, + "signer", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON, + protocols(ServiceProtocol.REST_JSON), + Set.of(), Set.of("signer"), Set.of(), Set.of(SignerController.class)), descriptor("cognito-identity", "cognitoidentity", config.services().cognitoidentity().enabled(), true, "cognitoidentity", config.storage().mode(), 5000L, null, ServiceProtocol.JSON, diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisioner.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisioner.java index 1311332555..7afd643419 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisioner.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisioner.java @@ -1,26 +1,37 @@ package io.floci.aws.services.cloudformation.provisioners; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; -import io.floci.aws.core.common.AwsArnUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; import io.floci.aws.core.common.AwsException; import io.floci.aws.services.cloudformation.model.StackResource; +import io.floci.aws.services.signer.SignerPlatforms; +import io.floci.aws.services.signer.SignerService; +import io.floci.aws.services.signer.model.SigningProfile; import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.concurrent.ThreadLocalRandom; import java.util.regex.Pattern; /** - * Provisions {@code AWS::Signer::SigningProfile}. Floci has no Signer API, so a profile is only the - * identifiers CloudFormation hands the template: {@code Ref} is the profile ARN, and the attributes - * carry the name, a version and the version ARN a code signing config lists. Every property but - * {@code Tags} is create-only: an update that keeps them keeps the profile, one that changes them - * mints a new one, and one that would keep an explicit name is refused, as CloudFormation refuses - * replacing any custom-named resource. A replaced or deleted profile leaves nothing behind to clean - * up, and a rolled-back replacement points the resource back to the prior profile. + * Provisions {@code AWS::Signer::SigningProfile} through {@link SignerService}, so a profile a stack + * creates is the profile the Signer API serves: {@code aws signer get-signing-profile} returns the + * same ARN the stack hands out as {@code Ref}, with its platform, validity period and tags. + * + *

{@code Ref} is the profile ARN and the attributes carry the name, a version and the version ARN + * a code signing config lists. Every property but {@code Tags} is create-only: an update that keeps + * them keeps the profile and re-applies its tags, one that changes them mints a new profile, and one + * that would keep an explicit name is refused, as CloudFormation refuses replacing any custom-named + * resource. A replaced profile is cancelled once the update commits; a rolled-back replacement puts + * the resource back and cancels the profile that update created. */ @ApplicationScoped public class SignerCfnProvisioner implements CfnResourceProvisioner { @@ -30,8 +41,23 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { private static final Pattern PROFILE_NAME = Pattern.compile("[0-9a-zA-Z_]{2,64}"); private static final Map MAX_VALIDITY = Map.of("DAYS", 4105, "MONTHS", 135, "YEARS", 11); private static final String ALPHANUMERIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + private static final String PROFILE_RESOURCE = "/signing-profiles/"; /** The create-only properties the profile was minted from, so an update can tell whether it is replaced. */ private static final String CREATE_ONLY_ATTR = "FlociSigningProfileCreateOnly"; + /** + * The tags an in-place update is about to replace, with the region they live in, so a rollback + * can put them back. Present only while a tag change is pending: a provision that would write + * the set already stored removes it. + */ + private static final String PRIOR_TAGS_ATTR = "FlociSigningProfilePriorTags"; + private static final ObjectMapper MAPPER = new ObjectMapper(); + + private final SignerService signerService; + + @Inject + public SignerCfnProvisioner(SignerService signerService) { + this.signerService = signerService; + } @Override public Set resourceTypes() { @@ -52,7 +78,7 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { TYPE + " ProfileName must be 2 to 64 characters from [0-9a-zA-Z_], got " + explicitName, 400); } JsonNode period = ctx.engine().resolveNodeOmittingNoValue(props.path("SignatureValidityPeriod")); - validatePeriod(period, ctx); + Integer validityValue = validatePeriod(period, ctx); String createOnly = platformId + "|" + Objects.toString(explicitName, "") + "|" + period.path("Type").asText() + "|" + period.path("Value").asText(); if (!createOnly.equals(r.getAttributes().get(CREATE_ONLY_ATTR))) { @@ -61,7 +87,9 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { "CloudFormation cannot update a stack when a custom-named resource requires " + "replacing. Rename " + explicitName + " and update the stack again.", 400); } - mint(r, ctx, explicitName, createOnly); + mint(r, ctx, platformId, explicitName, period, validityValue, createOnly, tags(ctx, props)); + } else { + replaceTags(r, ctx, tags(ctx, props)); } ReplacementCleanup.record(r, ctx, attributesBefore); } @@ -70,9 +98,9 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { * Signer's checks on a supplied validity period, in its order and with its messages: a known unit, * then a value above zero and at most the unit's cap. An omitted period keeps Signer's default. */ - private static void validatePeriod(JsonNode period, ProvisionContext ctx) { + private static Integer validatePeriod(JsonNode period, ProvisionContext ctx) { if (period.isMissingNode()) { - return; + return null; } String type = period.path("Type").asText(null); if (type == null || !MAX_VALIDITY.containsKey(type)) { @@ -87,22 +115,159 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { throw new AwsException("ValidationError", "Signature validity period value for " + type + " must be less than or equal to " + MAX_VALIDITY.get(type), 400); } + return value; } - private static void mint(StackResource r, ProvisionContext ctx, String explicitName, String createOnly) { + private void mint(StackResource r, ProvisionContext ctx, String platformId, String explicitName, + JsonNode period, Integer validityValue, String createOnly, Map tags) { String name = explicitName != null ? explicitName : r.getLogicalId().substring(0, Math.min(r.getLogicalId().length(), 51)) + "_" + random(12); - String arn = AwsArnUtils.Arn.of("signer", ctx.region(), ctx.accountId(), "/signing-profiles/" + name) - .toString(); - String version = random(10); - r.setPhysicalId(arn); - r.getAttributes().put("Arn", arn); - r.getAttributes().put("ProfileName", name); - r.getAttributes().put("ProfileVersion", version); - r.getAttributes().put("ProfileVersionArn", arn + "/" + version); + if (explicitName != null && signerService.findSigningProfile(explicitName, ctx.region()).isPresent()) { + throw new AwsException("ValidationError", TYPE + " " + explicitName + + " already exists in " + ctx.region() + + "; a stack cannot take over a signing profile it did not create.", 400); + } + SigningProfile profile = signerService.putSigningProfile( + name, + platformId, + period.isMissingNode() ? null : period.path("Type").asText(null), + validityValue, + tags, + ctx.region()); + r.setPhysicalId(profile.getArn()); + r.getAttributes().put("Arn", profile.getArn()); + r.getAttributes().put("ProfileName", profile.getProfileName()); + r.getAttributes().put("ProfileVersion", profile.getProfileVersion()); + r.getAttributes().put("ProfileVersionArn", profile.getProfileVersionArn()); r.getAttributes().put(CREATE_ONLY_ATTR, createOnly); } + /** + * A tags-only update. CloudFormation sets the resource's tags to exactly what the template + * declares, so this replaces the set rather than merging into it, and it does not mint a profile + * version: on AWS, tagging a signing profile is not a change to the profile. + */ + private void replaceTags(StackResource r, ProvisionContext ctx, Map tags) { + String name = r.getAttributes().get("ProfileName"); + if (name == null) { + return; + } + Optional stored = signerService.findSigningProfile(name, ctx.region()); + if (stored.isEmpty()) { + adopt(r, ctx, name); + signerService.replaceTags(name, tags, ctx.region()); + return; + } + if (stored.get().getTags().equals(tags)) { + r.getAttributes().remove(PRIOR_TAGS_ATTR); + return; + } + snapshotTags(r, ctx, stored.get().getTags()); + signerService.replaceTags(name, tags, ctx.region()); + } + + /** + * Writes the service record for a resource this stack provisioned before the service existed, + * keeping the identifiers the stack already handed out. The create-only property string the + * provisioner recorded carries the platform and the validity period, which is all a later tag + * update needs. + */ + private void adopt(StackResource r, ProvisionContext ctx, String name) { + String createOnly = r.getAttributes().get(CREATE_ONLY_ATTR); + String[] parts = createOnly == null ? new String[0] : createOnly.split("\\|", -1); + String platformId = parts.length > 0 ? parts[0] : null; + if (platformId == null || SignerPlatforms.find(platformId).isEmpty()) { + return; + } + String validityType = parts.length > 2 && !parts[2].isEmpty() ? parts[2] : null; + Integer validityValue = null; + if (validityType != null && parts.length > 3) { + try { + validityValue = Integer.valueOf(parts[3]); + } catch (NumberFormatException ignored) { + validityValue = null; + } + } + signerService.adoptSigningProfile(name, platformId, r.getAttributes().get("ProfileVersion"), + validityType, validityValue, ctx.region()); + } + + private static void snapshotTags(StackResource r, ProvisionContext ctx, Map tags) { + ObjectNode snapshot = MAPPER.createObjectNode(); + snapshot.put("region", ctx.region()); + ObjectNode stored = snapshot.putObject("tags"); + tags.forEach(stored::put); + try { + r.getAttributes().put(PRIOR_TAGS_ATTR, MAPPER.writeValueAsString(snapshot)); + } catch (JsonProcessingException e) { + throw new AwsException("ValidationError", "Could not record the profile's prior tags: " + + e.getMessage(), 400); + } + } + + private void restorePriorTags(StackResource r, String snapshotJson) { + try { + JsonNode snapshot = MAPPER.readTree(snapshotJson); + String region = snapshot.path("region").asText(null); + String name = r.getAttributes().get("ProfileName"); + if (region == null || name == null) { + return; + } + Map tags = new LinkedHashMap<>(); + snapshot.path("tags").fields().forEachRemaining(entry -> tags.put(entry.getKey(), entry.getValue().asText())); + signerService.replaceTags(name, tags, region); + } catch (JsonProcessingException e) { + throw new AwsException("ValidationError", "Could not restore the profile's prior tags: " + + e.getMessage(), 400); + } + } + + /** + * The template's {@code Tags}, with every key and value resolved: a {@code Ref}, an + * {@code Fn::Sub} or a {@code Fn::If} inside a tag is a reference to something the engine owns, + * and reading the raw node would store the intrinsic document as the tag. + */ + private static Map tags(ProvisionContext ctx, JsonNode props) { + JsonNode tags = ctx.engine().resolveNodeOmittingNoValue(props.path("Tags")); + if (tags.isMissingNode() || tags.isNull() || !tags.isArray()) { + return new LinkedHashMap<>(); + } + Map resolved = new LinkedHashMap<>(); + for (JsonNode tag : tags) { + String key = ctx.engine().resolveNodeOmittingNoValue(tag.path("Key")).asText(null); + if (key == null || key.isEmpty()) { + continue; + } + resolved.put(key, ctx.engine().resolveNodeOmittingNoValue(tag.path("Value")).asText("")); + } + return resolved; + } + + @Override + public void delete(String resourceType, String physicalId, String region) { + String name = profileNameOf(physicalId); + if (name == null) { + return; + } + CfnDeletes.safeDelete("Signing profile", physicalId, + () -> signerService.cancelSigningProfile(name, region), + "ResourceNotFoundException"); + } + + /** The profile name the ARN names, so a delete driven by a physical id alone can cancel it. */ + private static String profileNameOf(String physicalId) { + if (physicalId == null) { + return null; + } + int at = physicalId.indexOf(PROFILE_RESOURCE); + if (at < 0) { + return null; + } + String remainder = physicalId.substring(at + PROFILE_RESOURCE.length()); + int slash = remainder.indexOf('/'); + return slash < 0 ? remainder : remainder.substring(0, slash); + } + @Override public boolean hasReplacementUpdate(StackResource resource) { return ReplacementCleanup.hasReplacement(resource); @@ -115,6 +280,7 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { @Override public UpdateCleanupResult completeUpdate(StackResource resource) { + resource.getAttributes().remove(PRIOR_TAGS_ATTR); return ReplacementCleanup.complete(resource, this::delete); } @@ -123,9 +289,15 @@ public class SignerCfnProvisioner implements CfnResourceProvisioner { ReplacementCleanup.clear(resource); } - /** A replacement points back to the prior profile; a tags-only update changed nothing Floci holds. */ + /** A replacement points back to the prior profile and cancels the one this update created. */ @Override public boolean rollbackUpdate(StackResource resource) { + String pendingTags = resource.getAttributes().get(PRIOR_TAGS_ATTR); + if (!ReplacementCleanup.hasReplacement(resource) && pendingTags != null) { + restorePriorTags(resource, pendingTags); + resource.getAttributes().remove(PRIOR_TAGS_ATTR); + return true; + } ReplacementCleanup.rollback(resource, this::delete); return true; } diff --git a/src/main/java/io/floci/aws/services/signer/SignerController.java b/src/main/java/io/floci/aws/services/signer/SignerController.java new file mode 100644 index 0000000000..1b0ccea84b --- /dev/null +++ b/src/main/java/io/floci/aws/services/signer/SignerController.java @@ -0,0 +1,364 @@ +package io.floci.aws.services.signer; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import io.floci.aws.core.common.JsonErrorResponseUtils; +import io.floci.aws.core.common.RegionResolver; +import io.floci.aws.services.signer.model.SigningJob; +import io.floci.aws.services.signer.model.SigningProfile; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import java.util.List; + +/** + * The REST JSON routes AWS Signer publishes, mounted under {@link SignerRouteFilter#INTERNAL_PREFIX}. + * + *

Signer's public paths are literal ({@code /signing-profiles}, {@code /signing-jobs}, + * {@code /signing-platforms}, {@code /revocations}) and S3's path-style routes would otherwise claim + * them as buckets, so {@link SignerRouteFilter} rewrites a request signed for {@code signer} onto the + * internal prefix before route matching. The shared {@code /tags/{resourceArn}} routes are served by + * {@code SharedTagsController} through {@link SignerService} as a {@code TagHandler}. + */ +@Path(SignerRouteFilter.INTERNAL_PREFIX) +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class SignerController { + + private final SignerService signerService; + private final RegionResolver regionResolver; + private final ObjectMapper objectMapper; + + @Inject + public SignerController(SignerService signerService, RegionResolver regionResolver, + ObjectMapper objectMapper) { + this.signerService = signerService; + this.regionResolver = regionResolver; + this.objectMapper = objectMapper; + } + + @PUT + @Path("/signing-profiles/{profileName}") + public Response putSigningProfile(@PathParam("profileName") String profileName, + @Context HttpHeaders headers, String body) { + String region = regionResolver.resolveRegion(headers); + SigningProfile profile = signerService.putSigningProfile(profileName, readTree(body), region); + ObjectNode response = objectMapper.createObjectNode(); + response.put("arn", profile.getArn()); + response.put("profileVersion", profile.getProfileVersion()); + response.put("profileVersionArn", profile.getProfileVersionArn()); + return Response.ok(response).build(); + } + + @GET + @Path("/signing-profiles/{profileName}") + public Response getSigningProfile(@PathParam("profileName") String profileName, + @Context HttpHeaders headers) { + String region = regionResolver.resolveRegion(headers); + return Response.ok(profileNode(signerService.getSigningProfile(profileName, region), true)) + .build(); + } + + @GET + @Path("/signing-profiles") + public Response listSigningProfiles(@Context HttpHeaders headers, + @QueryParam("platformId") String platformId, + @QueryParam("statuses") List statuses, + @QueryParam("includeCanceled") Boolean includeCanceled, + @QueryParam("maxResults") Integer maxResults, + @QueryParam("nextToken") String nextToken) { + String region = regionResolver.resolveRegion(headers); + SignerService.Page page = signerService.listSigningProfiles( + region, platformId, statuses, includeCanceled, maxResults, nextToken); + ObjectNode response = objectMapper.createObjectNode(); + ArrayNode profiles = response.putArray("profiles"); + for (SigningProfile profile : page.items()) { + profiles.add(profileNode(profile, false)); + } + if (page.nextToken() != null) { + response.put("nextToken", page.nextToken()); + } + return Response.ok(response).build(); + } + + @DELETE + @Path("/signing-profiles/{profileName}") + public Response cancelSigningProfile(@PathParam("profileName") String profileName, + @Context HttpHeaders headers) { + String region = regionResolver.resolveRegion(headers); + signerService.cancelSigningProfile(profileName, region); + return Response.ok().build(); + } + + @PUT + @Path("/signing-profiles/{profileName}/revoke") + public Response revokeSigningProfile(@PathParam("profileName") String profileName, + @Context HttpHeaders headers, String body) { + String region = regionResolver.resolveRegion(headers); + signerService.revokeSigningProfile(profileName, readTree(body), region); + return Response.ok().build(); + } + + @POST + @Path("/signing-profiles/{profileName}/permissions") + public Response addProfilePermission(@PathParam("profileName") String profileName, + @Context HttpHeaders headers, String body) { + String region = regionResolver.resolveRegion(headers); + String revisionId = signerService.addProfilePermission(profileName, readTree(body), region); + ObjectNode response = objectMapper.createObjectNode(); + response.put("revisionId", revisionId); + return Response.ok(response).build(); + } + + @GET + @Path("/signing-profiles/{profileName}/permissions") + public Response listProfilePermissions(@PathParam("profileName") String profileName, + @Context HttpHeaders headers) { + String region = regionResolver.resolveRegion(headers); + List permissions = + signerService.listProfilePermissions(profileName, region); + ObjectNode response = objectMapper.createObjectNode(); + response.put("revisionId", signerService.getSigningProfile(profileName, region) + .getRevisionId()); + response.put("policySizeBytes", permissions.size() * 128); + ArrayNode entries = response.putArray("permissions"); + for (SigningProfile.ProfilePermission permission : permissions) { + ObjectNode entry = entries.addObject(); + entry.put("action", permission.getAction()); + entry.put("principal", permission.getPrincipal()); + entry.put("statementId", permission.getStatementId()); + entry.put("profileVersion", permission.getProfileVersion()); + } + return Response.ok(response).build(); + } + + @DELETE + @Path("/signing-profiles/{profileName}/permissions/{statementId}") + public Response removeProfilePermission(@PathParam("profileName") String profileName, + @PathParam("statementId") String statementId, + @QueryParam("revisionId") String revisionId, + @Context HttpHeaders headers) { + String region = regionResolver.resolveRegion(headers); + String newRevisionId = signerService.removeProfilePermission( + profileName, statementId, revisionId, region); + ObjectNode response = objectMapper.createObjectNode(); + response.put("revisionId", newRevisionId); + return Response.ok(response).build(); + } + + @POST + @Path("/signing-jobs") + public Response startSigningJob(@Context HttpHeaders headers, String body) { + String region = regionResolver.resolveRegion(headers); + SigningJob job = signerService.startSigningJob(readTree(body), region); + ObjectNode response = objectMapper.createObjectNode(); + response.put("jobId", job.getJobId()); + response.put("jobOwner", job.getJobOwner()); + return Response.ok(response).build(); + } + + @GET + @Path("/signing-jobs") + public Response listSigningJobs(@Context HttpHeaders headers, + @QueryParam("status") String status, + @QueryParam("platformId") String platformId, + @QueryParam("isRevoked") Boolean isRevoked, + @QueryParam("maxResults") Integer maxResults, + @QueryParam("nextToken") String nextToken) { + String region = regionResolver.resolveRegion(headers); + SignerService.Page page = signerService.listSigningJobs( + region, status, platformId, isRevoked, maxResults, nextToken); + ObjectNode response = objectMapper.createObjectNode(); + ArrayNode jobs = response.putArray("jobs"); + for (SigningJob job : page.items()) { + jobs.add(jobNode(job, false)); + } + if (page.nextToken() != null) { + response.put("nextToken", page.nextToken()); + } + return Response.ok(response).build(); + } + + @GET + @Path("/signing-jobs/{jobId}") + public Response describeSigningJob(@PathParam("jobId") String jobId, + @Context HttpHeaders headers) { + String region = regionResolver.resolveRegion(headers); + return Response.ok(jobNode(signerService.describeSigningJob(jobId, region), true)).build(); + } + + @PUT + @Path("/signing-jobs/{jobId}/revoke") + public Response revokeSignature(@PathParam("jobId") String jobId, + @Context HttpHeaders headers, String body) { + String region = regionResolver.resolveRegion(headers); + signerService.revokeSignature(jobId, readTree(body), region); + return Response.ok().build(); + } + + @GET + @Path("/revocations") + public Response getRevocationStatus(@Context HttpHeaders headers) { + ObjectNode response = objectMapper.createObjectNode(); + ArrayNode revokedEntities = response.putArray("revokedEntities"); + for (String entity : signerService.getRevocationStatus()) { + revokedEntities.add(entity); + } + return Response.ok(response).build(); + } + + @GET + @Path("/signing-platforms") + public Response listSigningPlatforms(@Context HttpHeaders headers, + @QueryParam("category") String category, + @QueryParam("partner") String partner, + @QueryParam("target") String target) { + List platforms = signerService.listSigningPlatforms(category); + ObjectNode response = objectMapper.createObjectNode(); + ArrayNode entries = response.putArray("platforms"); + for (SignerPlatforms.Platform platform : platforms) { + if (partner != null && !partner.equals(platform.partner())) { + continue; + } + if (target != null && !target.equals(platform.target())) { + continue; + } + entries.add(platformNode(platform)); + } + return Response.ok(response).build(); + } + + @GET + @Path("/signing-platforms/{platformId}") + public Response getSigningPlatform(@PathParam("platformId") String platformId, + @Context HttpHeaders headers) { + return Response.ok(platformNode(signerService.getSigningPlatform(platformId))).build(); + } + + private ObjectNode profileNode(SigningProfile profile, boolean detail) { + ObjectNode node = objectMapper.createObjectNode(); + node.put("profileName", profile.getProfileName()); + node.put("profileVersion", profile.getProfileVersion()); + node.put("profileVersionArn", profile.getProfileVersionArn()); + node.put("arn", profile.getArn()); + node.put("platformId", profile.getPlatformId()); + node.put("platformDisplayName", profile.getPlatformDisplayName()); + node.put("status", profile.getStatus()); + if (profile.getSigningMaterialCertificateArn() != null) { + node.putObject("signingMaterial") + .put("certificateArn", profile.getSigningMaterialCertificateArn()); + } + if (profile.getSignatureValidityPeriodType() != null) { + ObjectNode period = node.putObject("signatureValidityPeriod"); + period.put("type", profile.getSignatureValidityPeriodType()); + period.put("value", profile.getSignatureValidityPeriodValue()); + } + if (profile.getOverrides() != null) { + node.set("overrides", profile.getOverrides()); + } + node.set("signingParameters", objectMapper.valueToTree(profile.getSigningParameters())); + node.set("tags", objectMapper.valueToTree(profile.getTags())); + if (detail) { + if (profile.getStatusReason() != null) { + node.put("statusReason", profile.getStatusReason()); + } + if (profile.getRevokedAt() != null) { + ObjectNode record = node.putObject("revocationRecord"); + record.put("revocationEffectiveFrom", profile.getRevocationEffectiveFrom()); + record.put("revokedAt", profile.getRevokedAt()); + record.put("revokedBy", profile.getRevokedBy()); + } + } + return node; + } + + private ObjectNode jobNode(SigningJob job, boolean detail) { + ObjectNode node = objectMapper.createObjectNode(); + node.put("jobId", job.getJobId()); + node.put("jobArn", job.getJobArn()); + ObjectNode sourceS3 = node.putObject("source").putObject("s3"); + sourceS3.put("bucketName", job.getSourceBucketName()); + sourceS3.put("key", job.getSourceKey()); + sourceS3.put("version", job.getSourceVersion()); + if (job.getSignedObjectBucketName() != null) { + ObjectNode signed = node.putObject("signedObject").putObject("s3"); + signed.put("bucketName", job.getSignedObjectBucketName()); + signed.put("key", job.getSignedObjectKey()); + } + node.put("profileName", job.getProfileName()); + node.put("profileVersion", job.getProfileVersion()); + node.put("platformId", job.getPlatformId()); + node.put("platformDisplayName", job.getPlatformDisplayName()); + node.put("status", job.getStatus()); + node.put("isRevoked", job.isRevoked()); + node.put("createdAt", job.getCreatedAt()); + node.put("jobOwner", job.getJobOwner()); + node.put("jobInvoker", job.getJobInvoker()); + if (job.getSignatureExpiresAt() != null) { + node.put("signatureExpiresAt", job.getSignatureExpiresAt()); + } + if (detail) { + if (job.getCompletedAt() != null) { + node.put("completedAt", job.getCompletedAt()); + } + if (job.getStatusReason() != null) { + node.put("statusReason", job.getStatusReason()); + } + if (job.getRequestedBy() != null) { + node.put("requestedBy", job.getRequestedBy()); + } + if (job.isRevoked()) { + ObjectNode record = node.putObject("revocationRecord"); + record.put("reason", job.getRevocationReason()); + record.put("revokedAt", job.getRevokedAt()); + record.put("revokedBy", job.getRevokedBy()); + } + } + return node; + } + + private ObjectNode platformNode(SignerPlatforms.Platform platform) { + ObjectNode node = objectMapper.createObjectNode(); + node.put("platformId", platform.platformId()); + node.put("displayName", platform.displayName()); + node.put("partner", platform.partner()); + node.put("target", platform.target()); + node.put("category", platform.category()); + ObjectNode configuration = node.putObject("signingConfiguration"); + ObjectNode encryption = configuration.putObject("encryptionAlgorithmOptions"); + encryption.set("allowedValues", objectMapper.valueToTree(platform.encryptionAlgorithms())); + encryption.put("defaultValue", platform.defaultEncryptionAlgorithm()); + ObjectNode hash = configuration.putObject("hashAlgorithmOptions"); + hash.set("allowedValues", objectMapper.valueToTree(platform.hashAlgorithms())); + hash.put("defaultValue", platform.defaultHashAlgorithm()); + ObjectNode imageFormat = node.putObject("signingImageFormat"); + imageFormat.set("supportedFormats", objectMapper.valueToTree(platform.imageFormats())); + imageFormat.put("defaultFormat", platform.defaultImageFormat()); + node.put("maxSizeInMB", platform.maxSizeInMB()); + node.put("revocationSupported", platform.revocationSupported()); + return node; + } + + private JsonNode readTree(String body) { + try { + return objectMapper.readTree(body == null || body.isBlank() ? "{}" : body); + } catch (Exception e) { + throw new WebApplicationException(JsonErrorResponseUtils.createSerializationErrorResponse()); + } + } +} diff --git a/src/main/java/io/floci/aws/services/signer/SignerPlatforms.java b/src/main/java/io/floci/aws/services/signer/SignerPlatforms.java new file mode 100644 index 0000000000..b31ae58503 --- /dev/null +++ b/src/main/java/io/floci/aws/services/signer/SignerPlatforms.java @@ -0,0 +1,101 @@ +package io.floci.aws.services.signer; + +import java.util.List; +import java.util.Optional; + +/** + * The signing platforms AWS publishes, with the configuration and image formats each accepts. + * + *

Signer does not discover platforms from AWS: the list is fixed for a given API version and the + * AWS SDK never sends it, so a profile names one of these ids and Floci answers the matching + * description. The values follow the published platform descriptions; only the three platforms an + * emulated workflow can reach are listed. + */ +public final class SignerPlatforms { + + /** One published signing platform and the options a profile may override. */ + public record Platform( + String platformId, + String displayName, + String partner, + String target, + String category, + List hashAlgorithms, + String defaultHashAlgorithm, + List encryptionAlgorithms, + String defaultEncryptionAlgorithm, + List imageFormats, + String defaultImageFormat, + int maxSizeInMB, + boolean revocationSupported, + /** + * The period Signer applies when a profile sets none: 135 months on the platforms that + * expire signatures. Zero on a platform whose signatures do not carry a validity. + */ + int defaultValidityMonths) { + } + + public static final Platform AWS_LAMBDA = new Platform( + "AWSLambda-SHA384-ECDSA", + "AWS Lambda", + "AWS", + "Lambda", + "AWSLambda", + List.of("SHA-256", "SHA-384"), + "SHA-384", + List.of("ECDSA"), + "ECDSA", + List.of("JSON"), + "JSON", + 50, + true, + 135); + + public static final Platform NOTATION_OCI = new Platform( + "Notation-OCI-SHA384-ECDSA", + "Notation OCI", + "AWS", + "OCI", + "Notation-OCI", + List.of("SHA-384"), + "SHA-384", + List.of("ECDSA"), + "ECDSA", + List.of("JSON"), + "JSON", + 500, + true, + 135); + + public static final Platform IOT_SHA256 = new Platform( + "AWSIoTDeviceManagement-SHA256-ECDSA", + "AWS IoT Device Management SHA256 ECDSA", + "AWS", + "IoT", + "AWSIoT", + List.of("SHA-256"), + "SHA-256", + List.of("ECDSA"), + "ECDSA", + List.of("JSONEmbedded", "JSONDetached"), + "JSONEmbedded", + 50, + false, + 0); + + private static final List ALL = List.of(AWS_LAMBDA, NOTATION_OCI, IOT_SHA256); + + private SignerPlatforms() { + } + + public static List all() { + return ALL; + } + + public static Optional find(String platformId) { + if (platformId == null) { + return Optional.empty(); + } + return ALL.stream().filter(platform -> platform.platformId().equals(platformId)).findFirst(); + } +} diff --git a/src/main/java/io/floci/aws/services/signer/SignerRouteFilter.java b/src/main/java/io/floci/aws/services/signer/SignerRouteFilter.java new file mode 100644 index 0000000000..1d8103e8d1 --- /dev/null +++ b/src/main/java/io/floci/aws/services/signer/SignerRouteFilter.java @@ -0,0 +1,43 @@ +package io.floci.aws.services.signer; + +import io.floci.aws.core.common.ResolvedServiceCatalog; +import io.floci.aws.core.common.SignedServiceRoute; +import jakarta.inject.Inject; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.PreMatching; +import jakarta.ws.rs.ext.Provider; + +import java.util.function.Predicate; + +/** + * Rewrites Signer requests to an internal prefix before JAX-RS route matching. + * + *

Signer's paths are literal and S3's path-style routes claim any first segment as a bucket, so a + * request for {@code /signing-profiles} would otherwise read as bucket {@code signing-profiles}. The + * rewrite is keyed on the SigV4 credential scope, so a request signed for S3 keeps its path and + * reaches S3: only a request signed for {@code signer} is moved. + */ +@Provider +@PreMatching +public class SignerRouteFilter implements ContainerRequestFilter { + + static final String INTERNAL_PREFIX = "/_signer"; + + private static final Predicate PUBLIC_PATHS = SignedServiceRoute.under("/signing-profiles") + .or(SignedServiceRoute.under("/signing-jobs")) + .or(SignedServiceRoute.under("/signing-platforms")) + .or(SignedServiceRoute.under("/revocations")); + + private final SignedServiceRoute route; + + @Inject + public SignerRouteFilter(ResolvedServiceCatalog catalog) { + this.route = new SignedServiceRoute(catalog, "signer", INTERNAL_PREFIX, PUBLIC_PATHS); + } + + @Override + public void filter(ContainerRequestContext ctx) { + route.apply(ctx); + } +} diff --git a/src/main/java/io/floci/aws/services/signer/SignerService.java b/src/main/java/io/floci/aws/services/signer/SignerService.java new file mode 100644 index 0000000000..a77c432f78 --- /dev/null +++ b/src/main/java/io/floci/aws/services/signer/SignerService.java @@ -0,0 +1,905 @@ +package io.floci.aws.services.signer; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import io.floci.aws.config.EmulatorConfig; +import io.floci.aws.core.common.AwsArnUtils; +import io.floci.aws.core.common.AwsException; +import io.floci.aws.core.common.PaginatedResult; +import io.floci.aws.core.common.Pagination; +import io.floci.aws.core.common.Resettable; +import io.floci.aws.core.common.TagHandler; +import io.floci.aws.core.storage.AccountAwareStorageBackend; +import io.floci.aws.core.storage.StorageFactory; +import io.floci.aws.services.signer.model.SigningJob; +import io.floci.aws.services.signer.model.SigningProfile; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import org.jboss.logging.Logger; + +import java.security.SecureRandom; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Pattern; + +/** + * The AWS Signer control plane: signing profiles, their cross-account permissions, and the signing + * jobs started against a profile. + * + *

Signing profiles and jobs are metadata. Floci keeps the platform, the certificate a profile + * signs with, the overrides and the S3 source and destination a job names, so SDK calls and + * infrastructure-as-code round-trip, but no cryptographic signature is produced. A job started here + * therefore ends as {@code Failed} with a {@code statusReason} saying so, and carries no + * {@code signedObject}: nothing that has not been signed is reported as signed. Setting + * {@code floci.services.signer.mock-signing-jobs=true} (or + * {@code FLOCI_SERVICES_SIGNER_MOCK_SIGNING_JOBS}) opts into the other behaviour, where the job ends + * {@code Succeeded} with the destination recorded as its signed object and no object is written to + * S3. Both are documented on the service page and asserted by the service tests. + */ +@ApplicationScoped +public class SignerService implements Resettable, TagHandler { + + private static final Logger LOG = Logger.getLogger(SignerService.class); + private static final String SERVICE = "signer"; + private static final String PROFILE_RESOURCE = "/signing-profiles/"; + private static final String JOB_RESOURCE = "/signing-jobs/"; + + private static final Pattern PROFILE_NAME = Pattern.compile("[0-9a-zA-Z_]{2,64}"); + private static final Pattern PROFILE_VERSION = Pattern.compile("[0-9a-zA-Z]{10}"); + private static final Pattern TAG_KEY = Pattern.compile("^(?!aws:)[a-zA-Z+-=._:/]+$"); + private static final Pattern STATEMENT_ID = Pattern.compile("[a-zA-Z0-9_-]{1,64}"); + private static final Pattern CERTIFICATE_ARN = Pattern.compile( + "arn:" + AwsArnUtils.PARTITION_REGEX + ":acm:[a-z0-9-]+:[0-9]+:certificate/.+"); + + private static final Set VALIDITY_TYPES = Set.of("DAYS", "MONTHS", "YEARS"); + private static final Map MAX_VALIDITY = + Map.of("DAYS", 4105, "MONTHS", 135, "YEARS", 11); + private static final Set PROFILE_STATUSES = Set.of("Active", "Canceled", "Revoked"); + private static final Set JOB_STATUSES = Set.of("InProgress", "Failed", "Succeeded"); + private static final Set CATEGORIES = Set.of("AWSIoT", "AWSLambda", "Notation-OCI"); + /** + * The actions AWS lets a profile permission name. {@code signer:SignPayload} is grantable even + * though the operation itself is not served: a policy that allows signing a payload is valid, + * and refusing the grant would break templates that provision it. + */ + private static final Set PROFILE_PERMISSION_ACTIONS = Set.of("signer:StartSigningJob", + "signer:SignPayload", "signer:GetSigningProfile", "signer:RevokeSignature"); + + private static final int MAX_TAGS = 50; + /** botocore caps both list operations' {@code maxResults} at 25, which is also their page size. */ + private static final int MAX_PAGE_SIZE = 25; + private static final String ALPHANUMERIC = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + private final AccountAwareStorageBackend profiles; + private final AccountAwareStorageBackend jobs; + private final boolean mockSigningJobs; + private final SecureRandom random = new SecureRandom(); + + @Inject + public SignerService(StorageFactory storageFactory, EmulatorConfig config) { + this(storageFactory.create(SERVICE, "signer-signing-profiles.json", + new TypeReference>() {}), + storageFactory.create(SERVICE, "signer-signing-jobs.json", + new TypeReference>() {}), + config.services().signer().mockSigningJobs()); + } + + SignerService(AccountAwareStorageBackend profiles, + AccountAwareStorageBackend jobs) { + this(profiles, jobs, false); + } + + SignerService(AccountAwareStorageBackend profiles, + AccountAwareStorageBackend jobs, boolean mockSigningJobs) { + this.profiles = profiles; + this.jobs = jobs; + this.mockSigningJobs = mockSigningJobs; + } + + /** A page of results, with the token a caller passes back to continue. */ + public record Page(List items, String nextToken) { + } + + // ---------------------------------------------------------------- profiles + + public SigningProfile putSigningProfile(String profileName, JsonNode request, String region) { + validateProfileName(profileName); + requireObject(request, "Request payload"); + SignerPlatforms.Platform platform = requirePlatform(requiredText(request, "platformId")); + String certificateArn = optionalCertificateArn(request); + String[] validity = optionalValidityPeriod(request); + JsonNode overrides = optionalOverrides(request, platform); + Map signingParameters = optionalStringMap(request, "signingParameters"); + Map requestedTags = optionalTags(request); + return applyProfile(profileName, platform, certificateArn, validity, overrides, + signingParameters, requestedTags, region); + } + + /** + * Creates or updates a profile from typed values, for a caller that does not speak the wire + * protocol: the CloudFormation provisioner for {@code AWS::Signer::SigningProfile}. A template + * cannot set signing material, overrides or signing parameters, so those stay empty. Validation + * is the same one the API applies, so a template that names an unknown platform or an + * out-of-range validity period fails the stack with the Signer message. + */ + public SigningProfile putSigningProfile(String profileName, String platformId, String validityType, + Integer validityValue, Map tags, + String region) { + validateProfileName(profileName); + SignerPlatforms.Platform platform = requirePlatform(platformId); + String[] validity = typedValidityPeriod(validityType, validityValue); + Map requestedTags = tags == null ? new LinkedHashMap<>() : new LinkedHashMap<>(tags); + validateTags(requestedTags); + return applyProfile(profileName, platform, null, validity, null, + new LinkedHashMap<>(), requestedTags, region); + } + + private SigningProfile applyProfile(String profileName, SignerPlatforms.Platform platform, + String certificateArn, String[] validity, JsonNode overrides, + Map signingParameters, + Map requestedTags, String region) { + SigningProfile profile = profiles.get(storageKey(region, profileName)).orElse(null); + boolean created = profile == null; + if (created) { + profile = new SigningProfile(); + profile.setProfileName(profileName); + profile.setStatus("Active"); + profile.setRevisionId(newRevisionId()); + profile.setTags(new LinkedHashMap<>(requestedTags)); + } else if (!requestedTags.isEmpty()) { + profile.setTags(new LinkedHashMap<>(requestedTags)); + } + String accountId = profiles.accountId(); + String arn = AwsArnUtils.Arn.of(SERVICE, region, accountId, PROFILE_RESOURCE + profileName) + .toString(); + String version = newProfileVersion(); + profile.setArn(arn); + profile.setPlatformId(platform.platformId()); + profile.setPlatformDisplayName(platform.displayName()); + profile.setProfileVersion(version); + profile.setProfileVersionArn(arn + "/" + version); + if (certificateArn != null) { + profile.setSigningMaterialCertificateArn(certificateArn); + } + if (validity[0] != null) { + profile.setSignatureValidityPeriodType(validity[0]); + profile.setSignatureValidityPeriodValue(Integer.valueOf(validity[1])); + } + if (overrides != null) { + profile.setOverrides(overrides); + } + if (!signingParameters.isEmpty()) { + profile.setSigningParameters(signingParameters); + } + profile.setStatus("Active"); + profile.setStatusReason(null); + profile.setRevocationEffectiveFrom(null); + profile.setRevokedAt(null); + profile.setRevokedBy(null); + profiles.put(storageKey(region, profileName), profile); + LOG.debugv("{0} signing profile {1} version {2}", created ? "Created" : "Updated", + profileName, version); + return profile; + } + + public SigningProfile getSigningProfile(String profileName, String region) { + validateProfileName(profileName); + return requireProfile(profileName, region); + } + + public Page listSigningProfiles(String region, String platformId, + List statuses, Boolean includeCanceled, + Integer maxResults, String nextToken) { + List requestedStatuses = statuses == null ? List.of() : statuses; + for (String status : requestedStatuses) { + if (!PROFILE_STATUSES.contains(status)) { + throw validation("status " + status + " is not one of " + PROFILE_STATUSES + "."); + } + } + boolean canceledWanted = Boolean.TRUE.equals(includeCanceled); + List matching = new ArrayList<>(); + for (SigningProfile profile : sortedProfiles(region)) { + if (platformId != null && !platformId.equals(profile.getPlatformId())) { + continue; + } + if (!requestedStatuses.isEmpty() && !requestedStatuses.contains(profile.getStatus())) { + continue; + } + if ("Canceled".equals(profile.getStatus()) && !canceledWanted + && !requestedStatuses.contains("Canceled")) { + continue; + } + matching.add(profile); + } + PaginatedResult page = Pagination.paginate(matching, + SigningProfile::getProfileName, maxResults, nextToken, MAX_PAGE_SIZE, + "ValidationException"); + return new Page<>(page.items(), page.nextToken()); + } + + /** The profile, when it exists, for a caller that has to tell a first create from a takeover. */ + public Optional findSigningProfile(String profileName, String region) { + return profiles.get(storageKey(region, profileName)); + } + + /** + * Writes a profile record for a CloudFormation resource that was provisioned before this + * service existed, keeping the identifiers that stack already handed out instead of minting a + * version: the adoption a later tags-only update needs. + */ + public SigningProfile adoptSigningProfile(String profileName, String platformId, String version, + String validityType, Integer validityValue, + String region) { + validateProfileName(profileName); + SignerPlatforms.Platform platform = platformOf(platformId); + String arn = AwsArnUtils.Arn.of(SERVICE, region, profiles.accountId(), + PROFILE_RESOURCE + profileName).toString(); + SigningProfile profile = new SigningProfile(); + profile.setProfileName(profileName); + profile.setArn(arn); + profile.setPlatformId(platform.platformId()); + profile.setPlatformDisplayName(platform.displayName()); + profile.setProfileVersion(version); + profile.setProfileVersionArn(arn + "/" + version); + profile.setSignatureValidityPeriodType(validityType); + profile.setSignatureValidityPeriodValue(validityValue); + profile.setStatus("Active"); + profile.setRevisionId(newRevisionId()); + profiles.put(storageKey(region, profileName), profile); + LOG.debugv("Adopted signing profile {0} version {1} from CloudFormation", profileName, version); + return profile; + } + + /** + * Cancels a profile, which AWS keeps rather than deletes: {@code GetSigningProfile} still + * answers it, with the same ARN and version, as {@code Canceled}, and it stops accepting jobs + * until {@code PutSigningProfile} creates a new version of it. Listing hides it unless the + * caller asks for canceled profiles. + */ + public void cancelSigningProfile(String profileName, String region) { + validateProfileName(profileName); + SigningProfile profile = requireProfile(profileName, region); + if ("Revoked".equals(profile.getStatus())) { + throw conflict("Signing profile " + profileName + " is revoked and cannot be canceled."); + } + if ("Canceled".equals(profile.getStatus())) { + return; + } + profile.setStatus("Canceled"); + profiles.put(storageKey(region, profileName), profile); + LOG.debugv("Canceled signing profile {0} version {1}", profileName, + profile.getProfileVersion()); + } + + public SigningProfile revokeSigningProfile(String profileName, JsonNode request, String region) { + validateProfileName(profileName); + requireObject(request, "Request payload"); + SigningProfile profile = requireProfile(profileName, region); + String profileVersion = requiredText(request, "profileVersion"); + String reason = requiredText(request, "reason"); + long effectiveTime = requiredTimestamp(request, "effectiveTime"); + if (!profileVersionMatches(profile, profileVersion)) { + throw validation("profileVersion " + profileVersion + + " is not the profile's current version."); + } + if ("Revoked".equals(profile.getStatus())) { + throw conflict("Signing profile " + profileName + " is already revoked."); + } + profile.setStatus("Revoked"); + profile.setStatusReason(reason); + profile.setRevocationEffectiveFrom(effectiveTime); + profile.setRevokedAt(Instant.now().getEpochSecond()); + profile.setRevokedBy(profiles.accountId()); + profiles.put(storageKey(region, profileName), profile); + return profile; + } + + // ------------------------------------------------------------- permissions + + public String addProfilePermission(String profileName, JsonNode request, String region) { + validateProfileName(profileName); + requireObject(request, "Request payload"); + SigningProfile profile = requireProfile(profileName, region); + String action = requiredText(request, "action"); + if (!PROFILE_PERMISSION_ACTIONS.contains(action)) { + throw validation("action " + action + " is not one of " + PROFILE_PERMISSION_ACTIONS + + "."); + } + String principal = requiredText(request, "principal"); + String statementId = requiredText(request, "statementId"); + if (!STATEMENT_ID.matcher(statementId).matches()) { + throw validation("statementId must be 1 to 64 characters from [a-zA-Z0-9_-], got " + + statementId + "."); + } + String requestedRevision = optionalText(request, "revisionId"); + if (requestedRevision != null && !requestedRevision.equals(profile.getRevisionId())) { + throw conflict("revisionId " + requestedRevision + " is not the profile's current revision."); + } + String profileVersion = optionalText(request, "profileVersion"); + if (profileVersion != null && !profileVersionMatches(profile, profileVersion)) { + throw validation("profileVersion " + profileVersion + + " is not the profile's current version."); + } + for (SigningProfile.ProfilePermission permission : profile.getPermissions()) { + if (permission.getStatementId().equals(statementId)) { + throw conflict("A permission with statementId " + statementId + " already exists."); + } + } + if (profile.getPermissions().size() >= 20) { + throw validation("A signing profile supports at most 20 permissions."); + } + profile.getPermissions().add(new SigningProfile.ProfilePermission( + action, principal, statementId, profile.getProfileVersion())); + profile.setRevisionId(newRevisionId()); + profiles.put(storageKey(region, profileName), profile); + return profile.getRevisionId(); + } + + public List listProfilePermissions(String profileName, + String region) { + validateProfileName(profileName); + return requireProfile(profileName, region).getPermissions(); + } + + public String removeProfilePermission(String profileName, String statementId, String revisionId, + String region) { + validateProfileName(profileName); + SigningProfile profile = requireProfile(profileName, region); + if (revisionId == null || revisionId.isBlank()) { + throw validation("revisionId is required."); + } + if (!revisionId.equals(profile.getRevisionId())) { + throw conflict("revisionId " + revisionId + " is not the profile's current revision."); + } + boolean removed = profile.getPermissions() + .removeIf(permission -> permission.getStatementId().equals(statementId)); + if (!removed) { + throw notFound("Permission " + statementId + " does not exist on profile " + + profileName + "."); + } + profile.setRevisionId(newRevisionId()); + profiles.put(storageKey(region, profileName), profile); + return profile.getRevisionId(); + } + + // ------------------------------------------------------------------- jobs + + public SigningJob startSigningJob(JsonNode request, String region) { + requireObject(request, "Request payload"); + String profileName = requiredText(request, "profileName"); + validateProfileName(profileName); + String clientRequestToken = requiredText(request, "clientRequestToken"); + for (SigningJob existing : sortedJobs(region)) { + if (clientRequestToken.equals(existing.getClientRequestToken())) { + return existing; + } + } + SigningProfile profile = requireProfile(profileName, region); + if (!"Active".equals(profile.getStatus())) { + throw validation("Signing profile " + profileName + + " is " + profile.getStatus() + " and cannot start a signing job."); + } + JsonNode source = requireObject(request.path("source"), "source"); + JsonNode sourceS3 = requireObject(source.path("s3"), "source.s3"); + String sourceBucket = requiredText(sourceS3, "bucketName"); + String sourceKey = requiredText(sourceS3, "key"); + String sourceVersion = requiredText(sourceS3, "version"); + JsonNode destination = requireObject(request.path("destination"), "destination"); + JsonNode destinationS3 = requireObject(destination.path("s3"), "destination.s3"); + String destinationBucket = requiredText(destinationS3, "bucketName"); + String destinationPrefix = optionalText(destinationS3, "prefix"); + + String jobId = UUID.randomUUID().toString(); + long now = Instant.now().getEpochSecond(); + String accountId = jobs.accountId(); + SigningJob job = new SigningJob(); + job.setJobId(jobId); + job.setClientRequestToken(clientRequestToken); + job.setJobArn(AwsArnUtils.Arn.of(SERVICE, region, accountId, JOB_RESOURCE + jobId).toString()); + job.setProfileName(profileName); + job.setProfileVersion(profile.getProfileVersion()); + job.setPlatformId(profile.getPlatformId()); + job.setPlatformDisplayName(profile.getPlatformDisplayName()); + job.setCreatedAt(now); + job.setCompletedAt(now); + job.setRequestedBy(accountId); + job.setJobOwner(accountId); + job.setJobInvoker(accountId); + job.setSourceBucketName(sourceBucket); + job.setSourceKey(sourceKey); + job.setSourceVersion(sourceVersion); + job.setDestinationBucketName(destinationBucket); + job.setDestinationPrefix(destinationPrefix); + if (mockSigningJobs) { + job.setStatus("Succeeded"); + job.setSignedObjectBucketName(destinationBucket); + job.setSignedObjectKey(signedObjectKey(destinationPrefix, sourceKey)); + job.setSignatureExpiresAt( + signatureExpiresAt(profile, platformOf(profile.getPlatformId()), now)); + LOG.debugv("Recorded signing job {0} for profile {1} as succeeded, as configured", + jobId, profileName); + } else { + // Nothing signs the artifact, so a succeeded job would advertise a key that is not + // there and every download of it would fail. AWS fails a job the same way, with the + // reason on the job, and Floci keeps that shape rather than an empty success. + job.setStatus("Failed"); + job.setStatusReason("Floci does not sign artifacts: no signed object was written to " + + "s3://" + destinationBucket + "/" + + signedObjectKey(destinationPrefix, sourceKey) + + ". Set floci.services.signer.mock-signing-jobs=true to record jobs as " + + "succeeded without an artifact."); + LOG.debugv("Signing job {0} for profile {1} failed: signing is not emulated", jobId, + profileName); + } + jobs.put(storageKey(region, jobId), job); + return job; + } + + public SigningJob describeSigningJob(String jobId, String region) { + return requireJob(jobId, region); + } + + public Page listSigningJobs(String region, String status, String platformId, + Boolean isRevoked, Integer maxResults, String nextToken) { + if (status != null && !JOB_STATUSES.contains(status)) { + throw validation("status " + status + " is not one of " + JOB_STATUSES + "."); + } + List matching = new ArrayList<>(); + for (SigningJob job : sortedJobs(region)) { + if (status != null && !status.equals(job.getStatus())) { + continue; + } + if (platformId != null && !platformId.equals(job.getPlatformId())) { + continue; + } + if (isRevoked != null && isRevoked.booleanValue() != job.isRevoked()) { + continue; + } + matching.add(job); + } + PaginatedResult page = Pagination.paginate(matching, + SignerService::jobCursor, maxResults, nextToken, MAX_PAGE_SIZE, "ValidationException"); + return new Page<>(page.items(), page.nextToken()); + } + + public SigningJob revokeSignature(String jobId, JsonNode request, String region) { + requireObject(request, "Request payload"); + SigningJob job = requireJob(jobId, region); + String reason = requiredText(request, "reason"); + SignerPlatforms.Platform platform = platformOf(job.getPlatformId()); + if (!platform.revocationSupported()) { + throw validation("Signing platform " + platform.platformId() + + " does not support revocation."); + } + if (!"Succeeded".equals(job.getStatus())) { + throw validation("Signing job " + jobId + " is " + job.getStatus() + + " and has no signature to revoke."); + } + if (job.isRevoked()) { + throw conflict("Signing job " + jobId + " is already revoked."); + } + job.setRevoked(true); + job.setRevocationReason(reason); + job.setRevokedAt(Instant.now().getEpochSecond()); + job.setRevokedBy(jobs.accountId()); + jobs.put(storageKey(region, jobId), job); + return job; + } + + /** + * The revocation status of the signatures a caller asks about. Every signature a Floci job + * records is one Floci did not produce, so nothing this service issued can be revoked: the + * answer is always an empty list, which is what AWS answers for signatures it cannot match. + */ + public List getRevocationStatus() { + return List.of(); + } + + // -------------------------------------------------------------- platforms + + public List listSigningPlatforms(String category) { + if (category != null && !CATEGORIES.contains(category)) { + throw validation("category " + category + " is not one of " + CATEGORIES + "."); + } + if (category == null) { + return SignerPlatforms.all(); + } + return SignerPlatforms.all().stream() + .filter(platform -> platform.category().equals(category)) + .toList(); + } + + public SignerPlatforms.Platform getSigningPlatform(String platformId) { + return SignerPlatforms.find(platformId) + .orElseThrow(() -> notFound("Signing platform " + platformId + " does not exist.")); + } + + // ------------------------------------------------------------------- tags + + /** + * Sets a profile's tags to exactly the given set, which is what CloudFormation does with the + * {@code Tags} property on an update that changed nothing else. Unlike {@link #tagResource}, it + * removes the tags the caller left out. + */ + public void replaceTags(String profileName, Map tags, String region) { + validateProfileName(profileName); + SigningProfile profile = requireProfile(profileName, region); + Map resolved = tags == null ? new LinkedHashMap<>() : new LinkedHashMap<>(tags); + validateTags(resolved); + profile.setTags(resolved); + profiles.put(storageKey(region, profileName), profile); + } + + @Override + public String serviceKey() { + return SERVICE; + } + + @Override + public Map listTags(String region, String arn) { + return new LinkedHashMap<>(requireProfileFromArn(region, arn).getTags()); + } + + @Override + public void tagResource(String region, String arn, Map tags) { + validateTags(tags); + SigningProfile profile = requireProfileFromArn(region, arn); + Map merged = new LinkedHashMap<>(profile.getTags()); + merged.putAll(tags); + if (merged.size() > MAX_TAGS) { + throw validation("A signing profile supports at most " + MAX_TAGS + " tags."); + } + profile.setTags(merged); + profiles.put(storageKey(region, profile.getProfileName()), profile); + } + + @Override + public void untagResource(String region, String arn, List tagKeys) { + SigningProfile profile = requireProfileFromArn(region, arn); + Map remaining = new LinkedHashMap<>(profile.getTags()); + tagKeys.forEach(remaining::remove); + profile.setTags(remaining); + profiles.put(storageKey(region, profile.getProfileName()), profile); + } + + @Override + public void clear() { + profiles.clear(); + jobs.clear(); + } + + // ---------------------------------------------------------------- helpers + + private SigningProfile requireProfile(String profileName, String region) { + return profiles.get(storageKey(region, profileName)) + .orElseThrow(() -> notFound("Signing profile " + profileName + " does not exist.")); + } + + private SigningProfile requireProfileFromArn(String region, String arn) { + AwsArnUtils.Arn parsed; + try { + parsed = AwsArnUtils.parse(arn); + } catch (RuntimeException e) { + throw validation("The ARN " + arn + " is not a signing profile ARN."); + } + if (!SERVICE.equals(parsed.service()) || !region.equals(parsed.region())) { + throw notFound("No signing profile matches the ARN " + arn + " in " + region + "."); + } + if (!profiles.accountId().equals(parsed.accountId())) { + throw notFound("No signing profile matches the ARN " + arn + " in account " + + profiles.accountId() + "."); + } + String resource = parsed.resource().startsWith("/") ? parsed.resource() : "/" + parsed.resource(); + if (!resource.startsWith(PROFILE_RESOURCE)) { + throw validation("The ARN " + arn + " does not identify a signing profile."); + } + return requireProfile(resource.substring(PROFILE_RESOURCE.length()), region); + } + + private SigningJob requireJob(String jobId, String region) { + return jobs.get(storageKey(region, jobId)) + .orElseThrow(() -> notFound("Signing job " + jobId + " does not exist.")); + } + + private List sortedProfiles(String region) { + List result = + profiles.scan(key -> key.startsWith(region + "::")).stream().toList(); + List sorted = new ArrayList<>(result); + sorted.sort((left, right) -> left.getProfileName().compareTo(right.getProfileName())); + return sorted; + } + + private List sortedJobs(String region) { + List result = jobs.scan(key -> key.startsWith(region + "::")).stream().toList(); + List sorted = new ArrayList<>(result); + sorted.sort((left, right) -> { + int byCreation = left.getCreatedAt().compareTo(right.getCreatedAt()); + return byCreation != 0 ? byCreation : left.getJobId().compareTo(right.getJobId()); + }); + return sorted; + } + + private static String storageKey(String region, String id) { + return region + "::" + id; + } + + /** A job's position in the list: its creation time and id, which no two jobs share. */ + private static String jobCursor(SigningJob job) { + return job.getCreatedAt() + ":" + job.getJobId(); + } + + private void validateProfileName(String profileName) { + if (profileName == null || !PROFILE_NAME.matcher(profileName).matches()) { + throw validation("profileName must be 2 to 64 characters from [0-9a-zA-Z_], got " + + profileName + "."); + } + } + + private boolean profileVersionMatches(SigningProfile profile, String profileVersion) { + if (!PROFILE_VERSION.matcher(profileVersion).matches()) { + return false; + } + return profileVersion.equals(profile.getProfileVersion()); + } + + private String newProfileVersion() { + StringBuilder version = new StringBuilder(10); + for (int i = 0; i < 10; i++) { + version.append(ALPHANUMERIC.charAt(random.nextInt(ALPHANUMERIC.length()))); + } + return version.toString(); + } + + private String newRevisionId() { + return UUID.randomUUID().toString(); + } + + /** + * The form the Signer model unmarshals for its timestamp members: epoch seconds, as a JSON + * number. An ISO 8601 string is coerced by the AWS CLI, which hides the mismatch, but every + * strict SDK rejects the whole response, so nothing here emits one. + */ + private static long epochSeconds(Instant instant) { + return instant.getEpochSecond(); + } + + private static String signedObjectKey(String prefix, String sourceKey) { + return prefix == null || prefix.isEmpty() ? sourceKey : prefix + sourceKey; + } + + /** + * When the signature a job produces expires: the profile's validity period, or the one Signer + * applies by default when the profile sets none (135 months, on the platforms that expire + * signatures). A platform whose signatures carry no validity answers nothing. + */ + private static Long signatureExpiresAt(SigningProfile profile, SignerPlatforms.Platform platform, + long now) { + Instant created = Instant.ofEpochSecond(now); + String type = profile.getSignatureValidityPeriodType(); + int value; + if (type == null) { + if (platform.defaultValidityMonths() < 1) { + return null; + } + type = "MONTHS"; + value = platform.defaultValidityMonths(); + } else { + value = profile.getSignatureValidityPeriodValue().intValue(); + } + return switch (type) { + case "DAYS" -> epochSeconds(created.plus(value, ChronoUnit.DAYS)); + case "MONTHS" -> epochSeconds(created.plus(value * 30L, ChronoUnit.DAYS)); + case "YEARS" -> epochSeconds(created.plus(value * 365L, ChronoUnit.DAYS)); + default -> null; + }; + } + + private static SignerPlatforms.Platform platformOf(String platformId) { + return SignerPlatforms.find(platformId) + .orElseThrow(() -> validation("Signing platform " + + platformId + " is not a platform Floci serves.")); + } + + private static String optionalCertificateArn(JsonNode request) { + JsonNode material = request.path("signingMaterial"); + if (material.isMissingNode() || material.isNull()) { + return null; + } + requireObject(material, "signingMaterial"); + String certificateArn = requiredText(material, "certificateArn"); + if (!CERTIFICATE_ARN.matcher(certificateArn).matches()) { + throw validation("signingMaterial.certificateArn must be an ACM certificate ARN, got " + + certificateArn + "."); + } + return certificateArn; + } + + private static String[] optionalValidityPeriod(JsonNode request) { + JsonNode period = request.path("signatureValidityPeriod"); + if (period.isMissingNode() || period.isNull()) { + return new String[] {null, null}; + } + requireObject(period, "signatureValidityPeriod"); + String type = requiredText(period, "type"); + if (!VALIDITY_TYPES.contains(type)) { + throw validation("signatureValidityPeriod.type must be one of " + VALIDITY_TYPES + + ", got " + type + "."); + } + JsonNode valueNode = period.path("value"); + if (!valueNode.isIntegralNumber()) { + throw validation("signatureValidityPeriod.value must be an integer."); + } + int value = valueNode.intValue(); + int maximum = MAX_VALIDITY.get(type).intValue(); + if (value < 1 || value > maximum) { + throw validation("signatureValidityPeriod.value must be between 1 and " + maximum + + " for " + type + ", got " + value + "."); + } + return new String[] {type, String.valueOf(value)}; + } + + private static SignerPlatforms.Platform requirePlatform(String platformId) { + return SignerPlatforms.find(platformId) + .orElseThrow(() -> validation("Signing platform " + + platformId + " is not a platform Floci serves.")); + } + + private static String[] typedValidityPeriod(String type, Integer value) { + if (type == null && value == null) { + return new String[] {null, null}; + } + if (type == null || !VALIDITY_TYPES.contains(type)) { + throw validation("signatureValidityPeriod.type must be one of " + VALIDITY_TYPES + + ", got " + type + "."); + } + if (value == null) { + throw validation("signatureValidityPeriod.value must be an integer."); + } + int maximum = MAX_VALIDITY.get(type).intValue(); + if (value.intValue() < 1 || value.intValue() > maximum) { + throw validation("signatureValidityPeriod.value must be between 1 and " + maximum + + " for " + type + ", got " + value + "."); + } + return new String[] {type, String.valueOf(value)}; + } + + private static JsonNode optionalOverrides(JsonNode request, SignerPlatforms.Platform platform) { + JsonNode overrides = request.path("overrides"); + if (overrides.isMissingNode() || overrides.isNull()) { + return null; + } + requireObject(overrides, "overrides"); + JsonNode configuration = overrides.path("signingConfiguration"); + if (!configuration.isMissingNode() && !configuration.isNull()) { + requireObject(configuration, "overrides.signingConfiguration"); + String hashAlgorithm = optionalText(configuration, "hashAlgorithm"); + if (hashAlgorithm != null && !platform.hashAlgorithms().contains(hashAlgorithm)) { + throw validation("hashAlgorithm " + hashAlgorithm + " is not accepted by platform " + + platform.platformId() + ", which allows " + platform.hashAlgorithms() + "."); + } + String encryptionAlgorithm = optionalText(configuration, "encryptionAlgorithm"); + if (encryptionAlgorithm != null + && !platform.encryptionAlgorithms().contains(encryptionAlgorithm)) { + throw validation("encryptionAlgorithm " + encryptionAlgorithm + + " is not accepted by platform " + platform.platformId() + + ", which allows " + platform.encryptionAlgorithms() + "."); + } + } + String imageFormat = optionalText(overrides, "signingImageFormat"); + if (imageFormat != null && !platform.imageFormats().contains(imageFormat)) { + throw validation("signingImageFormat " + imageFormat + " is not accepted by platform " + + platform.platformId() + ", which allows " + platform.imageFormats() + "."); + } + return overrides; + } + + private static Map optionalStringMap(JsonNode request, String member) { + JsonNode node = request.path(member); + if (node.isMissingNode() || node.isNull()) { + return new LinkedHashMap<>(); + } + requireObject(node, member); + Map values = new LinkedHashMap<>(); + node.fields().forEachRemaining(entry -> { + if (!entry.getValue().isValueNode()) { + throw validation(member + "." + entry.getKey() + " must be a string."); + } + values.put(entry.getKey(), entry.getValue().asText()); + }); + return values; + } + + private static Map optionalTags(JsonNode request) { + JsonNode tags = request.path("tags"); + if (tags.isMissingNode() || tags.isNull()) { + return new LinkedHashMap<>(); + } + Map values = optionalStringMap(request, "tags"); + validateTags(values); + return values; + } + + private static void validateTags(Map tags) { + for (Map.Entry tag : tags.entrySet()) { + String key = tag.getKey() == null ? "" : tag.getKey(); + if (!TAG_KEY.matcher(key).matches()) { + throw validation("Tag key " + key + + " must be 1 to 128 characters and must not use the aws: prefix."); + } + if (tag.getValue() == null || tag.getValue().length() > 256) { + throw validation("Tag value for " + key + " must be at most 256 characters."); + } + } + if (tags.size() > MAX_TAGS) { + throw validation("A signing profile supports at most " + MAX_TAGS + " tags."); + } + } + + private static JsonNode requireObject(JsonNode node, String name) { + if (node == null || !node.isObject()) { + throw validation(name + " must be a JSON object."); + } + return node; + } + + private static String requiredText(JsonNode request, String member) { + String value = optionalText(request, member); + if (value == null) { + throw validation(member + " is required."); + } + return value; + } + + private static String optionalText(JsonNode request, String member) { + JsonNode node = request.path(member); + if (node.isMissingNode() || node.isNull()) { + return null; + } + if (!node.isTextual()) { + throw validation(member + " must be a string."); + } + String value = node.asText(); + if (value.isEmpty()) { + throw validation(member + " must not be empty."); + } + return value; + } + + private static long requiredTimestamp(JsonNode request, String member) { + JsonNode node = request.path(member); + if (node.isMissingNode() || node.isNull()) { + throw validation(member + " is required."); + } + if (node.isNumber()) { + return node.longValue(); + } + if (!node.isTextual()) { + throw validation(member + " must be an ISO 8601 timestamp or epoch seconds."); + } + try { + return Instant.parse(node.asText()).getEpochSecond(); + } catch (RuntimeException e) { + throw validation(member + " must be an ISO 8601 timestamp, got " + node.asText() + "."); + } + } + + private static AwsException validation(String message) { + return new AwsException("ValidationException", message, 400); + } + + private static AwsException notFound(String message) { + return new AwsException("ResourceNotFoundException", message, 404); + } + + private static AwsException conflict(String message) { + return new AwsException("ConflictException", message, 409); + } +} diff --git a/src/main/java/io/floci/aws/services/signer/model/SigningJob.java b/src/main/java/io/floci/aws/services/signer/model/SigningJob.java new file mode 100644 index 0000000000..27bfbe2252 --- /dev/null +++ b/src/main/java/io/floci/aws/services/signer/model/SigningJob.java @@ -0,0 +1,250 @@ +package io.floci.aws.services.signer.model; + +import io.quarkus.runtime.annotations.RegisterForReflection; + +/** + * One {@code StartSigningJob} record, as {@code DescribeSigningJob} and {@code ListSigningJobs} + * report it. + * + *

The job keeps the S3 source, the S3 destination and the profile version it was started + * against. Floci completes a job without signing anything: see {@code SignerService} for what that + * means for the fields a real job would fill in from the signed object. + */ +@RegisterForReflection +public class SigningJob { + + private String jobId; + private String jobArn; + private String clientRequestToken; + private String profileName; + private String profileVersion; + private String platformId; + private String platformDisplayName; + private String status; + private String statusReason; + private Long createdAt; + private Long completedAt; + private Long signatureExpiresAt; + private String requestedBy; + private String jobOwner; + private String jobInvoker; + private String sourceBucketName; + private String sourceKey; + private String sourceVersion; + private String destinationBucketName; + private String destinationPrefix; + private String signedObjectBucketName; + private String signedObjectKey; + private boolean revoked; + private String revocationReason; + private Long revokedAt; + private String revokedBy; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobArn() { + return jobArn; + } + + public void setJobArn(String jobArn) { + this.jobArn = jobArn; + } + + public String getClientRequestToken() { + return clientRequestToken; + } + + public void setClientRequestToken(String clientRequestToken) { + this.clientRequestToken = clientRequestToken; + } + + public String getProfileName() { + return profileName; + } + + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + public String getProfileVersion() { + return profileVersion; + } + + public void setProfileVersion(String profileVersion) { + this.profileVersion = profileVersion; + } + + public String getPlatformId() { + return platformId; + } + + public void setPlatformId(String platformId) { + this.platformId = platformId; + } + + public String getPlatformDisplayName() { + return platformDisplayName; + } + + public void setPlatformDisplayName(String platformDisplayName) { + this.platformDisplayName = platformDisplayName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getStatusReason() { + return statusReason; + } + + public void setStatusReason(String statusReason) { + this.statusReason = statusReason; + } + + public Long getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Long createdAt) { + this.createdAt = createdAt; + } + + public Long getCompletedAt() { + return completedAt; + } + + public void setCompletedAt(Long completedAt) { + this.completedAt = completedAt; + } + + public Long getSignatureExpiresAt() { + return signatureExpiresAt; + } + + public void setSignatureExpiresAt(Long signatureExpiresAt) { + this.signatureExpiresAt = signatureExpiresAt; + } + + public String getRequestedBy() { + return requestedBy; + } + + public void setRequestedBy(String requestedBy) { + this.requestedBy = requestedBy; + } + + public String getJobOwner() { + return jobOwner; + } + + public void setJobOwner(String jobOwner) { + this.jobOwner = jobOwner; + } + + public String getJobInvoker() { + return jobInvoker; + } + + public void setJobInvoker(String jobInvoker) { + this.jobInvoker = jobInvoker; + } + + public String getSourceBucketName() { + return sourceBucketName; + } + + public void setSourceBucketName(String sourceBucketName) { + this.sourceBucketName = sourceBucketName; + } + + public String getSourceKey() { + return sourceKey; + } + + public void setSourceKey(String sourceKey) { + this.sourceKey = sourceKey; + } + + public String getSourceVersion() { + return sourceVersion; + } + + public void setSourceVersion(String sourceVersion) { + this.sourceVersion = sourceVersion; + } + + public String getDestinationBucketName() { + return destinationBucketName; + } + + public void setDestinationBucketName(String destinationBucketName) { + this.destinationBucketName = destinationBucketName; + } + + public String getDestinationPrefix() { + return destinationPrefix; + } + + public void setDestinationPrefix(String destinationPrefix) { + this.destinationPrefix = destinationPrefix; + } + + public String getSignedObjectBucketName() { + return signedObjectBucketName; + } + + public void setSignedObjectBucketName(String signedObjectBucketName) { + this.signedObjectBucketName = signedObjectBucketName; + } + + public String getSignedObjectKey() { + return signedObjectKey; + } + + public void setSignedObjectKey(String signedObjectKey) { + this.signedObjectKey = signedObjectKey; + } + + public boolean isRevoked() { + return revoked; + } + + public void setRevoked(boolean revoked) { + this.revoked = revoked; + } + + public String getRevocationReason() { + return revocationReason; + } + + public void setRevocationReason(String revocationReason) { + this.revocationReason = revocationReason; + } + + public Long getRevokedAt() { + return revokedAt; + } + + public void setRevokedAt(Long revokedAt) { + this.revokedAt = revokedAt; + } + + public String getRevokedBy() { + return revokedBy; + } + + public void setRevokedBy(String revokedBy) { + this.revokedBy = revokedBy; + } +} diff --git a/src/main/java/io/floci/aws/services/signer/model/SigningProfile.java b/src/main/java/io/floci/aws/services/signer/model/SigningProfile.java new file mode 100644 index 0000000000..043749aa63 --- /dev/null +++ b/src/main/java/io/floci/aws/services/signer/model/SigningProfile.java @@ -0,0 +1,244 @@ +package io.floci.aws.services.signer.model; + +import com.fasterxml.jackson.databind.JsonNode; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * One signing profile, as {@code GetSigningProfile} and {@code ListSigningProfiles} report it. + * + *

AWS keeps a version per {@code PutSigningProfile} call, and a profile carries exactly one + * current version. Floci keeps the current version only: {@code profileVersion} and + * {@code profileVersionArn} identify it, and the version fields of {@link ProfilePermission} are the + * version a grant was made against. + */ +@RegisterForReflection +public class SigningProfile { + + /** One grant of a cross-account signing permission on the profile. */ + @RegisterForReflection + public static class ProfilePermission { + private String action; + private String principal; + private String statementId; + private String profileVersion; + + public ProfilePermission() { + } + + public ProfilePermission(String action, String principal, String statementId, String profileVersion) { + this.action = action; + this.principal = principal; + this.statementId = statementId; + this.profileVersion = profileVersion; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getPrincipal() { + return principal; + } + + public void setPrincipal(String principal) { + this.principal = principal; + } + + public String getStatementId() { + return statementId; + } + + public void setStatementId(String statementId) { + this.statementId = statementId; + } + + public String getProfileVersion() { + return profileVersion; + } + + public void setProfileVersion(String profileVersion) { + this.profileVersion = profileVersion; + } + } + + private String profileName; + private String profileVersion; + private String profileVersionArn; + private String arn; + private String platformId; + private String platformDisplayName; + private String signingMaterialCertificateArn; + private String signatureValidityPeriodType; + private Integer signatureValidityPeriodValue; + private JsonNode overrides; + private Map signingParameters = new LinkedHashMap<>(); + private Map tags = new LinkedHashMap<>(); + private String status; + private String statusReason; + private Long revocationEffectiveFrom; + private Long revokedAt; + private String revokedBy; + private String revisionId; + private List permissions = new ArrayList<>(); + + public String getProfileName() { + return profileName; + } + + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + public String getProfileVersion() { + return profileVersion; + } + + public void setProfileVersion(String profileVersion) { + this.profileVersion = profileVersion; + } + + public String getProfileVersionArn() { + return profileVersionArn; + } + + public void setProfileVersionArn(String profileVersionArn) { + this.profileVersionArn = profileVersionArn; + } + + public String getArn() { + return arn; + } + + public void setArn(String arn) { + this.arn = arn; + } + + public String getPlatformId() { + return platformId; + } + + public void setPlatformId(String platformId) { + this.platformId = platformId; + } + + public String getPlatformDisplayName() { + return platformDisplayName; + } + + public void setPlatformDisplayName(String platformDisplayName) { + this.platformDisplayName = platformDisplayName; + } + + public String getSigningMaterialCertificateArn() { + return signingMaterialCertificateArn; + } + + public void setSigningMaterialCertificateArn(String signingMaterialCertificateArn) { + this.signingMaterialCertificateArn = signingMaterialCertificateArn; + } + + public String getSignatureValidityPeriodType() { + return signatureValidityPeriodType; + } + + public void setSignatureValidityPeriodType(String signatureValidityPeriodType) { + this.signatureValidityPeriodType = signatureValidityPeriodType; + } + + public Integer getSignatureValidityPeriodValue() { + return signatureValidityPeriodValue; + } + + public void setSignatureValidityPeriodValue(Integer signatureValidityPeriodValue) { + this.signatureValidityPeriodValue = signatureValidityPeriodValue; + } + + public JsonNode getOverrides() { + return overrides; + } + + public void setOverrides(JsonNode overrides) { + this.overrides = overrides; + } + + public Map getSigningParameters() { + return signingParameters; + } + + public void setSigningParameters(Map signingParameters) { + this.signingParameters = signingParameters == null ? new LinkedHashMap<>() : signingParameters; + } + + public Map getTags() { + return tags; + } + + public void setTags(Map tags) { + this.tags = tags == null ? new LinkedHashMap<>() : tags; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getStatusReason() { + return statusReason; + } + + public void setStatusReason(String statusReason) { + this.statusReason = statusReason; + } + + public Long getRevocationEffectiveFrom() { + return revocationEffectiveFrom; + } + + public void setRevocationEffectiveFrom(Long revocationEffectiveFrom) { + this.revocationEffectiveFrom = revocationEffectiveFrom; + } + + public Long getRevokedAt() { + return revokedAt; + } + + public void setRevokedAt(Long revokedAt) { + this.revokedAt = revokedAt; + } + + public String getRevokedBy() { + return revokedBy; + } + + public void setRevokedBy(String revokedBy) { + this.revokedBy = revokedBy; + } + + public String getRevisionId() { + return revisionId; + } + + public void setRevisionId(String revisionId) { + this.revisionId = revisionId; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions == null ? new ArrayList<>() : permissions; + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d5b25fffb5..f541ba51a4 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1076,6 +1076,8 @@ floci: enabled: true dlm: enabled: true + signer: + enabled: true cognitoidentity: enabled: true globalaccelerator: diff --git a/src/main/resources/aws/iam-authorized-actions.json b/src/main/resources/aws/iam-authorized-actions.json index cd94c1dcad..004276edc8 100644 --- a/src/main/resources/aws/iam-authorized-actions.json +++ b/src/main/resources/aws/iam-authorized-actions.json @@ -2,8 +2,8 @@ "_source": { "generator": "tools/aws/regen_iam_authorized_actions.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", - "retrieved": "2026-11-04", - "note": "make iam-authorized-actions-verify checks every entry against AWS. QuickSight actions without resource types added from its AWS Service Reference on 2026-11-05; other entries retain their vendored snapshot." + "retrieved": "2026-11-08", + "note": "make iam-authorized-actions-verify checks every entry against AWS." }, "authorizedActions": { "access-analyzer": { @@ -157,6 +157,10 @@ "UpdateNotification": "budgets:ModifyBudget", "UpdateSubscriber": "budgets:ModifyBudget" }, + "cases": { + "BatchCreateRelatedItem": "cases:CreateRelatedItem", + "BatchUpdateCase": "cases:UpdateCase" + }, "cassandra": { "GetKeyspace": "cassandra:Select", "GetTable": "cassandra:Select", @@ -439,12 +443,14 @@ "quicksight": [ "AccountConfigurations", "AllowVendedLogDeliveryForResource", + "AuthorizeOAuthAccess", "BatchGetPreferences", "BatchUpdatePreferences", "CreateAccountCustomization", "CreateAccountSubscription", "CreateDataSource", "CreateOAuthClientApplication", + "CreateOAuthToken", "CreateRoleMembership", "CreateVPCConnection", "DeleteAccountCustomPermission", @@ -465,6 +471,7 @@ "DescribeQPersonalizationConfiguration", "DescribeQuickIndexCapacity", "DescribeQuickSightQSearchConfiguration", + "DescribeResourcePermissions", "DescribeRoleCustomPermission", "DescribeSelfUpgradeConfiguration", "GenerateEmbedUrlForRegisteredUserWithIdentity", @@ -472,6 +479,7 @@ "GetCustomPermissionsSummary", "GetGroupMapping", "GetSessionEmbedUrl", + "ListAccessControlApplications", "ListActionConnectors", "ListBrands", "ListCustomPermissionAssignments", @@ -484,6 +492,7 @@ "ListExtensions", "ListFlows", "ListIdentityPropagationConfigs", + "ListInboundConnectors", "ListIngestions", "ListKMSKeysForUser", "ListKnowledgeBases", @@ -500,6 +509,7 @@ "QuickSuiteUsageMetrics", "RegisterCustomerManagedKey", "RemoveCustomerManagedKey", + "RevokeOAuthToken", "ScopeDownPolicy", "SearchDirectoryGroups", "SearchFlows", @@ -531,6 +541,13 @@ "ListScheduleGroups", "ListSchedules", "ListSchedulesByTarget" + ], + "signer": [ + "GetSigningPlatform", + "ListSigningJobs", + "ListSigningPlatforms", + "ListSigningProfiles", + "PutSigningProfile" ] } } diff --git a/src/main/resources/aws/iam-request-resources.json b/src/main/resources/aws/iam-request-resources.json index decbe1fd27..7cf58636a3 100644 --- a/src/main/resources/aws/iam-request-resources.json +++ b/src/main/resources/aws/iam-request-resources.json @@ -1,11 +1,11 @@ { - "_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-07", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."}, - "namespaces": {"access-analyzer": ["accessanalyzer"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "rekognition": ["rekognition"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]}, + "_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-09", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."}, + "namespaces": {"access-analyzer": ["accessanalyzer"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "rekognition": ["rekognition"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]}, "clientsNotRead": {"kinesisanalytics": "Kinesis Data Analytics v1, SQL applications on the KinesisAnalytics_20150814 target, which Floci does not serve (it serves v2, kinesisanalyticsv2); its operations share v2's names and name their resources by other members"}, "handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts"], "notCovered": {"account": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup::autoScalingGroupName/`, while Floci mints `autoScalingGroup:`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rule does not fill a name from, so nearly every operation needs a correction", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/_, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "controltower": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2-instance-connect": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, `environment//`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "execute-api": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "fis": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "guardduty": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "inspector2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "iot": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "kafka": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "lightsail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "macie2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "memorydb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "mq": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "network-firewall": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "oam": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "organizations": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ram": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "rds": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds-data": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "redshift-serverless": "not read yet: its namespace, workgroup, snapshot and managed VPC endpoint ARNs end in an id the service mints, `namespace/`, while its requests name them by namespaceName, workgroupName, snapshotName and endpointName, so reading it needs the stored ARNs those find, as Redshift Data's workgroups are found", "resource-explorer-2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "route53": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "route53resolver": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rum": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "s3tables": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "s3vectors": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "sagemaker": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "securityhub": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "servicecatalog": "not read yet: CreatePortfolioShare, UpdatePortfolioShare and DeletePortfolioShare give in AccountId the account a portfolio is shared with, which the rule reads as the portfolio's; a portfolio or product imported from another account keeps its owner's account in its ARN while requests name it by its id alone; and AppRegistry's applications and attribute groups are named in the path", "ses": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "signin": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "sso-oauth": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "swf": "not read yet: the Service Reference gives a domain's ARN no Region, `swf:::/domain/`, while the SWF Developer Guide gives it as arn:aws:swf:Region:AccountID:/domain/DomainName, as Floci mints it; reading it needs that format corrected", "transcribe": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transfer": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "verifiedpermissions": "not read yet: a policyStoreId may name its store by an alias, `policy-store-alias/`, which AWS authorizes as the action on the store the alias points to and GetPolicyStoreAlias on the alias, and an aliasName carries the `policy-store-alias/` its format already gives; reading it needs both", "wafv2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"}, - "otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudfront-keyvaluestore", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "signer", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web", "xray"], - "arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Region}:${Account}:trail/${TrailName}"}, "codebuild": {"build": "arn:${Partition}:codebuild:${Region}:${Account}:build/${BuildId}", "build-batch": "arn:${Partition}:codebuild:${Region}:${Account}:build-batch/${BuildBatchId}", "fleet": "arn:${Partition}:codebuild:${Region}:${Account}:fleet/${FleetName}:${FleetId}", "project": "arn:${Partition}:codebuild:${Region}:${Account}:project/${ProjectName}", "report": "arn:${Partition}:codebuild:${Region}:${Account}:report/${ReportGroupName}:${ReportId}", "report-group": "arn:${Partition}:codebuild:${Region}:${Account}:report-group/${ReportGroupName}", "sandbox": "arn:${Partition}:codebuild:${Region}:${Account}:sandbox/${SandboxId}"}, "codepipeline": {"action": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}/${ActionName}", "actiontype": "arn:${Partition}:codepipeline:${Region}:${Account}:actiontype:${Owner}/${Category}/${Provider}/${Version}", "pipeline": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}", "stage": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}", "webhook": "arn:${Partition}:codepipeline:${Region}:${Account}:webhook:${WebhookName}"}, "cognito-identity": {"identitypool": "arn:${Partition}:cognito-identity:${Region}:${Account}:identitypool/${IdentityPoolId}"}, "cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "cur": {"cur": "arn:${Partition}:cur:${Region}:${Account}:definition/${ReportName}"}, "datasync": {"agent": "arn:${Partition}:datasync:${Region}:${Account}:agent/${AgentId}", "discoveryjob": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}/job/${DiscoveryJobId}", "location": "arn:${Partition}:datasync:${Region}:${Account}:location/${LocationId}", "storagesystem": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}", "task": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}", "taskexecution": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}/execution/${ExecutionId}"}, "dynamodb": {"backup": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/backup/${BackupName}", "bulk-operation": "arn:${Partition}:dynamodb:${Region}:${Account}:bulk-operation/${BulkOperationId}", "export": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/export/${ExportName}", "global-table": "arn:${Partition}:dynamodb::${Account}:global-table/${GlobalTableName}", "import": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/import/${ImportName}", "index": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/index/${IndexName}", "stream": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/stream/${StreamLabel}", "table": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "loadbalancer": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/${LoadBalancerName}", "loadbalancer/app/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/app/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/gwy/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/gwy/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/net/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/net/${LoadBalancerName}/${LoadBalancerId}", "targetgroup": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:targetgroup/${TargetGroupName}/${TargetGroupId}", "truststore": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:truststore/${TrustStoreName}/${TrustStoreId}"}, "elasticmapreduce": {"cluster": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:cluster/${ClusterId}", "editor": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:editor/${EditorId}", "notebook-execution": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:notebook-execution/${NotebookExecutionId}", "session": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:cluster/${ClusterId}/session/${SessionId}", "studio": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:studio/${StudioId}"}, "es": {"application": "arn:${Partition}:opensearch:${Region}:${Account}:application/${AppId}", "datasource": "arn:${Partition}:opensearch:${Region}:${Account}:datasource/${DataSourceName}", "domain": "arn:${Partition}:es:${Region}:${Account}:domain/${DomainName}", "es_role": "arn:${Partition}:iam::${Account}:role/aws-service-role/es.amazonaws.com/AWSServiceRoleForAmazonOpenSearchService", "opensearchservice_role": "arn:${Partition}:iam::${Account}:role/aws-service-role/opensearchservice.amazonaws.com/AWSServiceRoleForAmazonOpenSearchService"}, "events": {"alias": "arn:${Partition}:kms:${Region}:${Account}:alias/${Alias}", "api-destination": "arn:${Partition}:events:${Region}:${Account}:api-destination/${ApiDestinationName}", "archive": "arn:${Partition}:events:${Region}:${Account}:archive/${ArchiveName}", "connection": "arn:${Partition}:events:${Region}:${Account}:connection/${ConnectionName}", "create-snapshot": "arn:${Partition}:events:${Region}:${Account}:target/create-snapshot", "endpoint": "arn:${Partition}:events:${Region}:${Account}:endpoint/${EndpointName}", "event-bus": "arn:${Partition}:events:${Region}:${Account}:event-bus/${EventBusName}", "event-busv2": "arn:${Partition}:events:${Region}:${Account}:event-busv2/${EventBusName}/${OpaqueId}", "event-source": "arn:${Partition}:events:${Region}::event-source/${EventSourceName}", "event-sourcev2": "arn:${Partition}:events:${Region}:${Account}:event-sourcev2/${SourceType}/${EventSourceName}/${OpaqueId}", "key": "arn:${Partition}:kms:${Region}:${Account}:key/${KeyId}", "reboot-instance": "arn:${Partition}:events:${Region}:${Account}:target/reboot-instance", "replay": "arn:${Partition}:events:${Region}:${Account}:replay/${ReplayName}", "rule-on-custom-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${EventBusName}/${RuleName}", "rule-on-default-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${RuleName}", "stop-instance": "arn:${Partition}:events:${Region}:${Account}:target/stop-instance", "subscriber": "arn:${Partition}:events:${Region}:${Account}:subscriber/${SubscriberName}/${OpaqueId}", "terminate-instance": "arn:${Partition}:events:${Region}:${Account}:target/terminate-instance"}, "firehose": {"deliverystream": "arn:${Partition}:firehose:${Region}:${Account}:deliverystream/${DeliveryStreamName}"}, "globalaccelerator": {"accelerator": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}", "attachment": "arn:${Partition}:globalaccelerator::${Account}:attachment/${ResourceId}", "endpointgroup": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}/listener/${ListenerId}/endpoint-group/${EndpointGroupId}", "listener": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}/listener/${ListenerId}"}, "kinesisanalytics": {"application": "arn:${Partition}:kinesisanalytics:${Region}:${Account}:application/${ApplicationName}"}, "logs": {"anomaly-detector": "arn:${Partition}:logs:${Region}:${Account}:anomaly-detector:${DetectorId}", "delivery": "arn:${Partition}:logs:${Region}:${Account}:delivery:${DeliveryName}", "delivery-destination": "arn:${Partition}:logs:${Region}:${Account}:delivery-destination:${DeliveryDestinationName}", "delivery-source": "arn:${Partition}:logs:${Region}:${Account}:delivery-source:${DeliverySourceName}", "destination": "arn:${Partition}:logs:${Region}:${Account}:destination:${DestinationName}", "log-group": "arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}", "log-stream": "arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}", "lookup-table": "arn:${Partition}:logs:${Region}:${Account}:lookup-table:${LookupTableName}", "scheduled-query": "arn:${Partition}:logs:${Region}:${Account}:scheduled-query:${ScheduledQueryId}"}, "payment-cryptography": {"alias": "arn:${Partition}:payment-cryptography:${Region}:${Account}:alias/${Alias}", "approval-team": "arn:${Partition}:mpa:${Region}:${Account}:approval-team/${ApprovalTeamId}", "key": "arn:${Partition}:payment-cryptography:${Region}:${Account}:key/${KeyId}"}, "quicksight": {"accessControlApplication": "arn:${Partition}:quicksight:${Region}:${Account}:access-control-application/${ResourceId}", "account": "arn:${Partition}:quicksight:${Region}:${Account}:account/${ResourceId}", "actionconnector": "arn:${Partition}:quicksight:${Region}:${Account}:action-connector/${ResourceId}", "agent": "arn:${Partition}:quicksight:${Region}:${Account}:agent/${ResourceId}", "analysis": "arn:${Partition}:quicksight:${Region}:${Account}:analysis/${ResourceId}", "app": "arn:${Partition}:quicksight:${Region}:${Account}:app/${ResourceId}", "approvalPolicy": "arn:${Partition}:quicksight:${Region}:${Account}:approval-policy/${ResourceId}", "assetBundleExportJob": "arn:${Partition}:quicksight:${Region}:${Account}:asset-bundle-export-job/${ResourceId}", "assetBundleImportJob": "arn:${Partition}:quicksight:${Region}:${Account}:asset-bundle-import-job/${ResourceId}", "assignment": "arn:${Partition}:quicksight::${Account}:assignment/${ResourceId}", "automation": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${AutomationGroupId}/automation/${ResourceId}", "automationGroup": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${ResourceId}", "automationJob": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${AutomationGroupId}/automation/${AutomationId}/job/${ResourceId}", "brand": "arn:${Partition}:quicksight:${Region}:${Account}:brand/${ResourceId}", "customization": "arn:${Partition}:quicksight:${Region}:${Account}:customization/${ResourceId}", "custompermissions": "arn:${Partition}:quicksight:${Region}:${Account}:custompermissions/${ResourceId}", "dashboard": "arn:${Partition}:quicksight:${Region}:${Account}:dashboard/${ResourceId}", "dashboardSnapshotJob": "arn:${Partition}:quicksight:${Region}:${Account}:dashboard/${DashboardId}/snapshot-job/${ResourceId}", "dataset": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${ResourceId}", "datasource": "arn:${Partition}:quicksight:${Region}:${Account}:datasource/${ResourceId}", "dlpSetting": "arn:${Partition}:quicksight:${Region}:${Account}:dlpsetting/${ResourceId}", "emailCustomizationTemplate": "arn:${Partition}:quicksight:${Region}:${Account}:email-customization-template/${ResourceId}", "extension": "arn:${Partition}:quicksight:${Region}:${Account}:extension/${ResourceId}", "extensionaccess": "arn:${Partition}:quicksight:${Region}:${Account}:extension-access/${ResourceId}", "flow": "arn:${Partition}:quicksight:${Region}:${Account}:flow/${ResourceId}", "folder": "arn:${Partition}:quicksight:${Region}:${Account}:folder/${ResourceId}", "group": "arn:${Partition}:quicksight:${Region}:${Account}:group/${ResourceId}", "inboundConnector": "arn:${Partition}:quicksight:${Region}:${Account}:inbound-connector/${ResourceId}", "ingestion": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${DatasetId}/ingestion/${ResourceId}", "knowledgeBase": "arn:${Partition}:quicksight:${Region}:${Account}:knowledge-base/${ResourceId}", "limitsProfile": "arn:${Partition}:quicksight:${Region}:${Account}:limits-profile/${ResourceId}", "namespace": "arn:${Partition}:quicksight:${Region}:${Account}:namespace/${ResourceId}", "oauthClientApplication": "arn:${Partition}:quicksight:${Region}:${Account}:oauthClientApplication/${ResourceId}", "refreshschedule": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${DatasetId}/refresh-schedule/${ResourceId}", "space": "arn:${Partition}:quicksight:${Region}:${Account}:space/${ResourceId}", "template": "arn:${Partition}:quicksight:${Region}:${Account}:template/${ResourceId}", "theme": "arn:${Partition}:quicksight:${Region}:${Account}:theme/${ResourceId}", "topic": "arn:${Partition}:quicksight:${Region}:${Account}:topic/${ResourceId}", "user": "arn:${Partition}:quicksight:${Region}:${Account}:user/${ResourceId}", "vpcconnection": "arn:${Partition}:quicksight:${Region}:${Account}:vpcConnection/${ResourceId}"}, "redshift": {"cluster": "arn:${Partition}:redshift:${Region}:${Account}:cluster:${ClusterName}", "datashare": "arn:${Partition}:redshift:${Region}:${Account}:datashare:${ProducerClusterNamespace}/${DataShareName}", "dbgroup": "arn:${Partition}:redshift:${Region}:${Account}:dbgroup:${ClusterName}/${DbGroup}", "dbname": "arn:${Partition}:redshift:${Region}:${Account}:dbname:${ClusterName}/${DbName}", "dbuser": "arn:${Partition}:redshift:${Region}:${Account}:dbuser:${ClusterName}/${DbUser}", "eventsubscription": "arn:${Partition}:redshift:${Region}:${Account}:eventsubscription:${EventSubscriptionName}", "hsmclientcertificate": "arn:${Partition}:redshift:${Region}:${Account}:hsmclientcertificate:${HSMClientCertificateId}", "hsmconfiguration": "arn:${Partition}:redshift:${Region}:${Account}:hsmconfiguration:${HSMConfigurationId}", "integration": "arn:${Partition}:redshift:${Region}:${Account}:integration:${IntegrationIdentifier}", "namespace": "arn:${Partition}:redshift:${Region}:${Account}:namespace:${ClusterNamespace}", "parametergroup": "arn:${Partition}:redshift:${Region}:${Account}:parametergroup:${ParameterGroupName}", "qev2idcapplication": "arn:${Partition}:redshift:${Region}:${Account}:qev2idcapplication:${Qev2IdcApplicationId}", "redshiftidcapplication": "arn:${Partition}:redshift:${Region}:${Account}:redshiftidcapplication:${RedshiftIdcApplicationId}", "securitygroup": "arn:${Partition}:redshift:${Region}:${Account}:securitygroup:${SecurityGroupName}/ec2securitygroup/${Owner}/${Ec2SecurityGroupId}", "securitygroupingress-cidr": "arn:${Partition}:redshift:${Region}:${Account}:securitygroupingress:${SecurityGroupName}/cidrip/${IpRange}", "securitygroupingress-ec2securitygroup": "arn:${Partition}:redshift:${Region}:${Account}:securitygroupingress:${SecurityGroupName}/ec2securitygroup/${Owner}/${Ece2SecuritygroupId}", "snapshot": "arn:${Partition}:redshift:${Region}:${Account}:snapshot:${ClusterName}/${SnapshotName}", "snapshotcopygrant": "arn:${Partition}:redshift:${Region}:${Account}:snapshotcopygrant:${SnapshotCopyGrantName}", "snapshotschedule": "arn:${Partition}:redshift:${Region}:${Account}:snapshotschedule:${ScheduleIdentifier}", "subnetgroup": "arn:${Partition}:redshift:${Region}:${Account}:subnetgroup:${SubnetGroupName}", "usagelimit": "arn:${Partition}:redshift:${Region}:${Account}:usagelimit:${UsageLimitId}"}, "redshift-data": {"cluster": "arn:${Partition}:redshift:${Region}:${Account}:cluster:${ClusterName}", "managed-workgroup": "arn:${Partition}:redshift-serverless:${Region}:${Account}:managed-workgroup/${ManagedWorkgroupId}", "workgroup": "arn:${Partition}:redshift-serverless:${Region}:${Account}:workgroup/${WorkgroupId}"}, "rekognition": {"collection": "arn:${Partition}:rekognition:${Region}:${Account}:collection/${CollectionId}", "dataset": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/dataset/${DatasetType}/${CreationTimestamp}", "project": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/${CreationTimestamp}", "projectversion": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/version/${VersionName}/${CreationTimestamp}", "streamprocessor": "arn:${Partition}:rekognition:${Region}:${Account}:streamprocessor/${StreamprocessorId}"}, "servicediscovery": {"namespace": "arn:${Partition}:servicediscovery:${Region}:${Account}:namespace/${NamespaceId}", "service": "arn:${Partition}:servicediscovery:${Region}:${Account}:service/${ServiceId}"}, "servicequotas": {"quota": "arn:${Partition}:servicequotas:${Region}:${Account}:${ServiceCode}/${QuotaCode}"}, "sso": {"Account": "arn:${Partition}:sso:::account/${AccountId}", "Application": "arn:${Partition}:sso::${Account}:application/${InstanceId}/${ApplicationId}", "ApplicationProvider": "arn:${Partition}:sso::aws:applicationProvider/${ApplicationProviderId}", "Instance": "arn:${Partition}:sso:::instance/${InstanceId}", "PermissionSet": "arn:${Partition}:sso:::permissionSet/${InstanceId}/${PermissionSetId}", "TrustedTokenIssuer": "arn:${Partition}:sso::${Account}:trustedTokenIssuer/${InstanceId}/${TrustedTokenIssuerId}"}, "states": {"activity": "arn:${Partition}:states:${Region}:${Account}:activity:${ActivityName}", "execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}:${ExecutionId}", "express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}:${ExecutionId}:${ExpressId}", "labelled execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}/${MapRunLabel}:${ExecutionId}", "labelled express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}/${MapRunLabel}:${ExecutionId}:${ExpressId}", "maprun": "arn:${Partition}:states:${Region}:${Account}:mapRun:${StateMachineName}/${MapRunLabel}:${MapRunId}", "statemachine": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}", "statemachinealias": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineAliasName}", "statemachineversion": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineVersionId}"}, "textract": {"adapter": "arn:${Partition}:textract:${Region}:${Account}:/adapters/${AdapterId}", "adapterversion": "arn:${Partition}:textract:${Region}:${Account}:/adapters/${AdapterId}/versions/${AdapterVersion}"}, "timestream-influxdb": {"db-backup": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-backup/${DbBackupId}", "db-cluster": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-cluster/${DbClusterId}", "db-instance": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-instance/${DbInstanceIdentifier}", "db-parameter-group": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-parameter-group/${DbParameterGroupIdentifier}"}, "translate": {"parallel-data": "arn:${Partition}:translate:${Region}:${Account}:parallel-data/${ResourceName}", "terminology": "arn:${Partition}:translate:${Region}:${Account}:terminology/${ResourceName}"}}, + "otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudfront-keyvaluestore", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web", "xray"], + "arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Region}:${Account}:trail/${TrailName}"}, "codebuild": {"build": "arn:${Partition}:codebuild:${Region}:${Account}:build/${BuildId}", "build-batch": "arn:${Partition}:codebuild:${Region}:${Account}:build-batch/${BuildBatchId}", "fleet": "arn:${Partition}:codebuild:${Region}:${Account}:fleet/${FleetName}:${FleetId}", "project": "arn:${Partition}:codebuild:${Region}:${Account}:project/${ProjectName}", "report": "arn:${Partition}:codebuild:${Region}:${Account}:report/${ReportGroupName}:${ReportId}", "report-group": "arn:${Partition}:codebuild:${Region}:${Account}:report-group/${ReportGroupName}", "sandbox": "arn:${Partition}:codebuild:${Region}:${Account}:sandbox/${SandboxId}"}, "codepipeline": {"action": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}/${ActionName}", "actiontype": "arn:${Partition}:codepipeline:${Region}:${Account}:actiontype:${Owner}/${Category}/${Provider}/${Version}", "pipeline": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}", "stage": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}", "webhook": "arn:${Partition}:codepipeline:${Region}:${Account}:webhook:${WebhookName}"}, "cognito-identity": {"identitypool": "arn:${Partition}:cognito-identity:${Region}:${Account}:identitypool/${IdentityPoolId}"}, "cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "cur": {"cur": "arn:${Partition}:cur:${Region}:${Account}:definition/${ReportName}"}, "datasync": {"agent": "arn:${Partition}:datasync:${Region}:${Account}:agent/${AgentId}", "discoveryjob": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}/job/${DiscoveryJobId}", "location": "arn:${Partition}:datasync:${Region}:${Account}:location/${LocationId}", "storagesystem": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}", "task": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}", "taskexecution": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}/execution/${ExecutionId}"}, "dynamodb": {"backup": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/backup/${BackupName}", "bulk-operation": "arn:${Partition}:dynamodb:${Region}:${Account}:bulk-operation/${BulkOperationId}", "export": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/export/${ExportName}", "global-table": "arn:${Partition}:dynamodb::${Account}:global-table/${GlobalTableName}", "import": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/import/${ImportName}", "index": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/index/${IndexName}", "stream": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/stream/${StreamLabel}", "table": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "loadbalancer": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/${LoadBalancerName}", "loadbalancer/app/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/app/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/gwy/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/gwy/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/net/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/net/${LoadBalancerName}/${LoadBalancerId}", "targetgroup": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:targetgroup/${TargetGroupName}/${TargetGroupId}", "truststore": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:truststore/${TrustStoreName}/${TrustStoreId}"}, "elasticmapreduce": {"cluster": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:cluster/${ClusterId}", "editor": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:editor/${EditorId}", "notebook-execution": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:notebook-execution/${NotebookExecutionId}", "session": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:cluster/${ClusterId}/session/${SessionId}", "studio": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:studio/${StudioId}"}, "es": {"application": "arn:${Partition}:opensearch:${Region}:${Account}:application/${AppId}", "datasource": "arn:${Partition}:opensearch:${Region}:${Account}:datasource/${DataSourceName}", "domain": "arn:${Partition}:es:${Region}:${Account}:domain/${DomainName}", "es_role": "arn:${Partition}:iam::${Account}:role/aws-service-role/es.amazonaws.com/AWSServiceRoleForAmazonOpenSearchService", "opensearchservice_role": "arn:${Partition}:iam::${Account}:role/aws-service-role/opensearchservice.amazonaws.com/AWSServiceRoleForAmazonOpenSearchService"}, "events": {"alias": "arn:${Partition}:kms:${Region}:${Account}:alias/${Alias}", "api-destination": "arn:${Partition}:events:${Region}:${Account}:api-destination/${ApiDestinationName}", "archive": "arn:${Partition}:events:${Region}:${Account}:archive/${ArchiveName}", "connection": "arn:${Partition}:events:${Region}:${Account}:connection/${ConnectionName}", "create-snapshot": "arn:${Partition}:events:${Region}:${Account}:target/create-snapshot", "endpoint": "arn:${Partition}:events:${Region}:${Account}:endpoint/${EndpointName}", "event-bus": "arn:${Partition}:events:${Region}:${Account}:event-bus/${EventBusName}", "event-busv2": "arn:${Partition}:events:${Region}:${Account}:event-busv2/${EventBusName}/${OpaqueId}", "event-source": "arn:${Partition}:events:${Region}::event-source/${EventSourceName}", "event-sourcev2": "arn:${Partition}:events:${Region}:${Account}:event-sourcev2/${SourceType}/${EventSourceName}/${OpaqueId}", "key": "arn:${Partition}:kms:${Region}:${Account}:key/${KeyId}", "reboot-instance": "arn:${Partition}:events:${Region}:${Account}:target/reboot-instance", "replay": "arn:${Partition}:events:${Region}:${Account}:replay/${ReplayName}", "rule-on-custom-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${EventBusName}/${RuleName}", "rule-on-default-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${RuleName}", "stop-instance": "arn:${Partition}:events:${Region}:${Account}:target/stop-instance", "subscriber": "arn:${Partition}:events:${Region}:${Account}:subscriber/${SubscriberName}/${OpaqueId}", "terminate-instance": "arn:${Partition}:events:${Region}:${Account}:target/terminate-instance"}, "firehose": {"deliverystream": "arn:${Partition}:firehose:${Region}:${Account}:deliverystream/${DeliveryStreamName}"}, "globalaccelerator": {"accelerator": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}", "attachment": "arn:${Partition}:globalaccelerator::${Account}:attachment/${ResourceId}", "endpointgroup": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}/listener/${ListenerId}/endpoint-group/${EndpointGroupId}", "listener": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}/listener/${ListenerId}"}, "kinesisanalytics": {"application": "arn:${Partition}:kinesisanalytics:${Region}:${Account}:application/${ApplicationName}"}, "logs": {"anomaly-detector": "arn:${Partition}:logs:${Region}:${Account}:anomaly-detector:${DetectorId}", "delivery": "arn:${Partition}:logs:${Region}:${Account}:delivery:${DeliveryName}", "delivery-destination": "arn:${Partition}:logs:${Region}:${Account}:delivery-destination:${DeliveryDestinationName}", "delivery-source": "arn:${Partition}:logs:${Region}:${Account}:delivery-source:${DeliverySourceName}", "destination": "arn:${Partition}:logs:${Region}:${Account}:destination:${DestinationName}", "log-group": "arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}", "log-stream": "arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}", "lookup-table": "arn:${Partition}:logs:${Region}:${Account}:lookup-table:${LookupTableName}", "scheduled-query": "arn:${Partition}:logs:${Region}:${Account}:scheduled-query:${ScheduledQueryId}"}, "payment-cryptography": {"alias": "arn:${Partition}:payment-cryptography:${Region}:${Account}:alias/${Alias}", "approval-team": "arn:${Partition}:mpa:${Region}:${Account}:approval-team/${ApprovalTeamId}", "key": "arn:${Partition}:payment-cryptography:${Region}:${Account}:key/${KeyId}"}, "quicksight": {"accessControlApplication": "arn:${Partition}:quicksight:${Region}:${Account}:access-control-application/${ResourceId}", "account": "arn:${Partition}:quicksight:${Region}:${Account}:account/${ResourceId}", "actionconnector": "arn:${Partition}:quicksight:${Region}:${Account}:action-connector/${ResourceId}", "agent": "arn:${Partition}:quicksight:${Region}:${Account}:agent/${ResourceId}", "analysis": "arn:${Partition}:quicksight:${Region}:${Account}:analysis/${ResourceId}", "app": "arn:${Partition}:quicksight:${Region}:${Account}:app/${ResourceId}", "approvalPolicy": "arn:${Partition}:quicksight:${Region}:${Account}:approval-policy/${ResourceId}", "assetBundleExportJob": "arn:${Partition}:quicksight:${Region}:${Account}:asset-bundle-export-job/${ResourceId}", "assetBundleImportJob": "arn:${Partition}:quicksight:${Region}:${Account}:asset-bundle-import-job/${ResourceId}", "assignment": "arn:${Partition}:quicksight::${Account}:assignment/${ResourceId}", "automation": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${AutomationGroupId}/automation/${ResourceId}", "automationGroup": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${ResourceId}", "automationJob": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${AutomationGroupId}/automation/${AutomationId}/job/${ResourceId}", "brand": "arn:${Partition}:quicksight:${Region}:${Account}:brand/${ResourceId}", "customization": "arn:${Partition}:quicksight:${Region}:${Account}:customization/${ResourceId}", "custompermissions": "arn:${Partition}:quicksight:${Region}:${Account}:custompermissions/${ResourceId}", "dashboard": "arn:${Partition}:quicksight:${Region}:${Account}:dashboard/${ResourceId}", "dashboardSnapshotJob": "arn:${Partition}:quicksight:${Region}:${Account}:dashboard/${DashboardId}/snapshot-job/${ResourceId}", "dataset": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${ResourceId}", "datasource": "arn:${Partition}:quicksight:${Region}:${Account}:datasource/${ResourceId}", "dlpSetting": "arn:${Partition}:quicksight:${Region}:${Account}:dlpsetting/${ResourceId}", "emailCustomizationTemplate": "arn:${Partition}:quicksight:${Region}:${Account}:email-customization-template/${ResourceId}", "extension": "arn:${Partition}:quicksight:${Region}:${Account}:extension/${ResourceId}", "extensionaccess": "arn:${Partition}:quicksight:${Region}:${Account}:extension-access/${ResourceId}", "flow": "arn:${Partition}:quicksight:${Region}:${Account}:flow/${ResourceId}", "folder": "arn:${Partition}:quicksight:${Region}:${Account}:folder/${ResourceId}", "group": "arn:${Partition}:quicksight:${Region}:${Account}:group/${ResourceId}", "inboundConnector": "arn:${Partition}:quicksight:${Region}:${Account}:inbound-connector/${ResourceId}", "ingestion": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${DatasetId}/ingestion/${ResourceId}", "knowledgeBase": "arn:${Partition}:quicksight:${Region}:${Account}:knowledge-base/${ResourceId}", "limitsProfile": "arn:${Partition}:quicksight:${Region}:${Account}:limits-profile/${ResourceId}", "namespace": "arn:${Partition}:quicksight:${Region}:${Account}:namespace/${ResourceId}", "oauthClientApplication": "arn:${Partition}:quicksight:${Region}:${Account}:oauthClientApplication/${ResourceId}", "refreshschedule": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${DatasetId}/refresh-schedule/${ResourceId}", "space": "arn:${Partition}:quicksight:${Region}:${Account}:space/${ResourceId}", "template": "arn:${Partition}:quicksight:${Region}:${Account}:template/${ResourceId}", "theme": "arn:${Partition}:quicksight:${Region}:${Account}:theme/${ResourceId}", "topic": "arn:${Partition}:quicksight:${Region}:${Account}:topic/${ResourceId}", "user": "arn:${Partition}:quicksight:${Region}:${Account}:user/${ResourceId}", "vpcconnection": "arn:${Partition}:quicksight:${Region}:${Account}:vpcConnection/${ResourceId}"}, "redshift": {"cluster": "arn:${Partition}:redshift:${Region}:${Account}:cluster:${ClusterName}", "datashare": "arn:${Partition}:redshift:${Region}:${Account}:datashare:${ProducerClusterNamespace}/${DataShareName}", "dbgroup": "arn:${Partition}:redshift:${Region}:${Account}:dbgroup:${ClusterName}/${DbGroup}", "dbname": "arn:${Partition}:redshift:${Region}:${Account}:dbname:${ClusterName}/${DbName}", "dbuser": "arn:${Partition}:redshift:${Region}:${Account}:dbuser:${ClusterName}/${DbUser}", "eventsubscription": "arn:${Partition}:redshift:${Region}:${Account}:eventsubscription:${EventSubscriptionName}", "hsmclientcertificate": "arn:${Partition}:redshift:${Region}:${Account}:hsmclientcertificate:${HSMClientCertificateId}", "hsmconfiguration": "arn:${Partition}:redshift:${Region}:${Account}:hsmconfiguration:${HSMConfigurationId}", "integration": "arn:${Partition}:redshift:${Region}:${Account}:integration:${IntegrationIdentifier}", "namespace": "arn:${Partition}:redshift:${Region}:${Account}:namespace:${ClusterNamespace}", "parametergroup": "arn:${Partition}:redshift:${Region}:${Account}:parametergroup:${ParameterGroupName}", "qev2idcapplication": "arn:${Partition}:redshift:${Region}:${Account}:qev2idcapplication:${Qev2IdcApplicationId}", "redshiftidcapplication": "arn:${Partition}:redshift:${Region}:${Account}:redshiftidcapplication:${RedshiftIdcApplicationId}", "securitygroup": "arn:${Partition}:redshift:${Region}:${Account}:securitygroup:${SecurityGroupName}/ec2securitygroup/${Owner}/${Ec2SecurityGroupId}", "securitygroupingress-cidr": "arn:${Partition}:redshift:${Region}:${Account}:securitygroupingress:${SecurityGroupName}/cidrip/${IpRange}", "securitygroupingress-ec2securitygroup": "arn:${Partition}:redshift:${Region}:${Account}:securitygroupingress:${SecurityGroupName}/ec2securitygroup/${Owner}/${Ece2SecuritygroupId}", "snapshot": "arn:${Partition}:redshift:${Region}:${Account}:snapshot:${ClusterName}/${SnapshotName}", "snapshotcopygrant": "arn:${Partition}:redshift:${Region}:${Account}:snapshotcopygrant:${SnapshotCopyGrantName}", "snapshotschedule": "arn:${Partition}:redshift:${Region}:${Account}:snapshotschedule:${ScheduleIdentifier}", "subnetgroup": "arn:${Partition}:redshift:${Region}:${Account}:subnetgroup:${SubnetGroupName}", "usagelimit": "arn:${Partition}:redshift:${Region}:${Account}:usagelimit:${UsageLimitId}"}, "redshift-data": {"cluster": "arn:${Partition}:redshift:${Region}:${Account}:cluster:${ClusterName}", "managed-workgroup": "arn:${Partition}:redshift-serverless:${Region}:${Account}:managed-workgroup/${ManagedWorkgroupId}", "workgroup": "arn:${Partition}:redshift-serverless:${Region}:${Account}:workgroup/${WorkgroupId}"}, "rekognition": {"collection": "arn:${Partition}:rekognition:${Region}:${Account}:collection/${CollectionId}", "dataset": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/dataset/${DatasetType}/${CreationTimestamp}", "project": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/${CreationTimestamp}", "projectversion": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/version/${VersionName}/${CreationTimestamp}", "streamprocessor": "arn:${Partition}:rekognition:${Region}:${Account}:streamprocessor/${StreamprocessorId}"}, "servicediscovery": {"namespace": "arn:${Partition}:servicediscovery:${Region}:${Account}:namespace/${NamespaceId}", "service": "arn:${Partition}:servicediscovery:${Region}:${Account}:service/${ServiceId}"}, "servicequotas": {"quota": "arn:${Partition}:servicequotas:${Region}:${Account}:${ServiceCode}/${QuotaCode}"}, "signer": {"signing-job": "arn:${Partition}:signer:${Region}:${Account}:/signing-jobs/${JobId}", "signing-profile": "arn:${Partition}:signer:${Region}:${Account}:/signing-profiles/${ProfileName}"}, "sso": {"Account": "arn:${Partition}:sso:::account/${AccountId}", "Application": "arn:${Partition}:sso::${Account}:application/${InstanceId}/${ApplicationId}", "ApplicationProvider": "arn:${Partition}:sso::aws:applicationProvider/${ApplicationProviderId}", "Instance": "arn:${Partition}:sso:::instance/${InstanceId}", "PermissionSet": "arn:${Partition}:sso:::permissionSet/${InstanceId}/${PermissionSetId}", "TrustedTokenIssuer": "arn:${Partition}:sso::${Account}:trustedTokenIssuer/${InstanceId}/${TrustedTokenIssuerId}"}, "states": {"activity": "arn:${Partition}:states:${Region}:${Account}:activity:${ActivityName}", "execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}:${ExecutionId}", "express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}:${ExecutionId}:${ExpressId}", "labelled execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}/${MapRunLabel}:${ExecutionId}", "labelled express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}/${MapRunLabel}:${ExecutionId}:${ExpressId}", "maprun": "arn:${Partition}:states:${Region}:${Account}:mapRun:${StateMachineName}/${MapRunLabel}:${MapRunId}", "statemachine": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}", "statemachinealias": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineAliasName}", "statemachineversion": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineVersionId}"}, "textract": {"adapter": "arn:${Partition}:textract:${Region}:${Account}:/adapters/${AdapterId}", "adapterversion": "arn:${Partition}:textract:${Region}:${Account}:/adapters/${AdapterId}/versions/${AdapterVersion}"}, "timestream-influxdb": {"db-backup": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-backup/${DbBackupId}", "db-cluster": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-cluster/${DbClusterId}", "db-instance": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-instance/${DbInstanceIdentifier}", "db-parameter-group": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-parameter-group/${DbParameterGroupIdentifier}"}, "translate": {"parallel-data": "arn:${Partition}:translate:${Region}:${Account}:parallel-data/${ResourceName}", "terminology": "arn:${Partition}:translate:${Region}:${Account}:terminology/${ResourceName}"}}, "unqualified": {"states": ["statemachine"]}, "mintedIds": {"events": ["api-destination", "connection"]}, "operations": { @@ -1816,6 +1816,25 @@ "servicequotas:TagResource": {"action": "servicequotas:TagResource", "types": [], "resources": []}, "servicequotas:UntagResource": {"action": "servicequotas:UntagResource", "types": [], "resources": []}, "servicequotas:UpdateAutoManagement": {"action": "servicequotas:UpdateAutoManagement", "types": [], "resources": []}, + "signer:AddProfilePermission": {"action": "signer:AddProfilePermission", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, + "signer:CancelSigningProfile": {"action": "signer:CancelSigningProfile", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, + "signer:DescribeSigningJob": {"action": "signer:DescribeSigningJob", "types": ["signing-job"], "resources": [{"type": "signing-job", "fill": {"JobId": "jobId"}}], "located": {"jobId": "{jobId}"}}, + "signer:GetRevocationStatus": {"action": "signer:GetRevocationStatus", "types": ["signing-job", "signing-profile"], "resources": [{"types": ["signing-job", "signing-profile"], "arn": "jobArn"}, {"types": ["signing-job", "signing-profile"], "arn": "profileVersionArn"}], "located": {"jobArn": "?jobArn", "profileVersionArn": "?profileVersionArn"}}, + "signer:GetSigningPlatform": {"action": "signer:GetSigningPlatform", "types": [], "resources": []}, + "signer:GetSigningProfile": {"action": "signer:GetSigningProfile", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, + "signer:ListProfilePermissions": {"action": "signer:ListProfilePermissions", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, + "signer:ListSigningJobs": {"action": "signer:ListSigningJobs", "types": [], "resources": []}, + "signer:ListSigningPlatforms": {"action": "signer:ListSigningPlatforms", "types": [], "resources": []}, + "signer:ListSigningProfiles": {"action": "signer:ListSigningProfiles", "types": [], "resources": []}, + "signer:ListTagsForResource": {"action": "signer:ListTagsForResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, + "signer:PutSigningProfile": {"action": "signer:PutSigningProfile", "types": [], "resources": []}, + "signer:RemoveProfilePermission": {"action": "signer:RemoveProfilePermission", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, + "signer:RevokeSignature": {"action": "signer:RevokeSignature", "types": ["signing-job"], "resources": [{"type": "signing-job", "fill": {"JobId": "jobId"}, "account": "jobOwner"}], "located": {"jobId": "{jobId}"}}, + "signer:RevokeSigningProfile": {"action": "signer:RevokeSigningProfile", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}}], "located": {"profileName": "{profileName}"}}, + "signer:SignPayload": {"action": "signer:SignPayload", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}, "account": "profileOwner"}]}, + "signer:StartSigningJob": {"action": "signer:StartSigningJob", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}, "account": "profileOwner"}]}, + "signer:TagResource": {"action": "signer:TagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, + "signer:UntagResource": {"action": "signer:UntagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}}, "sso:AddRegion": {"action": "sso:AddRegion", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]}, "sso:AttachCustomerManagedPolicyReferenceToPermissionSet": {"action": "sso:AttachCustomerManagedPolicyReferenceToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]}, "sso:AttachManagedPolicyToPermissionSet": {"action": "sso:AttachManagedPolicyToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "ManagedPolicyArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]}, diff --git a/src/main/resources/aws/iam-tag-on-create.json b/src/main/resources/aws/iam-tag-on-create.json index ca239ce7b7..ebf7624b0a 100644 --- a/src/main/resources/aws/iam-tag-on-create.json +++ b/src/main/resources/aws/iam-tag-on-create.json @@ -1,8 +1,8 @@ { "_source": {"generator": "tools/aws/regen_iam_tag_on_create.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-05", "note": "make iam-tag-on-create-check re-derives every member from botocore; make iam-tag-on-create-verify checks every operation against AWS."}, - "namespaces": {"access-analyzer": ["accessanalyzer"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "autoscaling": ["autoscaling"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudformation": ["cloudformation"], "cloudhsm": ["cloudhsmv2"], "cloudtrail": ["cloudtrail"], "cloudwatch": ["cloudwatch", "cloudwatchomni"], "codedeploy": ["codedeploy"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "comprehend": ["comprehend"], "config": ["config"], "cur": ["cur"], "datasync": ["datasync"], "dms": ["dms"], "dsql": ["dsql"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "eks": ["eks"], "elasticache": ["elasticache"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "glue": ["glue"], "iam": ["iam"], "kinesis": ["kinesis"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "kms": ["kms"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "lightsail": ["lightsail"], "logs": ["logs"], "memorydb": ["memorydb"], "network-firewall": ["network-firewall"], "organizations": ["organizations"], "payment-cryptography": ["payment-cryptography"], "pipes": ["pipes"], "rds": ["docdb", "neptune", "rds"], "redshift": ["redshift"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-groups": ["resource-groups"], "route53resolver": ["route53resolver"], "sagemaker": ["sagemaker"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "servicediscovery": ["servicediscovery"], "ses": ["mailmanager", "pinpoint-email", "ses", "sesv2"], "sns": ["sns"], "sqs": ["sqs"], "ssm": ["ssm"], "sso": ["sso-admin"], "states": ["stepfunctions"], "sts": ["sts"], "swf": ["swf"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "transcribe": ["transcribe"], "transfer": ["transfer"], "translate": ["translate"], "wafv2": ["wafv2"]}, + "namespaces": {"access-analyzer": ["accessanalyzer"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "autoscaling": ["autoscaling"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudformation": ["cloudformation"], "cloudhsm": ["cloudhsmv2"], "cloudtrail": ["cloudtrail"], "cloudwatch": ["cloudwatch", "cloudwatchomni"], "codedeploy": ["codedeploy"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "comprehend": ["comprehend"], "config": ["config"], "cur": ["cur"], "datasync": ["datasync"], "dms": ["dms"], "dsql": ["dsql"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "eks": ["eks"], "elasticache": ["elasticache"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "glue": ["glue"], "iam": ["iam"], "kinesis": ["kinesis"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "kms": ["kms"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "lightsail": ["lightsail"], "logs": ["logs"], "memorydb": ["memorydb"], "network-firewall": ["network-firewall"], "organizations": ["organizations"], "payment-cryptography": ["payment-cryptography"], "pipes": ["pipes"], "rds": ["docdb", "neptune", "rds"], "redshift": ["redshift"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-groups": ["resource-groups"], "route53resolver": ["route53resolver"], "sagemaker": ["sagemaker"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "servicediscovery": ["servicediscovery"], "ses": ["mailmanager", "pinpoint-email", "ses", "sesv2"], "signer": ["signer"], "sns": ["sns"], "sqs": ["sqs"], "ssm": ["ssm"], "sso": ["sso-admin"], "states": ["stepfunctions"], "sts": ["sts"], "swf": ["swf"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "transcribe": ["transcribe"], "transfer": ["transfer"], "translate": ["translate"], "wafv2": ["wafv2"]}, "notCovered": {"airflow": "REST routes no rule maps yet", "app-integrations": "REST routes no rule maps yet", "appconfig": "REST routes no rule maps yet", "appsync": "REST routes no rule maps yet", "aps": "REST routes no rule maps yet", "aws-marketplace": "REST routes no rule maps yet", "backup": "REST routes no rule maps yet", "batch": "REST routes no rule maps yet", "bedrock": "REST routes no rule maps yet", "bedrock-agentcore": "REST routes no rule maps yet", "cloudfront": "REST routes no rule maps yet", "codeguru-reviewer": "REST routes no rule maps yet", "connect": "REST routes no rule maps yet", "controltower": "REST routes no rule maps yet", "detective": "REST routes no rule maps yet", "dlm": "REST routes no rule maps yet", "elasticfilesystem": "REST routes no rule maps yet", "emr-serverless": "REST routes no rule maps yet", "fis": "REST routes no rule maps yet", "guardduty": "REST routes no rule maps yet", "inspector2": "REST routes no rule maps yet", "iot": "REST routes no rule maps yet", "kafka": "REST routes no rule maps yet", "macie2": "REST routes no rule maps yet", "mq": "REST routes no rule maps yet", "oam": "REST routes no rule maps yet", "quicksight": "metadata-only REST subset; creation-tag IAM authorization is not implemented", "ram": "REST routes no rule maps yet", "resource-explorer-2": "REST routes no rule maps yet", "rum": "REST routes no rule maps yet", "s3": "authorized by route; S3 checks s3:PutObjectTagging for an object it creates with tags itself", "s3tables": "REST routes no rule maps yet", "securityhub": "REST routes no rule maps yet", "servicecatalog": "its operations that tag are AppRegistry's, whose REST routes no rule maps yet"}, - "otherNamespaces": ["account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "appmesh", "apprunner", "appstream", "arc-region-switch", "artifact", "auditmanager", "b2bi", "backup-gateway", "backup-search", "bcm-dashboards", "billing", "billingconductor", "braket", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "connect-campaigns", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "directconnect", "docdb-elastic", "drs", "ds", "ebs", "ecr-public", "elemental-inference", "emr-containers", "entityresolution", "evs", "fms", "forecast", "frauddetector", "fsx", "gamelift", "gameliftstreams", "geo", "grafana", "greengrass", "groundstation", "health-agent", "healthlake", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotdeviceadvisor", "iotfleetwise", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "ivs", "ivschat", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "m2", "managedblockchain", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgn", "migrationhub-orchestrator", "mobiletargeting", "mpa", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "notifications", "notifications-contacts", "observabilityadmin", "odb", "omics", "opensearch", "osis", "outposts", "partnercentral", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "profile", "proton", "qbusiness", "rbin", "refactor-spaces", "repostspace", "resiliencehub", "rolesanywhere", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3files", "sagemaker-geospatial", "savingsplans", "schemas", "scn", "security-ir", "securityagent", "securitylake", "shield", "signer", "sms-voice", "snow-device-management", "social-messaging", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "voiceid", "vpc-lattice", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workspaces", "workspaces-instances", "workspaces-web", "xray"], + "otherNamespaces": ["account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "appmesh", "apprunner", "appstream", "arc-region-switch", "artifact", "auditmanager", "b2bi", "backup-gateway", "backup-search", "bcm-dashboards", "billing", "billingconductor", "braket", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "connect-campaigns", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "directconnect", "docdb-elastic", "drs", "ds", "ebs", "ecr-public", "elemental-inference", "emr-containers", "entityresolution", "evs", "fms", "forecast", "frauddetector", "fsx", "gamelift", "gameliftstreams", "geo", "grafana", "greengrass", "groundstation", "health-agent", "healthlake", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotdeviceadvisor", "iotfleetwise", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "ivs", "ivschat", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "m2", "managedblockchain", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgn", "migrationhub-orchestrator", "mobiletargeting", "mpa", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "notifications", "notifications-contacts", "observabilityadmin", "odb", "omics", "opensearch", "osis", "outposts", "partnercentral", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "profile", "proton", "qbusiness", "rbin", "refactor-spaces", "repostspace", "resiliencehub", "rolesanywhere", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3files", "sagemaker-geospatial", "savingsplans", "schemas", "scn", "security-ir", "securityagent", "securitylake", "shield", "sms-voice", "snow-device-management", "social-messaging", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "voiceid", "vpc-lattice", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workspaces", "workspaces-instances", "workspaces-web", "xray"], "resourceArns": {"ec2": {"application-status-check": "arn:${Partition}:ec2:${Region}:${Account}:application-status-check/*", "capacity-block": "arn:${Partition}:ec2:${Region}:${Account}:capacity-block/*", "capacity-manager-data-export": "arn:${Partition}:ec2:${Region}:${Account}:capacity-manager-data-export/*", "capacity-reservation": "arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation/*", "capacity-reservation-cancellation-quote": "arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation-cancellation-quote/*", "capacity-reservation-fleet": "arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation-fleet/*", "carrier-gateway": "arn:${Partition}:ec2:${Region}:${Account}:carrier-gateway/*", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/*", "client-vpn-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:client-vpn-endpoint/*", "coip-pool": "arn:${Partition}:ec2:${Region}:${Account}:coip-pool/*", "customer-gateway": "arn:${Partition}:ec2:${Region}:${Account}:customer-gateway/*", "declarative-policies-report": "arn:${Partition}:ec2:${Region}:${Account}:declarative-policies-report/*", "dedicated-host": "arn:${Partition}:ec2:${Region}:${Account}:dedicated-host/*", "dhcp-options": "arn:${Partition}:ec2:${Region}:${Account}:dhcp-options/*", "egress-only-internet-gateway": "arn:${Partition}:ec2:${Region}:${Account}:egress-only-internet-gateway/*", "elastic-gpu": "arn:${Partition}:ec2:${Region}:${Account}:elastic-gpu/*", "elastic-inference": "arn:${Partition}:elastic-inference:${Region}:${Account}:elastic-inference-accelerator/*", "elastic-ip": "arn:${Partition}:ec2:${Region}:${Account}:elastic-ip/*", "export-image-task": "arn:${Partition}:ec2:${Region}:${Account}:export-image-task/*", "export-instance-task": "arn:${Partition}:ec2:${Region}:${Account}:export-instance-task/*", "fleet": "arn:${Partition}:ec2:${Region}:${Account}:fleet/*", "fpga-image": "arn:${Partition}:ec2:${Region}:${Account}:fpga-image/*", "group": "arn:${Partition}:resource-groups:${Region}:${Account}:group/*", "host-reservation": "arn:${Partition}:ec2:${Region}:${Account}:host-reservation/*", "image": "arn:${Partition}:ec2:${Region}::image/*", "image-usage-report": "arn:${Partition}:ec2:${Region}:${Account}:image-usage-report/*", "import-image-task": "arn:${Partition}:ec2:${Region}:${Account}:import-image-task/*", "import-snapshot-task": "arn:${Partition}:ec2:${Region}:${Account}:import-snapshot-task/*", "instance": "arn:${Partition}:ec2:${Region}:${Account}:instance/*", "instance-connect-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:instance-connect-endpoint/*", "instance-event-window": "arn:${Partition}:ec2:${Region}:${Account}:instance-event-window/*", "internet-gateway": "arn:${Partition}:ec2:${Region}:${Account}:internet-gateway/*", "ipam": "arn:${Partition}:ec2::${Account}:ipam/*", "ipam-external-resource-verification-token": "arn:${Partition}:ec2::${Account}:ipam-external-resource-verification-token/*", "ipam-internet-registry-association": "arn:${Partition}:ec2::${Account}:ipam-internet-registry-association/*", "ipam-policy": "arn:${Partition}:ec2::${Account}:ipam-policy/*", "ipam-pool": "arn:${Partition}:ec2::${Account}:ipam-pool/*", "ipam-pool-allocation": "arn:${Partition}:ec2:${Region}:${Account}:ipam-pool-allocation/*", "ipam-prefix-list-resolver": "arn:${Partition}:ec2::${Account}:ipam-prefix-list-resolver/*", "ipam-prefix-list-resolver-target": "arn:${Partition}:ec2::${Account}:ipam-prefix-list-resolver-target/*", "ipam-resource-discovery": "arn:${Partition}:ec2::${Account}:ipam-resource-discovery/*", "ipam-resource-discovery-association": "arn:${Partition}:ec2::${Account}:ipam-resource-discovery-association/*", "ipam-scope": "arn:${Partition}:ec2::${Account}:ipam-scope/*", "ipv4pool-ec2": "arn:${Partition}:ec2:${Region}:${Account}:ipv4pool-ec2/*", "ipv6pool-ec2": "arn:${Partition}:ec2:${Region}:${Account}:ipv6pool-ec2/*", "key-pair": "arn:${Partition}:ec2:${Region}:${Account}:key-pair/*", "launch-template": "arn:${Partition}:ec2:${Region}:${Account}:launch-template/*", "license-configuration": "arn:${Partition}:license-manager:${Region}:${Account}:license-configuration:*", "local-gateway": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway/*", "local-gateway-route-table": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-route-table/*", "local-gateway-route-table-virtual-interface-group-association": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-route-table-virtual-interface-group-association/*", "local-gateway-route-table-vpc-association": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-route-table-vpc-association/*", "local-gateway-virtual-interface": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-virtual-interface/*", "local-gateway-virtual-interface-group": "arn:${Partition}:ec2:${Region}:${Account}:local-gateway-virtual-interface-group/*", "mac-modification-task": "arn:${Partition}:ec2:${Region}:${Account}:mac-modification-task/*", "natgateway": "arn:${Partition}:ec2:${Region}:${Account}:natgateway/*", "network-acl": "arn:${Partition}:ec2:${Region}:${Account}:network-acl/*", "network-insights-access-scope": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-access-scope/*", "network-insights-access-scope-analysis": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-access-scope-analysis/*", "network-insights-analysis": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-analysis/*", "network-insights-path": "arn:${Partition}:ec2:${Region}:${Account}:network-insights-path/*", "network-interface": "arn:${Partition}:ec2:${Region}:${Account}:network-interface/*", "outpost-lag": "arn:${Partition}:ec2:${Region}:${Account}:outpost-lag/*", "placement-group": "arn:${Partition}:ec2:${Region}:${Account}:placement-group/*", "prefix-list": "arn:${Partition}:ec2:${Region}:${Account}:prefix-list/*", "replace-root-volume-task": "arn:${Partition}:ec2:${Region}:${Account}:replace-root-volume-task/*", "reserved-instances": "arn:${Partition}:ec2:${Region}:${Account}:reserved-instances/*", "role": "arn:${Partition}:iam::${Account}:role/*", "route-server": "arn:${Partition}:ec2:${Region}:${Account}:route-server/*", "route-server-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:route-server-endpoint/*", "route-server-peer": "arn:${Partition}:ec2:${Region}:${Account}:route-server-peer/*", "route-table": "arn:${Partition}:ec2:${Region}:${Account}:route-table/*", "secondary-interface": "arn:${Partition}:ec2:${Region}:${Account}:secondary-interface/*", "secondary-network": "arn:${Partition}:ec2:${Region}:${Account}:secondary-network/*", "secondary-subnet": "arn:${Partition}:ec2:${Region}:${Account}:secondary-subnet/*", "security-group": "arn:${Partition}:ec2:${Region}:${Account}:security-group/*", "security-group-rule": "arn:${Partition}:ec2:${Region}:${Account}:security-group-rule/*", "snapshot": "arn:${Partition}:ec2:${Region}::snapshot/*", "spot-fleet-request": "arn:${Partition}:ec2:${Region}:${Account}:spot-fleet-request/*", "spot-instances-request": "arn:${Partition}:ec2:${Region}:${Account}:spot-instances-request/*", "subnet": "arn:${Partition}:ec2:${Region}:${Account}:subnet/*", "subnet-cidr-reservation": "arn:${Partition}:ec2:${Region}:${Account}:subnet-cidr-reservation/*", "traffic-mirror-filter": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-filter/*", "traffic-mirror-filter-rule": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-filter-rule/*", "traffic-mirror-session": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-session/*", "traffic-mirror-target": "arn:${Partition}:ec2:${Region}:${Account}:traffic-mirror-target/*", "transit-gateway": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway/*", "transit-gateway-attachment": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-attachment/*", "transit-gateway-connect-peer": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-connect-peer/*", "transit-gateway-metering-policy": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-metering-policy/*", "transit-gateway-multicast-domain": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-multicast-domain/*", "transit-gateway-policy-table": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-policy-table/*", "transit-gateway-route-table": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-route-table/*", "transit-gateway-route-table-announcement": "arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-route-table-announcement/*", "verified-access-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-endpoint/*", "verified-access-endpoint-target": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-endpoint-target/*", "verified-access-group": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-group/*", "verified-access-instance": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-instance/*", "verified-access-policy": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-policy/*", "verified-access-trust-provider": "arn:${Partition}:ec2:${Region}:${Account}:verified-access-trust-provider/*", "volume": "arn:${Partition}:ec2:${Region}:${Account}:volume/*", "vpc": "arn:${Partition}:ec2:${Region}:${Account}:vpc/*", "vpc-block-public-access-exclusion": "arn:${Partition}:ec2:${Region}:${Account}:vpc-block-public-access-exclusion/*", "vpc-encryption-control": "arn:${Partition}:ec2:${Region}:${Account}:vpc-encryption-control/*", "vpc-endpoint": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint/*", "vpc-endpoint-connection": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint-connection/*", "vpc-endpoint-service": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint-service/*", "vpc-endpoint-service-permission": "arn:${Partition}:ec2:${Region}:${Account}:vpc-endpoint-service-permission/*", "vpc-flow-log": "arn:${Partition}:ec2:${Region}:${Account}:vpc-flow-log/*", "vpc-peering-connection": "arn:${Partition}:ec2:${Region}:${Account}:vpc-peering-connection/*", "vpn-concentrator": "arn:${Partition}:ec2:${Region}:${Account}:vpn-concentrator/*", "vpn-connection": "arn:${Partition}:ec2:${Region}:${Account}:vpn-connection/*", "vpn-connection-device-type": "arn:${Partition}:ec2:${Region}:${Account}:vpn-connection-device-type/*", "vpn-gateway": "arn:${Partition}:ec2:${Region}:${Account}:vpn-gateway/*"}, "rds": {"auto-backup": "arn:${Partition}:rds:${Region}:${Account}:auto-backup:*", "cev": "arn:${Partition}:rds:${Region}:${Account}:cev:*/*/*", "cluster": "arn:${Partition}:rds:${Region}:${Account}:cluster:*", "cluster-auto-backup": "arn:${Partition}:rds:${Region}:${Account}:cluster-auto-backup:*", "cluster-endpoint": "arn:${Partition}:rds:${Region}:${Account}:cluster-endpoint:*", "cluster-pg": "arn:${Partition}:rds:${Region}:${Account}:cluster-pg:*", "cluster-snapshot": "arn:${Partition}:rds:${Region}:${Account}:cluster-snapshot:*", "db": "arn:${Partition}:rds:${Region}:${Account}:db:*", "db-capacity-reservation": "arn:${Partition}:rds:${Region}:${Account}:db-capacity-reservation:*", "deployment": "arn:${Partition}:rds:${Region}:${Account}:deployment:*", "es": "arn:${Partition}:rds:${Region}:${Account}:es:*", "global-cluster": "arn:${Partition}:rds::${Account}:global-cluster:*", "integration": "arn:${Partition}:rds:${Region}:${Account}:integration:*", "og": "arn:${Partition}:rds:${Region}:${Account}:og:*", "pg": "arn:${Partition}:rds:${Region}:${Account}:pg:*", "proxy": "arn:${Partition}:rds:${Region}:${Account}:db-proxy:*", "proxy-endpoint": "arn:${Partition}:rds:${Region}:${Account}:db-proxy-endpoint:*", "ri": "arn:${Partition}:rds:${Region}:${Account}:ri:*", "secgrp": "arn:${Partition}:rds:${Region}:${Account}:secgrp:*", "shardgrp": "arn:${Partition}:rds:${Region}:${Account}:shard-group:*", "snapshot": "arn:${Partition}:rds:${Region}:${Account}:snapshot:*", "snapshot-tenant-database": "arn:${Partition}:rds:${Region}:${Account}:snapshot-tenant-database:*:*", "subgrp": "arn:${Partition}:rds:${Region}:${Account}:subgrp:*", "target-group": "arn:${Partition}:rds:${Region}:${Account}:target-group:*", "tenant-database": "arn:${Partition}:rds:${Region}:${Account}:tenant-database:*"}}, "operations": { "access-analyzer:CreateAnalyzer": {"tagging": ["access-analyzer:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]}, @@ -539,6 +539,7 @@ "ses:CreateRuleSet": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}, "ses:CreateTenant": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}, "ses:CreateTrafficPolicy": {"tagging": ["ses:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}, + "signer:PutSigningProfile": {"tagging": ["signer:TagResource"], "requestTags": true, "tags": [{"member": "tags{}"}]}, "sns:CreateTopic": {"tagging": ["sns:TagResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}, "sqs:CreateQueue": {"tagging": ["sqs:TagQueue"], "requestTags": true, "tags": [{"member": "tags{}", "query": "Tag{}"}]}, "ssm:CreateActivation": {"tagging": ["ssm:AddTagsToResource"], "requestTags": true, "tags": [{"member": "Tags[]", "key": "Key", "value": "Value"}]}, diff --git a/src/main/resources/aws/rest-routes.json b/src/main/resources/aws/rest-routes.json index 26c0248dd9..dceaf52dec 100644 --- a/src/main/resources/aws/rest-routes.json +++ b/src/main/resources/aws/rest-routes.json @@ -1276,6 +1276,32 @@ "UntagResource": {"method": "DELETE", "requestUri": "/tags/{ResourceArn}"}, "UpdateSchedule": {"method": "PUT", "requestUri": "/schedules/{Name}"} } + }, + "signer": { + "credentialScope": "signer", + "apiVersion": "2017-08-25", + "accessDeniedStatus": 403, + "operations": { + "AddProfilePermission": {"method": "POST", "requestUri": "/_signer/signing-profiles/{profileName}/permissions"}, + "CancelSigningProfile": {"method": "DELETE", "requestUri": "/_signer/signing-profiles/{profileName}"}, + "DescribeSigningJob": {"method": "GET", "requestUri": "/_signer/signing-jobs/{jobId}"}, + "GetRevocationStatus": {"method": "GET", "requestUri": "/_signer/revocations"}, + "GetSigningPlatform": {"method": "GET", "requestUri": "/_signer/signing-platforms/{platformId}"}, + "GetSigningProfile": {"method": "GET", "requestUri": "/_signer/signing-profiles/{profileName}"}, + "ListProfilePermissions": {"method": "GET", "requestUri": "/_signer/signing-profiles/{profileName}/permissions"}, + "ListSigningJobs": {"method": "GET", "requestUri": "/_signer/signing-jobs"}, + "ListSigningPlatforms": {"method": "GET", "requestUri": "/_signer/signing-platforms"}, + "ListSigningProfiles": {"method": "GET", "requestUri": "/_signer/signing-profiles"}, + "ListTagsForResource": {"method": "GET", "requestUri": "/tags/{resourceArn+}"}, + "PutSigningProfile": {"method": "PUT", "requestUri": "/_signer/signing-profiles/{profileName}"}, + "RemoveProfilePermission": {"method": "DELETE", "requestUri": "/_signer/signing-profiles/{profileName}/permissions/{statementId}"}, + "RevokeSignature": {"method": "PUT", "requestUri": "/_signer/signing-jobs/{jobId}/revoke"}, + "RevokeSigningProfile": {"method": "PUT", "requestUri": "/_signer/signing-profiles/{profileName}/revoke"}, + "SignPayload": {"method": "POST", "requestUri": "/_signer/signing-jobs/with-payload"}, + "StartSigningJob": {"method": "POST", "requestUri": "/_signer/signing-jobs"}, + "TagResource": {"method": "POST", "requestUri": "/tags/{resourceArn+}"}, + "UntagResource": {"method": "DELETE", "requestUri": "/tags/{resourceArn+}"} + } } } } diff --git a/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java b/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java index d38de979cc..f11618a31e 100644 --- a/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java +++ b/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java @@ -52,7 +52,7 @@ class PartitionCrossServiceSmokeIntegrationTest { "lambdamicrovms", "lambdaweb", "memorydb", "msk", "mwaa", "networkfirewall", "oam", "opensearch", "organizations", "paymentcryptography", "pipes", "quicksight", "ram", "rds", "redshift", "redshiftserverless", "resourceexplorer2", "resourcegroups", "route53resolver", - "s3tables", "s3vectors", "sagemaker", "scheduler", "secretsmanager", "servicequotas", "ses", "sns", "sqs", + "s3tables", "s3vectors", "sagemaker", "scheduler", "secretsmanager", "servicequotas", "ses", "signer", "sns", "sqs", "stepfunctions", "timestreaminfluxdb", "transfer", "verifiedpermissions", "wafv2"); private static final String JSON_1_0 = "application/x-amz-json-1.0"; @@ -1075,6 +1075,23 @@ class PartitionCrossServiceSmokeIntegrationTest { PartitionMatrix.assertArnIn(partitionCase, arn); } + @ParameterizedTest + @MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES) + void signerProfileArn(PartitionCase partitionCase) { + String region = offered(partitionCase, "signer"); + String profileName = "Smoke" + Long.toString(System.nanoTime(), 36); + signed(region, "signer") + .contentType(JSON) + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when().put("/signing-profiles/" + profileName).then().statusCode(200); + cleanup.register(() -> signed(region, "signer").when() + .delete("/signing-profiles/" + profileName)); + String arn = signed(region, "signer").when() + .get("/signing-profiles/" + profileName) + .then().statusCode(200).extract().jsonPath().getString("arn"); + PartitionMatrix.assertArnIn(partitionCase, arn); + } + @ParameterizedTest @MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES) void networkFirewallRuleGroupArn(PartitionCase partitionCase) { diff --git a/src/test/java/io/floci/aws/services/cloudformation/CfnProvisionerFixture.java b/src/test/java/io/floci/aws/services/cloudformation/CfnProvisionerFixture.java index 81524ddbf1..62218ee4aa 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/CfnProvisionerFixture.java +++ b/src/test/java/io/floci/aws/services/cloudformation/CfnProvisionerFixture.java @@ -172,6 +172,7 @@ import io.floci.aws.services.secretsmanager.SecretsManagerService; import io.floci.aws.services.ses.SesIdentityService; import io.floci.aws.services.ses.SesReceiptRuleService; import io.floci.aws.services.ses.SesService; +import io.floci.aws.services.signer.SignerService; import io.floci.aws.services.sns.SnsService; import io.floci.aws.services.sqs.SqsService; import io.floci.aws.services.ssm.SsmService; @@ -208,6 +209,7 @@ final class CfnProvisionerFixture { static final class Builder { + private SignerService signerService; private S3Service s3Service; private S3VectorsService s3VectorsService; private SnsService snsService; @@ -319,7 +321,9 @@ final class CfnProvisionerFixture { ensureDynamicReferences(); List discovered = new ArrayList<>(); discovered.add(new CdkMetadataCfnProvisioner()); - discovered.add(new SignerCfnProvisioner()); + if (signerService != null) { + discovered.add(new SignerCfnProvisioner(signerService)); + } if (stepFunctionsService != null) { discovered.add(new StepFunctionsCfnProvisioner(stepFunctionsService, s3Service, objectMapper)); } @@ -562,6 +566,11 @@ final class CfnProvisionerFixture { return this; } + public Builder signer(SignerService v) { + this.signerService = v; + return this; + } + public Builder s3(S3Service v) { this.s3Service = v; return this; diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationLambdaCodeSigningIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationLambdaCodeSigningIntegrationTest.java index 7aae60070b..c77e8f5838 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationLambdaCodeSigningIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationLambdaCodeSigningIntegrationTest.java @@ -5,6 +5,8 @@ import io.floci.aws.services.lambda.LambdaService; import io.floci.aws.testing.CfnStackWaits; import io.quarkus.test.junit.QuarkusTest; import io.restassured.path.xml.XmlPath; +import io.restassured.response.Response; +import io.restassured.specification.RequestSpecification; import jakarta.inject.Inject; import org.junit.jupiter.api.Test; @@ -44,12 +46,22 @@ class CloudFormationLambdaCodeSigningIntegrationTest { String version = output(stack, "ProfileVersion"); String cscArn = output(stack, "CscArn"); String function = output(stack, "Name"); + String profileName = output(stack, "ProfileName"); assertEquals(profileArn, output(stack, "ProfileRef")); assertThat(output(stack, "ProfileName"), matchesPattern("Profile_[A-Za-z0-9]{12}")); assertEquals("arn:aws:signer:us-east-1:000000000000:/signing-profiles/" + output(stack, "ProfileName"), profileArn); assertThat(version, matchesPattern("[A-Za-z0-9]{10}")); + Response profileFromApi = signerApi() + .when() + .get("/signing-profiles/" + output(stack, "ProfileName")) + .then() + .statusCode(200) + .extract().response(); + assertEquals(profileArn, profileFromApi.path("arn")); + assertEquals(version, profileFromApi.path("profileVersion")); + assertEquals("AWSLambda-SHA384-ECDSA", profileFromApi.path("platformId")); assertEquals(profileArn + "/" + version, output(stack, "ProfileVersionArn")); assertEquals(cscArn, output(stack, "CscRef")); assertEquals(cscArn, "arn:aws:lambda:us-east-1:000000000000:code-signing-config:" + output(stack, "CscId")); @@ -89,6 +101,19 @@ class CloudFormationLambdaCodeSigningIntegrationTest { .get("/2020-04-22/code-signing-configs/" + cscArn) .then() .statusCode(404); + + // A stack delete cancels the profile, which AWS keeps visible with the same ARN. + signerApi() + .when() + .get("/signing-profiles/" + profileName) + .then() + .statusCode(200) + .body("status", equalTo("Canceled")); + } + + private static RequestSpecification signerApi() { + return given().header("Authorization", + "AWS4-HMAC-SHA256 Credential=000000000000/20260101/us-east-1/signer/aws4_request"); } private static String template(String functionProperty) { diff --git a/src/test/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisionerTest.java b/src/test/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisionerTest.java index 63f93fbc5d..062893e6b8 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisionerTest.java +++ b/src/test/java/io/floci/aws/services/cloudformation/provisioners/SignerCfnProvisionerTest.java @@ -9,11 +9,16 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import io.floci.aws.core.common.AwsException; import io.floci.aws.services.cloudformation.CloudFormationTemplateEngine; import io.floci.aws.services.cloudformation.model.StackResource; +import io.floci.aws.services.signer.SignerService; +import io.floci.aws.services.signer.model.SigningProfile; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -21,16 +26,49 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; class SignerCfnProvisionerTest { private static final String PROFILE_ARN_PREFIX = "arn:aws:signer:eu-west-1:000000000000:/signing-profiles/"; + private static final String STUB_VERSION = "AbCdEfGhIj"; - private final SignerCfnProvisioner provisioner = new SignerCfnProvisioner(); + private final SignerService signerService = mock(SignerService.class); + private final SignerCfnProvisioner provisioner = new SignerCfnProvisioner(signerService); private final ObjectMapper mapper = new ObjectMapper(); + /** + * A stand-in for the service's own upsert: it answers the identifiers the Signer API would, so the + * assertions here stay about what the provisioner puts on the resource. That a stack-created + * profile is readable through the API is asserted by + * {@code CloudFormationLambdaCodeSigningIntegrationTest}. + */ + @BeforeEach + void stubService() { + when(signerService.putSigningProfile(anyString(), anyString(), nullable(String.class), + nullable(Integer.class), anyMap(), anyString())) + .thenAnswer(inv -> { + String name = inv.getArgument(0); + String platformId = inv.getArgument(1); + String arn = PROFILE_ARN_PREFIX + name; + SigningProfile profile = new SigningProfile(); + profile.setProfileName(name); + profile.setPlatformId(platformId); + profile.setProfileVersion(STUB_VERSION); + profile.setArn(arn); + profile.setProfileVersionArn(arn + "/" + STUB_VERSION); + return profile; + }); + } + private ProvisionContext ctx(String priorPhysicalId) { CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class); when(engine.resolve(any())).thenAnswer(inv -> { @@ -287,4 +325,153 @@ class SignerCfnProvisionerTest { assertEquals("ValidationError", e.getErrorCode(), "'" + name + "'"); } } + + @Test + void provisionCreatesTheProfileThroughTheSignerService() { + ObjectNode props = props("my_profile"); + props.putObject("SignatureValidityPeriod").put("Type", "DAYS").put("Value", 30); + props.putArray("Tags").addObject().put("Key", "team").put("Value", "a"); + + provisioner.provision(profile(), props, ctx(null)); + + verify(signerService).putSigningProfile("my_profile", "AWSLambda-SHA384-ECDSA", + "DAYS", Integer.valueOf(30), Map.of("team", "a"), "eu-west-1"); + } + + @Test + void tagsOnlyUpdateReplacesTheTagsInsteadOfMintingAVersion() { + StackResource r = profile(); + provisioner.provision(r, props("my_profile"), ctx(null)); + + ObjectNode tagged = props("my_profile"); + tagged.putArray("Tags").addObject().put("Key", "team").put("Value", "a"); + provisioner.provision(r, tagged, ctx(r.getPhysicalId())); + + verify(signerService).replaceTags("my_profile", Map.of("team", "a"), "eu-west-1"); + verify(signerService, times(1)).putSigningProfile(anyString(), anyString(), + any(), any(), anyMap(), anyString()); + } + + @Test + void deleteCancelsTheProfileThePhysicalIdNames() { + String arn = PROFILE_ARN_PREFIX + "my_profile"; + + provisioner.delete("AWS::Signer::SigningProfile", arn, "eu-west-1"); + + verify(signerService).cancelSigningProfile("my_profile", "eu-west-1"); + } + + @Test + void aStringValidityPeriodReachesTheServiceAsANumber() { + ObjectNode props = props("my_profile"); + props.putObject("SignatureValidityPeriod").put("Type", "DAYS").put("Value", "135"); + + provisioner.provision(profile(), props, ctx(null)); + + verify(signerService).putSigningProfile(eq("my_profile"), eq("AWSLambda-SHA384-ECDSA"), + eq("DAYS"), eq(Integer.valueOf(135)), anyMap(), eq("eu-west-1")); + } + + @Test + void aStackCannotTakeOverASigningProfileItDidNotCreate() { + when(signerService.findSigningProfile("my_profile", "eu-west-1")) + .thenReturn(Optional.of(new SigningProfile())); + + AwsException e = assertThrows(AwsException.class, + () -> provisioner.provision(profile(), props("my_profile"), ctx(null))); + + assertEquals("ValidationError", e.getErrorCode()); + verify(signerService, never()).putSigningProfile(anyString(), anyString(), + any(), any(), anyMap(), anyString()); + } + + @Test + void aTagsOnlyUpdateAdoptsAProfileThatPredatesTheService() throws Exception { + StackResource r = profile(); + r.setPhysicalId(PROFILE_ARN_PREFIX + "legacy"); + r.getAttributes().put("Arn", PROFILE_ARN_PREFIX + "legacy"); + r.getAttributes().put("ProfileName", "legacy"); + r.getAttributes().put("ProfileVersion", "abcdefghij"); + r.getAttributes().put("FlociSigningProfileCreateOnly", + "AWSLambda-SHA384-ECDSA|legacy|DAYS|30"); + when(signerService.findSigningProfile("legacy", "eu-west-1")).thenReturn(Optional.empty()); + + ObjectNode props = props("legacy"); + props.putObject("SignatureValidityPeriod").put("Type", "DAYS").put("Value", 30); + props.putArray("Tags").addObject().put("Key", "team").put("Value", "a"); + provisioner.provision(r, props, ctx(r.getPhysicalId())); + + verify(signerService).adoptSigningProfile("legacy", "AWSLambda-SHA384-ECDSA", "abcdefghij", + "DAYS", Integer.valueOf(30), "eu-west-1"); + verify(signerService).replaceTags(eq("legacy"), eq(Map.of("team", "a")), eq("eu-west-1")); + } + + @Test + void rollbackOfATagsOnlyUpdateRestoresThePreviousTags() { + StackResource r = profile(); + provisioner.provision(r, props("my_profile"), ctx(null)); + + when(signerService.findSigningProfile("my_profile", "eu-west-1")) + .thenReturn(Optional.of(profileWithTags(Map.of("env", "old")))); + ObjectNode tagged = props("my_profile"); + tagged.putArray("Tags").addObject().put("Key", "team").put("Value", "a"); + provisioner.provision(r, tagged, ctx(r.getPhysicalId())); + + assertTrue(provisioner.rollbackUpdate(r)); + + verify(signerService).replaceTags("my_profile", Map.of("env", "old"), "eu-west-1"); + assertFalse(r.getAttributes().containsKey("FlociSigningProfilePriorTags")); + } + + @Test + void aTagsUpdateThatChangesNothingLeavesNoSnapshot() { + StackResource r = profile(); + provisioner.provision(r, props("my_profile"), ctx(null)); + + when(signerService.findSigningProfile("my_profile", "eu-west-1")) + .thenReturn(Optional.of(profileWithTags(Map.of("env", "same")))); + ObjectNode tagged = props("my_profile"); + tagged.putArray("Tags").addObject().put("Key", "env").put("Value", "same"); + provisioner.provision(r, tagged, ctx(r.getPhysicalId())); + + assertFalse(r.getAttributes().containsKey("FlociSigningProfilePriorTags")); + verify(signerService, never()) + .replaceTags(anyString(), anyMap(), anyString()); + } + + @Test + void intrinsicTagValuesAreResolvedBeforeTheyReachTheService() throws Exception { + CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class); + when(engine.resolve(any())).thenAnswer(inv -> { + JsonNode node = inv.getArgument(0); + return node == null || node.isMissingNode() ? null : node.asText(); + }); + when(engine.resolveNodeOmittingNoValue(any())).thenAnswer(inv -> { + JsonNode node = inv.getArgument(0); + if (node != null && node.isObject() && node.has("Fn::Sub")) { + return mapper.getNodeFactory().textNode("resolved-" + node.path("Fn::Sub").asText()); + } + return node; + }); + ProvisionContext context = + new ProvisionContext(engine, "eu-west-1", "000000000000", "my-stack", null); + ObjectNode props = props("my_profile"); + props.putArray("Tags").addObject() + .put("Key", "team") + .set("Value", mapper.readTree("{\"Fn::Sub\":\"platform\"}")); + + provisioner.provision(profile(), props, context); + + verify(signerService).putSigningProfile(eq("my_profile"), eq("AWSLambda-SHA384-ECDSA"), + any(), any(), eq(Map.of("team", "resolved-platform")), eq("eu-west-1")); + } + + private static SigningProfile profileWithTags(Map tags) { + SigningProfile profile = new SigningProfile(); + profile.setProfileName("my_profile"); + profile.setPlatformId("AWSLambda-SHA384-ECDSA"); + profile.setProfileVersion("AbCdEfGhIj"); + profile.setTags(new LinkedHashMap<>(tags)); + return profile; + } } diff --git a/src/test/java/io/floci/aws/services/signer/SignerIamEnforcementIntegrationTest.java b/src/test/java/io/floci/aws/services/signer/SignerIamEnforcementIntegrationTest.java new file mode 100644 index 0000000000..d506c89128 --- /dev/null +++ b/src/test/java/io/floci/aws/services/signer/SignerIamEnforcementIntegrationTest.java @@ -0,0 +1,144 @@ +package io.floci.aws.services.signer; + +import io.floci.aws.testing.EnforcementFixtures; +import io.floci.aws.testing.IamEnforcementProfile; +import io.floci.aws.testing.PartitionCleanup; +import io.quarkus.test.common.http.TestHTTPResource; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.net.URI; +import java.util.UUID; + +import static io.floci.aws.testing.EnforcementFixtures.auth; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.equalTo; + +/** + * Signer routes are rewritten onto an internal prefix before the IAM filter runs, so this proves + * the rewrite does not take a request out of IAM's reach: a key with no policy is refused on the + * same paths a key with {@code signer:*} is allowed through. + */ +@QuarkusTest +@TestProfile(IamEnforcementProfile.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class SignerIamEnforcementIntegrationTest { + + private static final String ACCOUNT = "741686000030"; + /** Signer profile names are [0-9a-zA-Z_] only, so no hyphen here. */ + private static final String PROFILE = "IamProbe"; + /** Names are [0-9a-zA-Z_], so a run-unique suffix drops the hyphens a UUID carries. */ + private static final String SUFFIX = UUID.randomUUID().toString().replace("-", ""); + private static final String SCOPED_PROFILE = "Scoped" + SUFFIX; + private static final String OTHER_PROFILE = "Other" + SUFFIX; + + @TestHTTPResource("/") + URI baseUri; + + private final PartitionCleanup cleanup = new PartitionCleanup(); + + @RegisterExtension + final AfterAllCallback classCleanup = cleanup::afterEach; + + private String deniedKey; + private String allowedKey; + + @BeforeAll + void createKeys() { + // Both profiles belong to the fixture account, so the scoped policy below can be written + // against a profile ARN that exists before the check runs. + for (String name : new String[] {SCOPED_PROFILE, OTHER_PROFILE}) { + given().port(baseUri.getPort()).header("Authorization", auth(ACCOUNT, "signer")) + .contentType("application/json") + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when().put("/signing-profiles/" + name) + .then().statusCode(200); + } + deniedKey = userWithPolicy(null); + allowedKey = userWithPolicy(""" + {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"signer:*","Resource":"*"}]} + """); + } + + @Test + void aKeyWithoutAPolicyCannotCreateOrReadAProfile() { + given().header("Authorization", auth(deniedKey, "signer")) + .contentType("application/json") + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when().put("/signing-profiles/IamDenied") + .then().statusCode(403); + + given().header("Authorization", auth(deniedKey, "signer")) + .when().get("/signing-profiles/" + PROFILE) + .then().statusCode(403); + } + + @Test + void aKeyWithSignerAllowCreatesAndReadsAProfile() { + given().header("Authorization", auth(allowedKey, "signer")) + .contentType("application/json") + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when().put("/signing-profiles/" + PROFILE) + .then().statusCode(200); + + given().header("Authorization", auth(allowedKey, "signer")) + .when().get("/signing-profiles/" + PROFILE) + .then().statusCode(200) + .body("profileName", equalTo(PROFILE)) + .body("status", equalTo("Active")); + } + + + @Test + void aPolicyScopedToOneProfileReadsThatProfileAndNotAnother() { + String scoped = userWithPolicy(""" + {"Version":"2012-10-17","Statement":[{"Effect":"Allow", + "Action":"signer:GetSigningProfile", + "Resource":"arn:aws:signer:us-east-1:ACCOUNT:/signing-profiles/SCOPED"}]} + """.replace("ACCOUNT", ACCOUNT).replace("SCOPED", SCOPED_PROFILE)); + + given().header("Authorization", auth(scoped, "signer")) + .when().get("/signing-profiles/" + SCOPED_PROFILE) + .then().statusCode(200).body("profileName", equalTo(SCOPED_PROFILE)); + + given().header("Authorization", auth(scoped, "signer")) + .when().get("/signing-profiles/" + OTHER_PROFILE) + .then().statusCode(403); + } + + @Test + void aKeyWithoutATaggingPolicyCannotTagAProfileThroughTheSharedTagsRoute() { + // /tags/{resourceArn} is served by the shared tags controller, not by Signer's prefix, so + // this is the route the generated table has to keep unprefixed for the check to see it. + String key = userWithPolicy(""" + {"Version":"2012-10-17","Statement":[{"Effect":"Allow", + "Action":"signer:GetSigningProfile","Resource":"*"}]} + """); + String profileArn = "arn:aws:signer:us-east-1:" + ACCOUNT + ":/signing-profiles/" + SCOPED_PROFILE; + + given().port(baseUri.getPort()).header("Authorization", auth(key, "signer")) + .contentType("application/json") + .body("{\"tags\":{\"team\":\"payments\"}}") + .when().post("/tags/" + profileArn) + .then().statusCode(403); + + given().port(baseUri.getPort()).header("Authorization", auth(key, "signer")) + .when().get("/tags/" + profileArn) + .then().statusCode(403); + } + + private String userWithPolicy(String policy) { + String user = "signer-iam-" + UUID.randomUUID(); + String key = EnforcementFixtures.createUser(cleanup, baseUri.getPort(), auth(ACCOUNT, "iam"), user) + .accessKeyId(); + if (policy != null) { + EnforcementFixtures.putUserPolicy(baseUri.getPort(), auth(ACCOUNT, "iam"), user, "signer", policy); + } + return key; + } +} diff --git a/src/test/java/io/floci/aws/services/signer/SignerIntegrationTest.java b/src/test/java/io/floci/aws/services/signer/SignerIntegrationTest.java new file mode 100644 index 0000000000..9293964d84 --- /dev/null +++ b/src/test/java/io/floci/aws/services/signer/SignerIntegrationTest.java @@ -0,0 +1,325 @@ +package io.floci.aws.services.signer; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.response.Response; +import io.restassured.specification.RequestSpecification; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.matchesPattern; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; + +@QuarkusTest +class SignerIntegrationTest { + + private static final String ACCOUNT_ID = "723679240095"; + private static final String PROFILE_ARN = + "arn:aws:signer:us-east-1:" + ACCOUNT_ID + ":/signing-profiles/ItProfile"; + + @Test + void profileRoundTripsThroughRestJsonIncludingTagsAndPermissions() { + signer(ACCOUNT_ID, "us-east-1") + .body(""" + {"platformId":"AWSLambda-SHA384-ECDSA", + "signatureValidityPeriod":{"type":"DAYS","value":135}, + "overrides":{"signingConfiguration":{"hashAlgorithm":"SHA-384"}}, + "tags":{"env":"it"}} + """) + .when() + .put("/signing-profiles/ItProfile") + .then() + .statusCode(200) + .body("arn", equalTo(PROFILE_ARN)) + .body("profileVersion", matchesPattern("[0-9a-zA-Z]{10}")) + .body("profileVersionArn", matchesPattern( + "arn:aws:signer:us-east-1:" + ACCOUNT_ID + + ":/signing-profiles/ItProfile/[0-9a-zA-Z]{10}")); + + try { + Response profile = signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles/ItProfile") + .then() + .statusCode(200) + .body("profileName", equalTo("ItProfile")) + .body("platformId", equalTo("AWSLambda-SHA384-ECDSA")) + .body("platformDisplayName", equalTo("AWS Lambda")) + .body("status", equalTo("Active")) + .body("signatureValidityPeriod.type", equalTo("DAYS")) + .body("signatureValidityPeriod.value", equalTo(135)) + .body("overrides.signingConfiguration.hashAlgorithm", equalTo("SHA-384")) + .body("tags.env", equalTo("it")) + .extract().response(); + String profileVersion = profile.path("profileVersion"); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles") + .then() + .statusCode(200) + .body("profiles.profileName", hasItem("ItProfile")); + + signer(ACCOUNT_ID, "us-east-1") + .body("{\"action\":\"signer:StartSigningJob\"," + + "\"principal\":\"123456789012\",\"statementId\":\"cross-account\"}") + .when() + .post("/signing-profiles/ItProfile/permissions") + .then() + .statusCode(200) + .body("revisionId", not(equalTo(""))); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles/ItProfile/permissions") + .then() + .statusCode(200) + .body("permissions[0].action", equalTo("signer:StartSigningJob")) + .body("permissions[0].statementId", equalTo("cross-account")) + .body("permissions[0].profileVersion", equalTo(profileVersion)); + + signer(ACCOUNT_ID, "us-east-1") + .body("{\"tags\":{\"team\":\"platform\"}}") + .when() + .post("/tags/" + PROFILE_ARN) + .then() + .statusCode(204); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/tags/" + PROFILE_ARN) + .then() + .statusCode(200) + .body("tags.team", equalTo("platform")) + .body("tags.env", equalTo("it")); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .delete("/tags/" + PROFILE_ARN + "?tagKeys=team") + .then() + .statusCode(204); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/tags/" + PROFILE_ARN) + .then() + .statusCode(200) + .body("tags.team", nullValue()) + .body("tags.env", equalTo("it")); + } finally { + signer(ACCOUNT_ID, "us-east-1") + .when() + .delete("/signing-profiles/ItProfile") + .then() + .statusCode(200); + } + } + + @Test + void aSigningJobFailsBecauseNoArtifactIsWritten() { + signer(ACCOUNT_ID, "us-east-1") + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when() + .put("/signing-profiles/ItProfile") + .then() + .statusCode(200); + + try { + Response started = signer(ACCOUNT_ID, "us-east-1") + .body(""" + {"profileName":"ItProfile", + "source":{"s3":{"bucketName":"artifacts","key":"app.zip","version":"1"}}, + "destination":{"s3":{"bucketName":"signed","prefix":"out/"}}, + "clientRequestToken":"it-token"} + """) + .when() + .post("/signing-jobs") + .then() + .statusCode(200) + .body("jobId", matchesPattern( + "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")) + .body("jobOwner", equalTo(ACCOUNT_ID)) + .extract().response(); + String jobId = started.path("jobId"); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-jobs/" + jobId) + .then() + .statusCode(200) + .body("status", equalTo("Failed")) + .body("profileName", equalTo("ItProfile")) + .body("source.s3.bucketName", equalTo("artifacts")) + .body("source.s3.key", equalTo("app.zip")) + .body("signedObject", nullValue()) + .body("isRevoked", equalTo(false)) + .body("statusReason", containsString("does not sign artifacts")) + .body("createdAt", notNullValue()); + + // No signature exists, so there is nothing to revoke. + signer(ACCOUNT_ID, "us-east-1") + .body("{\"reason\":\"artifact withdrawn\"}") + .when() + .put("/signing-jobs/" + jobId + "/revoke") + .then() + .statusCode(400) + .body("__type", equalTo("ValidationException")); + } finally { + signer(ACCOUNT_ID, "us-east-1") + .when() + .delete("/signing-profiles/ItProfile") + .then() + .statusCode(200); + } + } + + @Test + void aPermissionToSignAPayloadIsAcceptedThroughTheWire() { + signer(ACCOUNT_ID, "us-east-1") + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when() + .put("/signing-profiles/PermProfile") + .then() + .statusCode(200); + + signer(ACCOUNT_ID, "us-east-1") + .body("{\"action\":\"signer:SignPayload\",\"principal\":\"123456789012\"," + + "\"statementId\":\"sign-payload\"}") + .when() + .post("/signing-profiles/PermProfile/permissions") + .then() + .statusCode(200) + .body("revisionId", notNullValue()); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles/PermProfile/permissions") + .then() + .statusCode(200) + .body("permissions", hasSize(1)) + .body("permissions[0].action", equalTo("signer:SignPayload")) + .body("permissions[0].statementId", equalTo("sign-payload")); + } + + @Test + void aCanceledProfileStaysReadableAndIsHiddenUnlessAskedFor() { + signer(ACCOUNT_ID, "us-east-1") + .body("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}") + .when() + .put("/signing-profiles/CancelProfile") + .then() + .statusCode(200); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .delete("/signing-profiles/CancelProfile") + .then() + .statusCode(200); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles/CancelProfile") + .then() + .statusCode(200) + .body("status", equalTo("Canceled")) + .body("arn", equalTo("arn:aws:signer:us-east-1:" + ACCOUNT_ID + + ":/signing-profiles/CancelProfile")); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles") + .then() + .statusCode(200) + .body("profiles.profileName", not(hasItem("CancelProfile"))); + + signer(ACCOUNT_ID, "us-east-1") + .queryParam("includeCanceled", "true") + .when() + .get("/signing-profiles") + .then() + .statusCode(200) + .body("profiles.profileName", hasItem("CancelProfile")); + + signer(ACCOUNT_ID, "us-east-1") + .body("{\"profileName\":\"CancelProfile\"," + + "\"source\":{\"s3\":{\"bucketName\":\"a\",\"key\":\"k\",\"version\":\"1\"}}," + + "\"destination\":{\"s3\":{\"bucketName\":\"b\"}}," + + "\"clientRequestToken\":\"after-cancel\"}") + .when() + .post("/signing-jobs") + .then() + .statusCode(400) + .body("__type", equalTo("ValidationException")); + } + + @Test + void platformsAreServedAndAnUnknownOneIsNotFound() { + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-platforms") + .then() + .statusCode(200) + .body("platforms.platformId", + hasItem("AWSLambda-SHA384-ECDSA")) + .body("platforms[0].signingConfiguration.hashAlgorithmOptions.allowedValues", + hasItem("SHA-384")); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-platforms/AWSLambda-SHA384-ECDSA") + .then() + .statusCode(200) + .body("category", equalTo("AWSLambda")) + .body("signingImageFormat.defaultFormat", equalTo("JSON")); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-platforms/Not-A-Platform") + .then() + .statusCode(404) + .body("__type", equalTo("ResourceNotFoundException")); + } + + @Test + void aRequestSignedForAnotherServiceKeepsItsPathAndDoesNotReachSigner() { + given() + .contentType("application/json") + .header("Authorization", "AWS4-HMAC-SHA256 Credential=" + ACCOUNT_ID + + "/20260101/us-east-1/s3/aws4_request") + .when() + .get("/signing-profiles") + .then() + .statusCode(404); + } + + @Test + void validationErrorsUseTheSignerErrorShape() { + signer(ACCOUNT_ID, "us-east-1") + .body("{\"platformId\":\"Not-A-Platform\"}") + .when() + .put("/signing-profiles/ItProfile") + .then() + .statusCode(400) + .body("__type", equalTo("ValidationException")); + + signer(ACCOUNT_ID, "us-east-1") + .when() + .get("/signing-profiles/Missing") + .then() + .statusCode(404) + .body("__type", equalTo("ResourceNotFoundException")); + } + + private static RequestSpecification signer(String accountId, String region) { + String authorization = "AWS4-HMAC-SHA256 Credential=" + accountId + + "/20260101/" + region + "/signer/aws4_request"; + return given() + .contentType("application/json") + .header("Authorization", authorization); + } +} diff --git a/src/test/java/io/floci/aws/services/signer/SignerServiceTest.java b/src/test/java/io/floci/aws/services/signer/SignerServiceTest.java new file mode 100644 index 0000000000..473a9c3e6e --- /dev/null +++ b/src/test/java/io/floci/aws/services/signer/SignerServiceTest.java @@ -0,0 +1,421 @@ +package io.floci.aws.services.signer; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.floci.aws.core.common.AwsException; +import io.floci.aws.core.storage.AccountAwareStorageBackend; +import io.floci.aws.services.signer.model.SigningJob; +import io.floci.aws.services.signer.model.SigningProfile; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class SignerServiceTest { + + private static final String REGION = "us-east-1"; + private static final String CERT_ARN = "arn:aws:acm:us-east-1:000000000000:certificate/abc"; + private static final Integer MAX_PAGE = Integer.valueOf(25); + private static final String ACCOUNT = "000000000000"; + private static final String PROFILE_ARN = + "arn:aws:signer:us-east-1:" + ACCOUNT + ":/signing-profiles/MyProfile"; + + private final ObjectMapper objectMapper = new ObjectMapper(); + private AccountAwareStorageBackend profiles; + private AccountAwareStorageBackend jobs; + private SignerService service; + private SignerService mockSigning; + + @BeforeEach + void setUp() { + profiles = AccountAwareStorageBackend.inMemory(ACCOUNT); + jobs = AccountAwareStorageBackend.inMemory(ACCOUNT); + service = new SignerService(profiles, jobs); + mockSigning = new SignerService(profiles, jobs, true); + } + + @Test + void putSigningProfileKeepsPlatformOverridesAndTags() throws Exception { + SigningProfile created = service.putSigningProfile("MyProfile", profileRequest(), REGION); + + assertEquals(PROFILE_ARN, created.getArn()); + assertTrue(created.getProfileVersion().matches("[0-9a-zA-Z]{10}")); + assertEquals(PROFILE_ARN + "/" + created.getProfileVersion(), created.getProfileVersionArn()); + assertEquals("AWSLambda-SHA384-ECDSA", created.getPlatformId()); + assertEquals("AWS Lambda", created.getPlatformDisplayName()); + assertEquals("Active", created.getStatus()); + assertEquals("DAYS", created.getSignatureValidityPeriodType()); + assertEquals(135, created.getSignatureValidityPeriodValue().intValue()); + assertEquals("SHA-384", created.getOverrides().path("signingConfiguration") + .path("hashAlgorithm").asText()); + assertEquals("env", created.getTags().keySet().iterator().next()); + } + + @Test + void putSigningProfileOnAnExistingNameMintsAVersionAndKeepsTagsItWasNotGiven() throws Exception { + String firstVersion = service.putSigningProfile("MyProfile", profileRequest(), REGION) + .getProfileVersion(); + SigningProfile second = service.putSigningProfile("MyProfile", + objectMapper.readTree("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}"), REGION); + + assertFalse(firstVersion.equals(second.getProfileVersion())); + assertEquals(1, second.getTags().size()); + assertEquals("test", second.getTags().get("env")); + assertEquals("DAYS", second.getSignatureValidityPeriodType()); + assertEquals(135, second.getSignatureValidityPeriodValue().intValue()); + } + + @Test + void putSigningProfileRejectsAnUnknownPlatformAndAnOutOfRangeValidity() throws Exception { + AwsException platform = assertThrows(AwsException.class, () -> service.putSigningProfile( + "MyProfile", objectMapper.readTree("{\"platformId\":\"Not-A-Platform\"}"), REGION)); + assertEquals("ValidationException", platform.getErrorCode()); + + JsonNode tooLong = objectMapper.readTree(""" + {"platformId":"AWSLambda-SHA384-ECDSA", + "signatureValidityPeriod":{"type":"DAYS","value":9999}} + """); + AwsException validity = assertThrows(AwsException.class, + () -> service.putSigningProfile("MyProfile", tooLong, REGION)); + assertEquals("ValidationException", validity.getErrorCode()); + + AwsException name = assertThrows(AwsException.class, + () -> service.putSigningProfile("bad name?", profileRequest(), REGION)); + assertEquals("ValidationException", name.getErrorCode()); + } + + @Test + void revokeSigningProfileRecordsTheReasonAndRefusesAStaleVersion() throws Exception { + SigningProfile profile = service.putSigningProfile("MyProfile", profileRequest(), REGION); + String revoke = "{\"profileVersion\":\"" + profile.getProfileVersion() + + "\",\"reason\":\"key compromise\",\"effectiveTime\":\"2026-01-01T00:00:00Z\"}"; + + SigningProfile revoked = service.revokeSigningProfile("MyProfile", + objectMapper.readTree(revoke), REGION); + + assertEquals("Revoked", revoked.getStatus()); + assertEquals("key compromise", revoked.getStatusReason()); + assertEquals(1767225600L, revoked.getRevocationEffectiveFrom().longValue()); + assertNotNull(revoked.getRevokedAt()); + + JsonNode stale = objectMapper.readTree( + "{\"profileVersion\":\"aaaaaaaaaa\",\"reason\":\"x\",\"effectiveTime\":\"2026-01-01T00:00:00Z\"}"); + AwsException refused = assertThrows(AwsException.class, + () -> service.revokeSigningProfile("MyProfile", stale, REGION)); + assertEquals("ValidationException", refused.getErrorCode()); + } + + @Test + void profilePermissionsMoveTheRevisionAndRequireTheCurrentOneToRemove() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + String revisionId = service.addProfilePermission("MyProfile", + objectMapper.readTree("{\"action\":\"signer:StartSigningJob\"," + + "\"principal\":\"123456789012\",\"statementId\":\"cross-account\"}"), REGION); + + List permissions = + service.listProfilePermissions("MyProfile", REGION); + assertEquals(1, permissions.size()); + assertEquals("signer:StartSigningJob", permissions.get(0).getAction()); + assertNotNull(revisionId); + + AwsException stale = assertThrows(AwsException.class, + () -> service.removeProfilePermission("MyProfile", "cross-account", "rev-1", REGION)); + assertEquals("ConflictException", stale.getErrorCode()); + + String nextRevision = service.removeProfilePermission( + "MyProfile", "cross-account", revisionId, REGION); + assertFalse(revisionId.equals(nextRevision)); + assertTrue(service.listProfilePermissions("MyProfile", REGION).isEmpty()); + } + + @Test + void aPermissionToSignAPayloadIsGrantedLikeTheOtherActions() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + + String revisionId = service.addProfilePermission("MyProfile", objectMapper.readTree( + "{\"action\":\"signer:SignPayload\",\"principal\":\"123456789012\"," + + "\"statementId\":\"sign-payload\"}"), REGION); + + List permissions = + service.listProfilePermissions("MyProfile", REGION); + assertEquals(1, permissions.size()); + assertEquals("signer:SignPayload", permissions.get(0).getAction()); + assertNotNull(revisionId); + + AwsException refused = assertThrows(AwsException.class, + () -> service.addProfilePermission("MyProfile", objectMapper.readTree( + "{\"action\":\"signer:DeleteSigningProfile\"," + + "\"principal\":\"123456789012\",\"statementId\":\"bogus\"}"), + REGION)); + assertEquals("ValidationException", refused.getErrorCode()); + } + + @Test + void aJobFailsWhenNothingWritesTheSignedObject() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + + SigningJob job = service.startSigningJob(objectMapper.readTree(jobRequest("token-1")), REGION); + + assertEquals("Failed", job.getStatus()); + assertNull(job.getSignedObjectBucketName()); + assertNull(job.getSignedObjectKey()); + assertNull(job.getSignatureExpiresAt()); + assertTrue(job.getStatusReason().contains("does not sign artifacts")); + assertEquals(job.getJobId(), + service.describeSigningJob(job.getJobId(), REGION).getJobId()); + + AwsException refused = assertThrows(AwsException.class, () -> service.revokeSignature( + job.getJobId(), objectMapper.readTree("{\"reason\":\"x\"}"), REGION)); + assertEquals("ValidationException", refused.getErrorCode()); + } + + @Test + void aConfiguredMockJobSucceedsAndCanBeRevoked() throws Exception { + SigningProfile profile = mockSigning.putSigningProfile("MyProfile", profileRequest(), REGION); + + SigningJob job = mockSigning.startSigningJob( + objectMapper.readTree(jobRequest("token-mock")), REGION); + + assertEquals("Succeeded", job.getStatus()); + assertEquals(profile.getProfileVersion(), job.getProfileVersion()); + assertEquals("artifacts", job.getSourceBucketName()); + assertEquals("out/app.zip", job.getSignedObjectKey()); + assertEquals("signed", job.getSignedObjectBucketName()); + assertNotNull(job.getSignatureExpiresAt()); + + SigningJob revoked = mockSigning.revokeSignature(job.getJobId(), + objectMapper.readTree("{\"reason\":\"artifact withdrawn\"}"), REGION); + assertTrue(revoked.isRevoked()); + assertEquals("artifact withdrawn", revoked.getRevocationReason()); + } + + @Test + void startSigningJobRefusesARevokedProfileAndAMissingSource() throws Exception { + SigningProfile profile = service.putSigningProfile("MyProfile", profileRequest(), REGION); + service.revokeSigningProfile("MyProfile", objectMapper.readTree( + "{\"profileVersion\":\"" + profile.getProfileVersion() + + "\",\"reason\":\"retired\",\"effectiveTime\":\"2026-01-01T00:00:00Z\"}"), + REGION); + + AwsException revoked = assertThrows(AwsException.class, () -> service.startSigningJob( + objectMapper.readTree("{\"profileName\":\"MyProfile\",\"source\":{\"s3\":" + + "{\"bucketName\":\"a\",\"key\":\"k\",\"version\":\"1\"}}," + + "\"destination\":{\"s3\":{\"bucketName\":\"b\"}}," + + "\"clientRequestToken\":\"token-revoked\"}"), REGION)); + assertEquals("ValidationException", revoked.getErrorCode()); + + service.putSigningProfile("Other", profileRequest(), REGION); + AwsException noVersion = assertThrows(AwsException.class, () -> service.startSigningJob( + objectMapper.readTree("{\"profileName\":\"Other\",\"source\":{\"s3\":" + + "{\"bucketName\":\"a\",\"key\":\"k\"}}," + + "\"destination\":{\"s3\":{\"bucketName\":\"b\"}}," + + "\"clientRequestToken\":\"token-no-version\"}"), REGION)); + assertEquals("ValidationException", noVersion.getErrorCode()); + } + + @Test + void listsPageAndFilterByPlatformAndRegion() throws Exception { + service.putSigningProfile("Alpha", profileRequest(), REGION); + service.putSigningProfile("Beta", profileRequest(), REGION); + service.putSigningProfile("Gamma", objectMapper.readTree( + "{\"platformId\":\"Notation-OCI-SHA384-ECDSA\"}"), REGION); + + SignerService.Page firstPage = + service.listSigningProfiles(REGION, null, null, false, 2, null); + assertEquals(2, firstPage.items().size()); + assertEquals("Alpha", firstPage.items().get(0).getProfileName()); + assertNotNull(firstPage.nextToken()); + + SignerService.Page secondPage = + service.listSigningProfiles(REGION, null, null, false, 2, firstPage.nextToken()); + assertEquals(1, secondPage.items().size()); + assertEquals("Gamma", secondPage.items().get(0).getProfileName()); + assertNull(secondPage.nextToken()); + + SignerService.Page byPlatform = service.listSigningProfiles( + REGION, "Notation-OCI-SHA384-ECDSA", null, false, MAX_PAGE, null); + assertEquals(1, byPlatform.items().size()); + + assertTrue(service.listSigningProfiles("eu-west-1", null, null, false, MAX_PAGE, null) + .items().isEmpty()); + } + + @Test + void tagsAreManagedThroughTheSharedTagHandler() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + + service.tagResource(REGION, PROFILE_ARN, Map.of("team", "platform")); + Map tags = service.listTags(REGION, PROFILE_ARN); + assertEquals("platform", tags.get("team")); + assertEquals("test", tags.get("env")); + + service.untagResource(REGION, PROFILE_ARN, List.of("env")); + assertEquals(Map.of("team", "platform"), service.listTags(REGION, PROFILE_ARN)); + + assertEquals("signer", service.serviceKey()); + } + + @Test + void cancelKeepsTheProfileAsCanceledAndStopsNewJobs() throws Exception { + SigningProfile active = service.putSigningProfile("MyProfile", profileRequest(), REGION); + + service.cancelSigningProfile("MyProfile", REGION); + + SigningProfile canceled = service.getSigningProfile("MyProfile", REGION); + assertEquals("Canceled", canceled.getStatus()); + assertEquals(active.getArn(), canceled.getArn()); + assertEquals(active.getProfileVersion(), canceled.getProfileVersion()); + assertTrue(service.listSigningProfiles(REGION, null, null, null, MAX_PAGE, null).items().isEmpty()); + assertEquals(1, service.listSigningProfiles(REGION, null, null, true, MAX_PAGE, null) + .items().size()); + assertEquals(1, service.listSigningProfiles(REGION, null, List.of("Canceled"), null, + MAX_PAGE, null).items().size()); + + AwsException noJob = assertThrows(AwsException.class, + () -> service.startSigningJob(objectMapper.readTree(jobRequest("token-canceled")), REGION)); + assertEquals("ValidationException", noJob.getErrorCode()); + + // Cancelling again is a no-op, and a put brings the name back as a new active version. + service.cancelSigningProfile("MyProfile", REGION); + assertEquals("Canceled", service.getSigningProfile("MyProfile", REGION).getStatus()); + assertEquals("Active", service.putSigningProfile("MyProfile", profileRequest(), REGION) + .getStatus()); + } + + @Test + void aRevokedProfileCannotBeCanceledAndForeignArnsAreRefused() throws Exception { + SigningProfile profile = service.putSigningProfile("MyProfile", profileRequest(), REGION); + service.revokeSigningProfile("MyProfile", objectMapper.readTree( + "{\"profileVersion\":\"" + profile.getProfileVersion() + + "\",\"reason\":\"retired\",\"effectiveTime\":\"2026-01-01T00:00:00Z\"}"), + REGION); + + AwsException revoked = assertThrows(AwsException.class, + () -> service.cancelSigningProfile("MyProfile", REGION)); + assertEquals("ConflictException", revoked.getErrorCode()); + + AwsException foreign = assertThrows(AwsException.class, () -> service.listTags(REGION, + "arn:aws:signer:us-east-1:" + ACCOUNT + ":/signing-jobs/not-a-profile")); + assertEquals("ValidationException", foreign.getErrorCode()); + } + + private JsonNode profileRequest() throws Exception { + return objectMapper.readTree(""" + {"platformId":"AWSLambda-SHA384-ECDSA", + "signingMaterial":{"certificateArn":"arn:aws:acm:us-east-1:000000000000:certificate/abc"}, + "signatureValidityPeriod":{"type":"DAYS","value":135}, + "overrides":{"signingConfiguration":{"hashAlgorithm":"SHA-384"}, + "signingImageFormat":"JSON"}, + "signingParameters":{"SignatureFormat":"SHA-384"}, + "tags":{"env":"test"}} + """); + } + + @Test + void rePuttingAProfileKeepsTheMembersTheRequestOmits() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + + service.putSigningProfile("MyProfile", objectMapper.readTree( + "{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}"), REGION); + + SigningProfile reread = service.getSigningProfile("MyProfile", REGION); + assertEquals(CERT_ARN, reread.getSigningMaterialCertificateArn()); + assertEquals("SHA-384", reread.getOverrides().path("signingConfiguration") + .path("hashAlgorithm").asText()); + assertEquals("SHA-384", reread.getSigningParameters().get("SignatureFormat")); + } + + @Test + void tagKeysFollowTheAwsPattern() throws Exception { + SigningProfile profile = service.putSigningProfile("MyProfile", objectMapper.readTree(""" + {"platformId":"AWSLambda-SHA384-ECDSA", + "tags":{"Env1":"a","k8s-app":"b","owner/team:x":"c"}} + """), REGION); + + assertEquals("a", profile.getTags().get("Env1")); + assertEquals("b", profile.getTags().get("k8s-app")); + + for (String rejected : new String[] {"Cost Center", "owner@team"}) { + AwsException e = assertThrows(AwsException.class, () -> service.putSigningProfile( + "MyProfile", objectMapper.readTree("{\"platformId\":\"AWSLambda-SHA384-ECDSA\"," + + "\"tags\":{\"" + rejected + "\":\"x\"}}"), REGION)); + assertEquals("ValidationException", e.getErrorCode(), rejected); + } + } + + @Test + void theClientRequestTokenMakesStartSigningJobIdempotent() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + JsonNode request = objectMapper.readTree(jobRequest("token-same")); + + SigningJob first = service.startSigningJob(request, REGION); + SigningJob retried = service.startSigningJob(request, REGION); + + assertEquals(first.getJobId(), retried.getJobId()); + assertEquals(1, service.listSigningJobs(REGION, null, null, null, MAX_PAGE, null).items().size()); + + AwsException missingToken = assertThrows(AwsException.class, + () -> service.startSigningJob(objectMapper.readTree(""" + {"profileName":"MyProfile", + "source":{"s3":{"bucketName":"artifacts","key":"app.zip","version":"1"}}, + "destination":{"s3":{"bucketName":"signed"}}} + """), REGION)); + assertEquals("ValidationException", missingToken.getErrorCode()); + } + + @Test + void anArnFromAnotherAccountIsRefused() throws Exception { + service.putSigningProfile("MyProfile", profileRequest(), REGION); + + AwsException foreign = assertThrows(AwsException.class, () -> service.listTags(REGION, + "arn:aws:signer:us-east-1:999999999999:/signing-profiles/MyProfile")); + + assertEquals("ResourceNotFoundException", foreign.getErrorCode()); + assertEquals("test", service.listTags(REGION, PROFILE_ARN).get("env")); + } + + @Test + void aJobWithoutAValidityPeriodUsesTheDefaultSignerApplies() throws Exception { + service.putSigningProfile("MyProfile", objectMapper.readTree( + "{\"platformId\":\"AWSLambda-SHA384-ECDSA\"}"), REGION); + + SigningJob job = mockSigning.startSigningJob( + objectMapper.readTree(jobRequest("token-default")), REGION); + + assertNotNull(job.getSignatureExpiresAt()); + long days = (job.getSignatureExpiresAt().longValue() - job.getCreatedAt().longValue()) / 86_400L; + assertTrue(days > 3_000L, "expected the 135 month default, got " + days + " days"); + } + + @Test + void aJobOnAPlatformWithoutRevocationCannotBeRevoked() throws Exception { + mockSigning.putSigningProfile("IotProfile", objectMapper.readTree( + "{\"platformId\":\"AWSIoTDeviceManagement-SHA256-ECDSA\"}"), REGION); + SigningJob job = mockSigning.startSigningJob( + objectMapper.readTree(jobRequest("token-iot", "IotProfile")), REGION); + + assertNull(job.getSignatureExpiresAt()); + AwsException refused = assertThrows(AwsException.class, () -> mockSigning.revokeSignature( + job.getJobId(), objectMapper.readTree("{\"reason\":\"x\"}"), REGION)); + assertEquals("ValidationException", refused.getErrorCode()); + } + + private static String jobRequest(String token) { + return jobRequest(token, "MyProfile"); + } + + private static String jobRequest(String token, String profileName) { + return "{\"profileName\":\"" + profileName + "\"," + + "\"source\":{\"s3\":{\"bucketName\":\"artifacts\",\"key\":\"app.zip\",\"version\":\"1\"}}," + + "\"destination\":{\"s3\":{\"bucketName\":\"signed\",\"prefix\":\"out/\"}}," + + "\"clientRequestToken\":\"" + token + "\"}"; + } +} diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index c2d0d6dae1..e9872010d8 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -559,6 +559,8 @@ floci: enabled: true dlm: enabled: true + signer: + enabled: true cognitoidentity: enabled: true globalaccelerator: diff --git a/src/test/resources/cloudformation/writable-property-gaps.tsv b/src/test/resources/cloudformation/writable-property-gaps.tsv index 39f9480eda..7155750c7f 100644 --- a/src/test/resources/cloudformation/writable-property-gaps.tsv +++ b/src/test/resources/cloudformation/writable-property-gaps.tsv @@ -641,7 +641,6 @@ AWS::SecretsManager::Secret Type accepted and ignored AWS::ServiceDiscovery::PrivateDnsNamespace Properties accepted and ignored AWS::ServiceDiscovery::PublicDnsNamespace Properties accepted and ignored AWS::ServiceDiscovery::Service ServiceAttributes accepted and ignored -AWS::Signer::SigningProfile Tags accepted and ignored: Floci has no Signer API to tag AWS::Transfer::Server Certificate rejected with a ValidationError, not supported by Floci AWS::Transfer::Server CreateWithHostKey rejected with a ValidationError, not supported by Floci AWS::Transfer::Server IpAddressType rejected with a ValidationError, not supported by Floci diff --git a/tools/aws/regen_iam_request_resources.py b/tools/aws/regen_iam_request_resources.py index df4fd311ec..8df95f4943 100644 --- a/tools/aws/regen_iam_request_resources.py +++ b/tools/aws/regen_iam_request_resources.py @@ -162,7 +162,7 @@ NAMESPACES = ("access-analyzer", "acm", "application-autoscaling", "athena", "bc "cognito-idp", "cur", "datasync", "ecr", "elasticloadbalancing", "elasticmapreduce", "es", "events", "firehose", "globalaccelerator", "kinesisanalytics", "payment-cryptography", "quicksight", "redshift", "redshift-data", "rekognition", "servicediscovery", "servicequotas", "sso", "states", "textract", - "timestream-influxdb", "translate") + "timestream-influxdb", "translate", "signer") # SDK clients the reference lists for a namespace's operations whose requests Floci does not serve, and why: their # members are not read. diff --git a/tools/aws/regen_iam_tag_on_create.py b/tools/aws/regen_iam_tag_on_create.py index 4c4e340571..0e12654fac 100644 --- a/tools/aws/regen_iam_tag_on_create.py +++ b/tools/aws/regen_iam_tag_on_create.py @@ -111,7 +111,7 @@ NAMESPACES = ( "elasticmapreduce", "es", "events", "firehose", "globalaccelerator", "glue", "iam", "kinesis", "kinesisanalytics", "kms", "lambda", "lightsail", "logs", "memorydb", "network-firewall", "organizations", "payment-cryptography", "pipes", "rds", "redshift", "redshift-serverless", "rekognition", "resource-groups", "route53resolver", - "sagemaker", "scheduler", "secretsmanager", "servicediscovery", "ses", "sns", "sqs", "ssm", "sso", "states", + "sagemaker", "scheduler", "secretsmanager", "servicediscovery", "ses", "signer", "sns", "sqs", "ssm", "sso", "states", "sts", "swf", "textract", "timestream-influxdb", "transcribe", "transfer", "translate", "wafv2", ) diff --git a/tools/aws/regen_rest_routes.py b/tools/aws/regen_rest_routes.py index 75abbdd376..4966c533c5 100644 --- a/tools/aws/regen_rest_routes.py +++ b/tools/aws/regen_rest_routes.py @@ -66,6 +66,7 @@ MODELS: dict[str, str] = { "s3": "s3", "s3control": "s3", "scheduler": "scheduler", + "signer": "signer", } # The models whose routes are rewritten onto an internal prefix, and the prefix they are rewritten @@ -76,6 +77,19 @@ INTERNAL_ROUTES: dict[str, tuple[str, bool]] = { # them onto, and the key they name is an ARN, whose slashes the rewritten path holds: the label # spans them, as the controller's own path does. "payment-cryptography-data": ("/_paymentcryptography", True), + # Signer's routes collide with S3's path-style ones and are rewritten onto the prefix its route + # filter owns, so its routes are vendored as the rewritten path: the action and the request's + # resource labels both resolve from it. + "signer": ("/_signer", False), +} + + +# Operations a model does not serve itself, so their path is not rewritten onto its internal prefix. +# The shared tags controller serves /tags/{resourceArn} for every service that is a TagHandler, and +# the service's route filter leaves that path alone; prefixing it here would advertise a route no +# request ever arrives on, and the IAM check would find no rule for it. +SHARED_ROUTES: dict[str, frozenset[str]] = { + "signer": frozenset({"TagResource", "UntagResource", "ListTagsForResource"}), } @@ -105,10 +119,17 @@ def build(models: dict[str, dict], provenance: str) -> dict: if model["metadata"].get("protocol") not in ("rest-json", "rest-xml"): raise SystemExit(f"error: {name} is not a REST model") prefix, arn_labels = INTERNAL_ROUTES.get(name, ("", False)) + shared = SHARED_ROUTES.get(name, frozenset()) operations = {} for operation in sorted(model["operations"]): http = model["operations"][operation]["http"] - request_uri = prefix + http["requestUri"] + if operation in shared: + request_uri = http["requestUri"] + # A shared tags route names its resource as an ARN, which holds slashes: the label + # has to span them or the route matches no tag request at all. + request_uri = re.sub(r"\{([^}]*[Aa]rn[^}]*)}", r"{\1+}", request_uri) + else: + request_uri = prefix + http["requestUri"] if arn_labels: # A label holding an ARN spans the slashes the ARN holds, which the rewritten path # holds as they are. diff --git a/tools/docs/services.yaml b/tools/docs/services.yaml index caccdcd16c..44f0fcdb70 100644 --- a/tools/docs/services.yaml +++ b/tools/docs/services.yaml @@ -185,6 +185,19 @@ services: - TagResourceByBody - TagResourcePut - UntagResourceByQuery + - service: signer + doc: docs/services/signer.md + sources: + - { path: services/signer/SignerController.java, mode: rest } + - { path: core/common/SharedTagsController.java, mode: rest } + rename_actions: + ListTags: ListTagsForResource + TagResourcePost: TagResource + exclude_actions: + - ListTagsByQuery + - TagResourceByBody + - TagResourcePut + - UntagResourceByQuery - service: dlm doc: docs/services/dlm.md sources: