Repository navigation
fix: authenticate cached multipart completion replays - #274
Merged
Merged
Conversation
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
[Medium impact] The PR appears safe to merge; the previous cleanup issue is fixed and no new actionable issues were found. SummaryThe PR binds cached multipart completion responses to the caller's access key and exact upload tuple.
Reviews (2) · Last reviewed commit: "test: release the slow upstream handler ..." · Reviewed by Greptile |
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6
|
🎉 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.
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.GetCompletionandcache.PutCompletionnow 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.TestCompleteMultipartUploadReplayAuthorizationcovers 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
36d0c890b3efa8c19beeb1d56154a7a4f42d813aand satisfied on the final source. The recorded check was invoked withgo 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, andmake lint.Target CI also runs:
Supersedes #242, whose original commits are unsigned and so cannot pass the branch ruleset; same change as its rebased head e2afe03 (binding done through
ValidateAndGetCredentialsandParseAuthInfo, no new interfaces), plus the duplicatelockedLogBuffertest 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
CompleteMultipartUploadresponses are still cached for five seconds, but only when TAG can locally validate the principal at request start;GetCompletion/PutCompletionstore and require a matchingaccess_key, and legacy or unbound entries are treated as misses.Replay authorization is enforced in the proxy path.
HandleCompleteMultipartUploadresolves the caller viacompletionPrincipal(SigV4 validation, with presignedUNSIGNED-PAYLOADhandling 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.