-
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(cli): assets are KMS-encrypted using wrong key #18340
Conversation
Even though a custom KMS key is specified as the default encryption key on the file assets bucket, all uploaded assets are encrypted using the default key. The reason is that in #17668 we added an explicit `encryption: kms` parameter to the `putObject` operation, so that an SCP that is commonly in use across large organizations to prevent files from ending up unencrypted, can be used (the SCP can only validate call parameters, such as whether the `putObject` call includes the parameter that reuests encryption, not the effective end result, such as whether a file would end up encrypted). However, we did not include the KMS Key Id into the `putObject` request, which caused S3 to fall back to the default key. Solution: also look up the key id and pass that along as well. Fixes #18262.
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
type BucketEncryption = | ||
| { readonly type: 'no_encryption' } | ||
| { readonly type: 'aes256' } | ||
| { readonly type: 'kms'; readonly kmsKeyId?: string } | ||
| { readonly type: 'access_denied' } | ||
| { readonly type: 'does_not_exist' } | ||
; |
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.
Kinda sorta wonder why you didn't go and turn the type
field into a constant... To keep compile-time referential checks in place?
Although I guess the TypeScript type checker still achieves the same outcome with this declaration.
Fun times
|
Choo choo all aboard the merge train |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Even though a custom KMS key is specified as the default encryption key on the file assets bucket, all uploaded assets are encrypted using the default key. The reason is that in aws#17668 we added an explicit `encryption: kms` parameter to the `putObject` operation, so that an SCP that is commonly in use across large organizations to prevent files from ending up unencrypted, can be used (the SCP can only validate call parameters, such as whether the `putObject` call includes the parameter that reuests encryption, not the effective end result, such as whether a file would end up encrypted). However, we did not include the KMS Key Id into the `putObject` request, which caused S3 to fall back to the default key. Solution: also look up the key id and pass that along as well. Fixes aws#18262. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Even though a custom KMS key is specified as the default encryption key
on the file assets bucket, all uploaded assets are encrypted using the
default key.
The reason is that in #17668 we added an explicit
encryption: kms
parameter to the
putObject
operation, so that an SCP that iscommonly in use across large organizations to prevent files from
ending up unencrypted, can be used (the SCP can only validate
call parameters, such as whether the
putObject
call includesthe parameter that reuests encryption, not the effective end result,
such as whether a file would end up encrypted).
However, we did not include the KMS Key Id into the
putObject
request, which caused S3 to fall back to the default key.
Solution: also look up the key id and pass that along as well.
Fixes #18262.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license