Repository navigation
fix: reject mismatched payload hashes on tiered local PUTs - #257
Merged
Merged
Conversation
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
[High impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds SHA-256 checks for concrete payload hashes on tiered local PUTs.
No actionable issues were found. Tests were not run during this review. Reviews (1) · Last reviewed commit: "docs: clarify tiered payload verificatio..." · Reviewed by Greptile |
ovaistariq
approved these changes
Oct 21, 2026
|
🎉 This PR is included in version 1.22.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
On tiered PUTs routed to the local engine, no upstream store verifies the body. The engine hashes bytes as they stream. It compares a concrete SigV4 SHA-256 digest only after admission and any local precondition pass and the full declared body is staged and passes length and any Content-MD5 checks. A mismatch returns
XAmzContentSHA256Mismatchwith HTTP 400 before metadata publication; the handler does not buffer the object. Upstream-tier conditional writes remain forwarded, andUNSIGNED-PAYLOADand aws-chunked streaming markers keep their existing paths.The stated condition holds with this change; it does not hold at
628616fd9e19fac473837eb45eb46115e3d33313.TestTieredLocalPayloadHashIntegrityuses independent AWS SDK v2 signatures through both forwarder bindings. It fails on the target branch because a same-length changed body is acknowledged and served; it passes on the intermediate repairs and final source. It checks new-key misses, a locally matchingIf-Matchoverwrite, partial-body rejection, body-key absence, admission release, valid and unsigned payloads, and Content-MD5 precedence.TestTieredStreamedPutRetryIsMetaOnlyandTestTieredUnconditionalPutRetriesOverRacedCommitprotect metadata-only retries and client-write ordering;TestTieredConditionalPutRacedPreconditionAnswers412preserves a 412 after a lost precondition.TestTieredPutCancelsInflightRetierchecks cancellation.TestTieredStreamedPutOverrunDiscardsStagedBodyandTestTieredStreamedPutTruncatedBodyAnswersIncompleteprotect abort cleanup and incomplete-body status.TestTieredStreamedPutAmbiguousCommitKeepsStagedBody,TestTieredStreamedPutBodyRefRoundTrip, andTestTieredEngineContentMD5AndRequestIDcover uncertain commit cleanup, ETag/BodyRef, and MD5 error/request IDs. These controls pass on base and final; the full proxy suite also passed on both intermediate repairs.The README and tiered-mode guide document the local-engine scope. Scoped proxy/handler tests, vet, lint, build, and the benchmark smoke check passed. The standalone base/final comparison runner is not in this PR; the in-repository regression test is. The in-memory benchmark is not a production throughput estimate. The broader
make testand Warp benchmark workflow remain target-CI-owned. Production PUT frequency and deployed cost remain unmeasured.Generated by Perfloop.
Note
Medium Risk
Changes tiered-mode write integrity on a security-sensitive path (SigV4 body binding) but is scoped to local-tier PUTs with concrete digests and adds regression tests;
UNSIGNED-PAYLOADand forwarded writes are unchanged.Overview
Tiered local-tier PUTs now verify the request body against a concrete
X-Amz-Content-Sha256digest when the header is a real hex SHA-256 (notUNSIGNED-PAYLOAD, aws-chunked markers, or missing/invalid values). The check runs after admission, local preconditions, full declared-length staging, and any Content-MD5 validation, and before metadata commit.A mismatch returns HTTP 400 with
XAmzContentSHA256Mismatch; staged bodies are discarded and metadata is not published. Tiered routing passes the expected digest fromconcretePayloadSHA256into the originless PUT engine; conditional writes against upstream-tier markers still forward upstream.Docs (README, tiered-mode) describe this behavior.
TestTieredLocalPayloadHashIntegrity(signing and transparent forwarders) and a local PUT benchmark cover rejections, cleanup, and happy paths.Reviewed by Cursor Bugbot for commit 9644ec7. Bugbot is set up for automated code reviews on this repo. Configure here.