Skip to content

fix: reject mismatched payload hashes on tiered local PUTs - #257

Merged
ovaistariq merged 3 commits into
mainfrom
perfloop-pr-open-72ev9dgh2b
Oct 21, 2026
Merged

ovaistariq merged 3 commits into
mainfrom
perfloop-pr-open-72ev9dgh2b

Conversation

@perfloop

@perfloop perfloop Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

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 XAmzContentSHA256Mismatch with HTTP 400 before metadata publication; the handler does not buffer the object. Upstream-tier conditional writes remain forwarded, and UNSIGNED-PAYLOAD and aws-chunked streaming markers keep their existing paths.

The stated condition holds with this change; it does not hold at 628616fd9e19fac473837eb45eb46115e3d33313.

TestTieredLocalPayloadHashIntegrity uses 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 matching If-Match overwrite, partial-body rejection, body-key absence, admission release, valid and unsigned payloads, and Content-MD5 precedence.

TestTieredStreamedPutRetryIsMetaOnly and TestTieredUnconditionalPutRetriesOverRacedCommit protect metadata-only retries and client-write ordering; TestTieredConditionalPutRacedPreconditionAnswers412 preserves a 412 after a lost precondition. TestTieredPutCancelsInflightRetier checks cancellation. TestTieredStreamedPutOverrunDiscardsStagedBody and TestTieredStreamedPutTruncatedBodyAnswersIncomplete protect abort cleanup and incomplete-body status. TestTieredStreamedPutAmbiguousCommitKeepsStagedBody, TestTieredStreamedPutBodyRefRoundTrip, and TestTieredEngineContentMD5AndRequestID cover 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 test and 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-PAYLOAD and forwarded writes are unchanged.

Overview
Tiered local-tier PUTs now verify the request body against a concrete X-Amz-Content-Sha256 digest when the header is a real hex SHA-256 (not UNSIGNED-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 from concretePayloadSHA256 into 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.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds SHA-256 checks for concrete payload hashes on tiered local PUTs.

  • Local-tier PUTs reject bodies that miss their signed SHA-256 digest.

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
ovaistariq merged commit 78e4564 into main Oct 21, 2026
10 checks passed
@ovaistariq
ovaistariq deleted the perfloop-pr-open-72ev9dgh2b branch October 21, 2026 05:46
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 21, 2026
@tigrisdata-argocd-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.22.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants