-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(s3-notifications): fixing circular dependency when Bucket and SQS are encrypted by same KMS is used for s3 notification #31155
Conversation
…d SQS are encrypted by same KMS is used for s3 notification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
const warning = 'Consider passing \`shouldAddGlobalS3PermissionToKMSandSQS:false\` and add restricted permission with condition - \'aws:SourceArn\': bucket.bucketArn'; | ||
Annotations.of(_scope).addWarningV2('@aws-cdk/aws-s3-notifications:securityWarning', warning); | ||
} else { | ||
// If user didn't want this to be Global, then we will show CRITICAL warning calling out to add | ||
// the required permission without using imported values. | ||
const warning = 'You have opted out to add global permission for KMS & SQS Key Policy. Consider manually adding kms.grantEncryptDecrypt(), queue.grantSendMessages()'; | ||
Annotations.of(_scope).addWarningV2('@aws-cdk/aws-s3-notifications:sqsKMSPermissionsNotAdded', warning); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to tell the user that this is a better way of implementing this, it's probably best if we have a new integration test that does it and ensures that it works. I'm not entirely sure that I understand how moving this condition out of the SqsDestination.bind
method and making the user do it manually actually resolves the circular dependency while still allowing the more specific policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure that I understand how moving this condition out of the SqsDestination.bind method and making the user do it manually actually resolves the circular dependency while still allowing the more specific policy
So, Given the Condition, we can't depend on Class's members to get the name, to add the policy like us do in CDK by itself.
There are 2 ways,
- User Needs to add the permissions by himself, as a constant defined by himself (this will relax the Circular dependency between both), Only thing I am seeing here is, At this moment, we can't make CDK to do this automatically.
- Allow Global access.
What are we trying to resolve here is, "cdk deploy" is even failing at this moment.
@laurelmay Please let me know wether there is any suggested alternatives.
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
Comments on closed issues and PRs are hard for our team to see. |
Issue #3067
Closes #3067
If you are reading this from discussion redirection (or landed here from searching in issue) run
cdk synth
in your app and look for warning displayed and look for@aws-cdk/aws-s3-notifications
. You will find out the solution.Reason for this change
cdk deploy
, when we use same same KMS for S3 and SQS.So, we need to draw a fair line on how to handle this. approaches considered,
Description of changes
shouldAddGlobalS3PermissionToKMSandSQS
, defaulted totrue
, as it will be backward compatiblecdk synth
false
is provided, as they will try to add imported Bucket Value to add permissionDescription of how you validated changes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license