Repository navigation
Fix S3 gateway ignoring If-Match on GetObject and HeadObject - #10604
Open
vshalpnjabi wants to merge 1 commit into
Open
vshalpnjabi wants to merge 1 commit into
vshalpnjabi wants to merge 1 commit into
Conversation
GetObject and HeadObject ignored If-Match, so a read with a stale ETag returned the newer object instead of 412 Precondition Failed. That breaks ranged downloads that pin parts with If-Match (aws-c-s3). Evaluate If-Match, If-None-Match, If-Unmodified-Since and If-Modified-Since after the object is resolved and before Range parsing or the presigned-redirect branch.
|
|
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #10581
Change Description
Bug Fix
If-Match, so a read with a stale ETag returned the newer object instead of 412. Clients that pin later parts of a ranged download withIf-Match(aws-c-s3 / the CRT client) can end up stitching two versions together.If-Match,If-None-Match,If-Unmodified-SinceandIf-Modified-Sincein S3 / RFC 7232 order. The check runs before Range parsing and before the presigned-redirect branch, so a ranged or presigned GET with a staleIf-Matchreturns 412 rather than 206 or 307. Placement follows @RyanLin5967's notes on the issue.Testing Details
New gateway tests failed before the fix and pass after:
If-None-Match,If-Modified-SinceandIf-Unmodified-Sincecases also returned 200 before and return 304/412 after. Also rango build ./cmd/lakefs,go test ./pkg/gateway/... ./pkg/httputil/, gofmt and golangci-lint (0 issues).Breaking Change?
No, unless a client relied on these headers being ignored. Requests without conditional headers behave as before.
Additional info
This change was AI-assisted using Cursor and was reviewed and tested by me.