-
Notifications
You must be signed in to change notification settings - Fork 393
Add S3 guard to prevent publishing existing JARs #9492
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
Draft
Ben-El
wants to merge
27
commits into
master
Choose a base branch
from
test-public-bucket
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+16
−8
Conversation
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
… mapping in Makefile
…oved accuracy and error handling in Makefile
…n, additional debug logs, and stricter error handling
…ivation logic, fallback handling, and additional debug logs
…d key derivation processes and improving error handling.
… debug logs and simplifying host, bucket, and key derivation processes.
… and enhancing error messaging
…cket derivation steps.
…ic with name, version, and jar details
…raction logic with stricter validations and improved error handling
…erivation logic using mappings and removing redundant validations.
…rs and disabling supershell.
…gs for no colors and supershell.
… key derivation logic and consolidating HTTP status checks.
… into URL creation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
exclude-changelog
PR description should not be included in next release changelog
minor-change
Used for PRs that don't require issue attached
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.
Closes #9387
This PR introduces a guard step in the
Makefile
to prevent accidental overwriting of existing spark client jars on treeverse-clients-us-east bucket.Changes
guard-s3-no-overwrite
target:sbt
.publish-scala
to depend onguard-s3-no-overwrite
, ensuring the guard always runs before publishing.aws s3 cp --acl public-read ...
step, as public accessibility is already ensured through bucket policies (and BPA - Block Public Access, is off, as well).Why
Previously, publishing the same project version twice could silently overwrite existing jars in S3.
This posed two risks:
With this guard, we enforce immutability of published artifacts unless a version is explicitly bumped.
Additional Safeguards
As part of hardening S3 usage, these options were also enabled:
Bucket Versioning: ensures that every update creates a new object version instead of destroying history. This allows recovery of older artifacts even if a new one is mistakenly uploaded.
S3 Object Lock (Governance mode): prevents object versions from being deleted or overwritten during a retention window (currently, default retention is disabled).
This could add another layer of protection against accidental or malicious overwrites.
Together, versioning and object lock provide defense in depth:
Testings
A new dedicated bucket benel-public-test was created for experimentation.
Configured it as public with the same policies as the production bucket (treeverse-clients-us-east).
Used as a sandbox to validate the updated publication process.
Verified that:
see this for example.
Confirmed that the publication process works without the redundant step:
aws s3 cp --recursive --acl public-read $(CLIENT_JARS_BUCKET) $(CLIENT_JARS_BUCKET) --metadata-directive REPLACE
.Bucket policies already guarantee public readability, making this step unnecessary.
Verified public accessibility of uploaded jars using:
curl -I https://<bucket>.s3.us-east-1.amazonaws.com/<path-to-jar>
.which returned
HTTP/1.1 200 OK
, proving objects remain publicly accessible even without the ACL step.On the experimental bucket, versioning and object lock were enabled to test retention and overwrite-prevention behaviors.
Verified that multiple versions are retained.
Confirmed object lock prevents premature deletion/overwriting during the retention window.