Skip to content

fix: authenticate cached multipart completion replays - #274

Merged
ovaistariq merged 2 commits into
mainfrom
fix-completion-replay-auth
Oct 22, 2026
Merged

ovaistariq merged 2 commits into
mainfrom
fix-completion-replay-auth

Conversation

@ovaistariq

@ovaistariq ovaistariq commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Multipart-completion replays are now bound to the access key that completed the upload. Transparent mode rechecks that caller's bucket grant after the completion-cache read, so a revocation completed while the read is pending cannot authorize the cached response.

TAG stores the access key with each fully captured successful completion. Signing mode validates the replay's SigV4 signature; transparent mode binds the identity learned from a successful upstream response or a validated request-start snapshot, then checks the current grant. The exported cache helpers cache.GetCompletion and cache.PutCompletion now carry that caller identity. The exact bucket, object key, and upload ID still define the tuple, and delimiter-containing components are encoded to avoid collisions. The five-second TTL is unchanged, and no S3 route or configuration option was added.

TestCompleteMultipartUploadReplayAuthorization covers transparent and signing modes, same-principal and presigned retries, unbound entries, anonymous or invalid callers, different principals and buckets, delimiter aliases, and misses. Its revocation case blocks the completion-cache read while a concurrent request receives upstream 403 and revokes the grant; after release, the replay follows the normal upstream denial path. The expiry case waits for upstream entry and releases after the signature-age cutoff instead of using fixed sleeps. A fast cold-auth identity-learning case remains. The upstream is controlled; these tests do not establish live Tigris behavior or a deployment exploit.

The README and S3 compatibility guide document the replay rule. The multipart operation table stays concise; its duplicate note was removed. The single-node integration-cache fixture binds memberlist to loopback as test setup.

The assertion was violated on comparison revision 36d0c890b3efa8c19beeb1d56154a7a4f42d813a and satisfied on the final source. The recorded check was invoked with go run ./.perfloop_claim/completion_replay_claim.go.

Recorded proof ran with retained support that is not included in this pull request.

The recorded repository checks passed: make test, make lint-ci, make test-race, make test-coverage, make test-integration, and make lint.

Target CI also runs:

  • S3 Compatibility Tests / s3-compat-tests (default, tiered)
  • S3 Compatibility Tests (Cluster) / s3-compat-tests-cluster (default)
  • Lint PR Title / lint

Supersedes #242, whose original commits are unsigned and so cannot pass the branch ruleset; same change as its rebased head e2afe03 (binding done through ValidateAndGetCredentials and ParseAuthInfo, no new interfaces), plus the duplicate lockedLogBuffer test helper removal that #273 also carries.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6


Note

High Risk
Changes authentication and authorization for cached multipart completion replays, which could leak completion metadata or break idempotent retries if mis-bound.

Overview
Multipart completion idempotency is now caller-scoped. Successful CompleteMultipartUpload responses are still cached for five seconds, but only when TAG can locally validate the principal at request start; GetCompletion / PutCompletion store and require a matching access_key, and legacy or unbound entries are treated as misses.

Replay authorization is enforced in the proxy path. HandleCompleteMultipartUpload resolves the caller via completionPrincipal (SigV4 validation, with presigned UNSIGNED-PAYLOAD handling on a clone), re-checks identity after a possibly slow cache read (so transparent-mode bucket grants revoked mid-read cannot replay), and forwards everyone else upstream. Completion cache keys use URL-escaped components when bucket/key/upload ID contain | to avoid tuple collisions.

Docs and tests describe the new rules; integration coverage exercises transparent/signing modes, cross-principal denial, cold auth, revocation during cache read, and delimiter aliases.

Reviewed by Cursor Bugbot for commit c614431. Bugbot is set up for automated code reviews on this repo. Configure here.

Cached CompleteMultipartUpload responses were replayed to any caller for 5s
after a success, before any authentication ran. Bind the cached entry to the
validated principal (snapshot at request start, re-checked after the cache
read) and forward to upstream on any mismatch, so an anonymous or different
principal never receives the cached response.

Supersedes #242 with a signed commit; the branch rebase also removed the
duplicate lockedLogBuffer test helper that broke the proxy test package.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous cleanup issue is fixed and no new actionable issues were found.

Summary

The PR binds cached multipart completion responses to the caller's access key and exact upload tuple.

  • Multipart completion replays only reach the caller who completed them.
  • The single-node integration cache listens only on loopback.

Reviews (2) · Last reviewed commit: "test: release the slow upstream handler ..." · Reviewed by Greptile

@ovaistariq
ovaistariq merged commit 96a5f44 into main Oct 22, 2026
9 checks passed
@ovaistariq
ovaistariq deleted the fix-completion-replay-auth branch October 22, 2026 03:37
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 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.

2 participants