fix(datazone): add Bedrock KMS authorization for tooling key and provisioning role#47
Open
marcinc wants to merge 2 commits into
Open
fix(datazone): add Bedrock KMS authorization for tooling key and provisioning role#47marcinc wants to merge 2 commits into
marcinc wants to merge 2 commits into
Conversation
…isioning role Three gaps in the KMS authorization chain prevented Bedrock blueprint environments (AmazonBedrockGuardrail, AmazonBedrockKnowledgeBase, etc.) from deploying: 1. The tooling KMS key policy lacked a bedrock.amazonaws.com principal statement. Bedrock calls kms:GenerateDataKey/kms:Decrypt/kms:DescribeKey as a service principal when creating CMK-encrypted resources; without this grant the CF resource handler fails with AccessDeniedException. Scoped to the domain account via aws:SourceAccount. 2. The ToolingKmsCreateGrant statement in domainKmsAdminPolicy was incomplete: kms:RetireGrant was missing (so CF cannot retire grants on resource deletion), the condition used StringLike instead of StringEquals for kms:CallerAccount (semantically imprecise for an exact-match), and kms:GrantIsForAWSResource was absent (allowing arbitrary non-service grants on the tooling key). 3. The default blueprint provisioning role (domainDefaultBlueprintProvisioningRole) was not attached to the kms-admin managed policy, so kms:CreateGrant was denied at IAM evaluation before the key policy was consulted. The cross-account provisioning role already had this attachment; the primary account path did not. Tests: - datazone-l3-construct.test.ts: assert BedrockEncryption statement on tooling key and kms-admin policy attachment on the default provisioning role - app.test.ts and sm-studio-domain.test.ts: Lambda/Docker mocks to prevent test failures in environments without a Docker daemon
…changes Regenerated sagemaker app diff baselines to include the KMS policy changes from the datazone L3 construct fix: StringLike→StringEquals for kms:CallerAccount, added kms:RetireGrant and GrantIsForAWSResource condition to ToolingKmsCreateGrant, added kms-admin policy on the default blueprint provisioning role, and added BedrockEncryption KMS statement for bedrock.amazonaws.com.
9218d9b to
8f01e66
Compare
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.
Issue #, if available: #46
Addresses three gaps in the KMS authorization chain preventing Bedrock blueprint environments (AmazonBedrockGuardrail, AmazonBedrockKnowledgeBase, etc.) from deploying
Description of changes:
The tooling KMS key policy lacked a
bedrock.amazonaws.comprincipal statement. Bedrock callskms:GenerateDataKey/kms:Decrypt/kms:DescribeKeyas a service principal when creating CMK-encrypted resources; without this grant the CF resource handler fails withAccessDeniedException. Scoped to the domain account viaaws:SourceAccount.The
ToolingKmsCreateGrantstatement indomainKmsAdminPolicywas incomplete:kms:RetireGrantwas missing (so CF cannot retire grants on resource deletion), the condition usedStringLikeinstead ofStringEqualsforkms:CallerAccount(semantically imprecise for an exact-match), andkms:GrantIsForAWSResourcewas absent (allowing arbitrary non-service grants on the tooling key).The default blueprint provisioning role (
domainDefaultBlueprintProvisioningRole) was not attached to the kms-admin managed policy, sokms:CreateGrantwas denied at IAM evaluation before the key policy was consulted. The cross-account provisioning role already had this attachment; the primary account path did not.Tests:
datazone-l3-construct.test.ts: assert BedrockEncryption statement on tooling key and kms-admin policy attachment on the default provisioning roleapp.test.tsandsm-studio-domain.test.ts: Lambda/Docker mocks to prevent test failures in environments without a Docker daemonBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.