-
Notifications
You must be signed in to change notification settings - Fork 2
Fix "x-amz-server-side-encryption header is not supported for this operation" errors #181
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
Merged
Merged
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,7 +258,6 @@ def setup_kms_encryption_on_bucket(bucket_name: str) -> None: | |
| # The deny in this policy fires when the headers are present but wrong (e.g. trying not to use | ||
| # KMS encryption, or trying to use a different KMS key). If the headers are absent, the request | ||
| # is accepted and AWS falls back on the bucket's default encryption (set above). | ||
| # TODO: stop specifying the KMS key in the funnel config | ||
| new_bucket_policy = { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
|
|
@@ -301,8 +300,6 @@ def setup_kms_encryption_on_bucket(bucket_name: str) -> None: | |
| else: | ||
| logger.debug("Bucket policy is already up to date") | ||
|
|
||
| return kms_key_arn | ||
|
|
||
|
|
||
| def enable_bucket_versioning(bucket_name: str) -> None: | ||
| """ | ||
|
|
@@ -330,7 +327,7 @@ def enable_bucket_versioning(bucket_name: str) -> None: | |
| raise | ||
|
|
||
|
|
||
| async def _create_user_bucket(user_id: str) -> Tuple[str, str]: | ||
| async def _create_user_bucket(user_id: str) -> str: | ||
| """ | ||
| Create an S3 bucket for the specified user and return information about the bucket. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe update the docstring to show that only bucket_name is returned. |
||
|
|
||
|
|
@@ -402,9 +399,8 @@ async def _create_user_bucket(user_id: str) -> Tuple[str, str]: | |
| ChecksumAlgorithm="SHA256", | ||
| ) | ||
|
|
||
| kms_key_arn = None | ||
| if config["KMS_ENCRYPTION_ENABLED"]: | ||
| kms_key_arn = setup_kms_encryption_on_bucket(user_bucket_name) | ||
| setup_kms_encryption_on_bucket(user_bucket_name) | ||
| else: | ||
| logger.warning(f"Disabling KMS encryption on bucket '{user_bucket_name}'") | ||
| clients.s3_client.delete_bucket_encryption(Bucket=user_bucket_name) | ||
|
|
@@ -414,7 +410,7 @@ async def _create_user_bucket(user_id: str) -> Tuple[str, str]: | |
| # Bucket versioning is necessary for S3Files | ||
| enable_bucket_versioning(user_bucket_name) | ||
|
|
||
| return user_bucket_name, kms_key_arn | ||
| return user_bucket_name | ||
|
|
||
|
|
||
| async def create_user_bucket(user_id: str) -> Tuple[str, str, str]: | ||
|
|
@@ -435,9 +431,9 @@ async def create_user_bucket(user_id: str) -> Tuple[str, str, str]: | |
| retry_backoff_factor = 2 | ||
| for attempt in range(1, max_tries + 1): | ||
| try: | ||
| bucket_info = await _create_user_bucket(user_id) | ||
| USER_BUCKET_CACHE.set(user_id, bucket_info) | ||
| return bucket_info | ||
| bucket_name = await _create_user_bucket(user_id) | ||
| USER_BUCKET_CACHE.set(user_id, bucket_name) | ||
| return bucket_name | ||
| except ClientError as e: | ||
| if ( | ||
| e.response["Error"]["Code"] | ||
|
|
||
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
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.
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.
^ doing this TODO fixed the issue