Repository navigation
fix: enforce local PUT conditions across tier transitions - #299
Open
perfloop[bot] wants to merge 5 commits into
Open
perfloop[bot] wants to merge 5 commits into
perfloop[bot] wants to merge 5 commits into
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
[Medium impact] The PR appears safe to merge; the previous encoding-loss finding is fixed and no new blocking issue was found. SummaryThe PR checks local PUT conditions before forwarding larger replacements upstream, preserves caller authentication and checksum trailers, and carries the original metadata version through marker publication.
Reviews (2) · Last reviewed commit: "fix: preserve all content encoding field..." · Reviewed by Greptile |
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
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.
Larger conditional replacements now check the local object's preconditions before moving its body upstream. Tier selection no longer delegates a local ETag or existence check to an upstream copy that may not exist.
TestTieredLargePutLocalConditionsfails without this change and passes with it.TestTieredLargeConditionalPutContentEncodingfails without this change and passes with it.Upstream-tier conditions, unconditional transitions, and unvalidated forwarding keep their existing paths.
TestTieredLargePutLocalConditionsin proxy/tiered_put_conditions_test.go checks create-only rejection without forwarding or changing the local object, and matching-ETag replacement through both forwarding flavors.TestTieredLargeConditionalPutContentEncodingchecks separate encoding fields, exact gzip readback, GET/HEAD labels, and caller-header preservation.TestTieredLargeConditionalPutPreservesRacingLocalWritegates a competing metadata write with CAS coordination enabled. The same file covers routing, read failures, authenticated streams, checksum rejection, body closing, and presigned uploads.TestHeadersForForwardedSigningin proxy/chunk_verify_test.go covers encoding order, combined fields, and unchanged nonchunked headers. Re-signing tests in auth/validator_test.go compare signatures with the AWS SDK; auth/chunk_verifier_test.go checks trailer signatures against the original chunk chain.Upstream writes and local metadata commits remain non-atomic. Racing-write protection retains the selected coordinator's guarantees; legacy coordination still has its existing write-vs-write check-then-store window. Transition frequency and deployed impact are unmeasured.
2 recorded checks pass with this change.
Generated by Perfloop.
Note
Medium Risk
Changes tiered PUT routing, SigV4 re-signing, and streaming trailer verification—correctness-sensitive paths—but behavior is scoped to tiered conditional forwards with broad new tests.
Overview
Tiered mode now evaluates
If-Match/If-None-Matchagainst the local object (or confirmed absence) for validated plain-object PUTs—even when the replacement body is abovecache.size_thresholdand will be stored upstream. Failed checks return 412/404 without forwarding; successful checks strip the precondition headers and forward via a newforwardPutWithoutConditionspath on both signing and transparent forwarders.Shared
checkPutConditionsreplaces duplicated logic in the local PUT handler. The tiered router loads prior metadata for any conditional plain PUT, setslocalConditionswhen upstream must not see the client's ETags, and reuses the decision-time snapshot for upstream-marker publication.Forwarding after local conditions uses
preparePutWithoutConditions: decode or re-frame the body (verify signed chunks; forSTREAMING-*-TRAILER, authenticate the trailer with newVerifyTrailer, then emit unsigned chunked wire with checksum trailers preserved).ValidatedRequest.Resignre-signs as the original caller (header or presigned query).headersForForwardedSigningjoins allContent-Encodingfield lines before strippingaws-chunked, so encodings like gzip on separate lines survive.Docs (README,
docs/tiered-mode.md) describe the new precondition and re-sign behavior. Large integration coverage lives inproxy/tiered_put_conditions_test.go.Reviewed by Cursor Bugbot for commit b4c644f. Bugbot is set up for automated code reviews on this repo. Configure here.