Repository navigation
fix: mint default KMS key ARNs in the region's partition and convert the remaining hardcoded partitions - #2590
Merged
Merged
Conversation
RDS, EFS, MSK and Timestream synthesized default or expanded KMS key ARNs with a hardcoded aws partition, so a cn-/us-gov- resource pointed at a key ARN KMS itself would never produce. They now build it with fakecloud_kms::kms_key_arn / kms_alias_arn, byte-identical in commercial regions.
…rdcoded partitions Export SNS topic_arn, EventBridge bus_arn/rule_arn, CloudWatch alarm_arn and SSM param_arn at their crate roots so the CloudFormation provisioner can build the same ARNs the services do. Athena workgroup, data catalog and capacity reservation ARNs now take the region's partition, and a Bedrock prompt router's default model ARN is built in the router's own region and partition instead of a fixed arn:aws:bedrock:us-east-1 one.
Build the default KMS key ARNs in RDS, EFS, MSK and Timestream with Arn::regional directly so those crates do not pull fakecloud-kms (and its crypto dependencies) into their build graph; fakecloud-kms stays a dev-dependency for the equality tests. Parse the Bedrock prompt router ARN with Arn's FromStr and fall back to the request's region, not a fixed us-east-1, when it does not parse. Collapse Athena's three ARN builders into one athena_arn, exported at the crate root for the CloudFormation provisioner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final service-side pass of the ARN partition campaign (after #2569, #2570, #2572, #2574, #2577, #2578, #2580). The CloudFormation provisioner follows in a separate PR that calls the builders exported here.
KMS consumers
format_kms_arn(key ids andalias/...), the EFS defaultKmsKeyId, Kafka's default data-volume key and Timestream's default database key are built asArn::regional("kms", region, account, "key/<id>"), the same form KMS itself mints, so they're in the region's partition.fakecloud-kmsis only a dev-dependency (tests assert equality withkms_key_arn).Remaining hardcoded partitions
athena_arn.arn:aws:bedrock:us-east-1:.... Behavior change in commercial regions: a router outside us-east-1 now reports its own region in that ARN.Builders exported for the CloudFormation provisioner (output unchanged): SNS
topic_arn, EventBridgebus_arn/rule_arn, CloudWatchalarm_arn, SSMparam_arn, Athenaathena_arn.Deliberately left
aws(sweep of every runtimearn:aws:outside CloudFormation): the S3 SSE-KMS and SES-inbound encryption-context bucket ARN (encrypt and decrypt must agree for stored objects), the anonymous S3 probe in core dispatch, a discarded AWS-managed-policy fallback in STS, and Step Functions' internals3:getObject/putObjectdefaults (only substring-matched).fakecloud-identitystorebuilds and reads no ARNs.No surface changes.
Test plan
kms_key_arn, us-east-1 unchanged), Athena (builders + tag round-trip on theaws-cnARN), Bedrock router default model (get/list, region fallback). All fail without the change.cargo teston the touched crates,cargo clippy --all-targets -D warnings,cargo fmt --check,scripts/publish-crates.sh --check,cargo check --workspace --all-targets.Summary by cubic
Fixes synthesized ARNs to use the region's partition, so resources in China and GovCloud get ARNs that match what the services themselves mint. Exports partition-aware ARN builders for the CloudFormation provisioner.
Bug Fixes
us-east-1(behavior change for commercial routers outsideus-east-1).Written for commit cc5d3d1. Summary will update on new commits.