Skip to content
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

S3 - Encryption context header cannot be null #5089

Merged

Conversation

avestuk
Copy link
Contributor

@avestuk avestuk commented Jan 21, 2022

  • I added CHANGELOG entry for this change.

Changes

The X-Amz-Server-Side-Encryption-Context header should be a base64 encoded string representing a string-string
map. In the case that the KMSEncryptionContext was omitted from Objstore config when SSE-KMS was being used, a nil map was being used for the header value resulting in a value of null. This is the issue that was causing #4245

I have made a change such that if no KMSEncryptionContext was passed in the config an empty map is used instead so the header value is correctly set to {}.

Verification

I've extended an existing test case to cover my changes, additionally I tested this in practice as described in #4245 - A header value of {} is acceptable to the AWS API.

The header should be base64 encoded string representing a string-string
map. This requires us to create an empty map for the
KMSEncryptionContext if no KMSEncryptionContext was passed in the config

Signed-off-by: Alex Vest <alex.vest@nutmeg.com>
Signed-off-by: Alex Vest <alex.vest@nutmeg.com>
GiedriusS
GiedriusS previously approved these changes Jan 25, 2022
@GiedriusS GiedriusS enabled auto-merge (squash) January 25, 2022 14:32
Alex Vest added 2 commits January 25, 2022 15:58
golangci lint was complaining

Signed-off-by: Alex Vest <alex.vest@nutmeg.com>
Signed-off-by: Alex Vest <alex.vest@nutmeg.com>
auto-merge was automatically disabled January 25, 2022 15:59

Head branch was pushed to by a user without write access

@GiedriusS GiedriusS merged commit 2e86dc0 into thanos-io:main Jan 26, 2022
Nicholaswang pushed a commit to Nicholaswang/thanos that referenced this pull request Mar 6, 2022
* Encryption context header cannot be null

The header should be base64 encoded string representing a string-string
map. This requires us to create an empty map for the
KMSEncryptionContext if no KMSEncryptionContext was passed in the config

Signed-off-by: Alex Vest <alex.vest@nutmeg.com>

* Add changes to changelog

Signed-off-by: Alex Vest <alex.vest@nutmeg.com>

* Add const for "localhost:80"

golangci lint was complaining

Signed-off-by: Alex Vest <alex.vest@nutmeg.com>

* Docs formatting

Signed-off-by: Alex Vest <alex.vest@nutmeg.com>
Signed-off-by: Nicholaswang <wzhever@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants