Skip to content

fix(s3): remove ChecksumAlgorithm #603

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 2 commits into from
Jun 2, 2025

Conversation

michael-todorovic
Copy link
Contributor

Fixes #602 by checking ChecksumAlgorithmSha256 support on the s3 bucket
The check is made only on datastore startup

@github-project-automation github-project-automation bot moved this to 📋 Backlog in burrito May 22, 2025
@LucasMrqes
Copy link
Collaborator

Looks like it was introduced in #588, thanks for catching all bugs related to on-prem S3 ! We might add some test suites with several S3 backends to catch this kind of issues

LucasMrqes
LucasMrqes previously approved these changes May 22, 2025
@codecov-commenter
Copy link

codecov-commenter commented May 22, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 44.92%. Comparing base (6ebc0ea) to head (07c1f38).

Files with missing lines Patch % Lines
internal/datastore/storage/s3/s3.go 0.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #603   +/-   ##
=======================================
  Coverage   44.91%   44.92%           
=======================================
  Files          79       79           
  Lines        5762     5761    -1     
=======================================
  Hits         2588     2588           
+ Misses       2959     2958    -1     
  Partials      215      215           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@michael-todorovic
Copy link
Contributor Author

You're welcome :) I was thinking about adding some unit tests around this but I have nothing easy right now 😄

To me, a mock would unlikely fit in such case.
I can see there are several tools to mimic CSP buckets that could be tried. For on prem, I'd say an ephemeral container for ceph+minio (major on-prem providers) would be good enough.

Wdyt? If that sounds like a plan, I can try to build the tests at some point 😄

@corrieriluca
Copy link
Member

corrieriluca commented May 23, 2025

Indeed, this bug was introduced with #588.

To be honest I don't think the right fix is to check is the SHA256 algorithm is present with a fake object Put/Delete at each startup of the datastore...

I checked in the code, turns out we don't really use the checksum of object storage backends in any way.

In #588 I added the below lines because I wanted to make S3 on pair with GCS and Azure backends (which automatically provide MD5 checksums of objects, in my understanding):

// S3 returns a checksum only if the object was uploaded with one
if result.ChecksumSHA256 == nil {
return make([]byte, 0), nil
}
return []byte(*result.ChecksumSHA256), nil

But since in the datastore client we don't read this value and only return a boolean, I think we should remove completely the usage of the ChecksumAlgorithm parameter in the PutObjectInput structure:

ChecksumAlgorithm: types.ChecksumAlgorithmSha256,

This will ease the implementation of the S3 backend and make it (I hope) universally compliant to multiple S3 implementations.

WDYT @michael-todorovic @LucasMrqes ?

I agree on the need to test Ceph and MinIO in ephemeral containers though 😄

@michael-todorovic
Copy link
Contributor Author

With Terraform 1.11.2, they bumped the aws sdk which has the same exact feat and it broke with our ceph with the same log 😄
I don't know why aws added it but maybe it's worth checking why.
If the sha256 thing is the future at aws, I think it could be kept in burrito and controlled through a config instead of the automated check :)

@michael-todorovic
Copy link
Contributor Author

It seems like they're not planning to change anything anytime soon. I'll update this PR then :)

@michael-todorovic michael-todorovic force-pushed the fix/s3-sha256 branch 3 times, most recently from 8c38810 to dad91be Compare May 27, 2025 06:31
@michael-todorovic michael-todorovic changed the title fix(s3): check for ChecksumAlgorithmSha256 support fix(s3): remove ChecksumAlgorithm May 27, 2025
@corrieriluca corrieriluca moved this from 📋 Backlog to 🏗 In progress in burrito May 30, 2025
@corrieriluca corrieriluca merged commit 5ac921c into padok-team:main Jun 2, 2025
5 of 7 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in burrito Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

datastore: api error XAmzContentSHA256Mismatch: UnknownError
4 participants