Repository navigation
fix: authenticate cached multipart completion replays - #242
perfloop[bot] wants to merge 7 commits into
Conversation
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThis PR binds cached multipart completion responses to the caller's access key.
The three supplied previous threads are unnumbered, so they have no numbered ledger entries. The revoked-grant check now runs after the cache read. The repeated table note is gone. The expiry test waits for upstream entry before releasing the response after the signature cutoff; the cold-auth test has no delay. The previous and current revisions have different merge bases with the target commit, so this review used the full PR diff. No runtime checks were run. Reviews (3) · Last reviewed commit: "test(proxy): remove duplicate lockedLogB..." · Reviewed by Greptile |
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
36cf4d9 to
dc07b3c
Compare
…replays Resolve conflicts with #248 (read-only authz grants), #266 (presigned validation), #245 (status recorder) and the other forwarder changes by keeping main's forwarder, interceptor and signing-key learning code as-is, and applying the principal binding only where it is load-bearing: - cache.CompletionEntry records the access key that completed the upload; GetCompletion(.., accessKey) only hits for that key, PutCompletion refuses an empty key, and the delimiter-alias key fix is kept. - HandleCompleteMultipartUpload identifies the caller once at request start through RequestForwarder.ValidateAndGetCredentials + auth.ParseAuthInfo (presigned POSTs get the UNSIGNED-PAYLOAD marker on a clone for validation), re-validates after the cache read before replaying so a grant revoked during a remote read cannot be replayed past, and binds the saved response to the request-start principal. This drops the two forwarder interfaces, the callback-shaped GetCompletion, the ResponseInterceptor signature change and the ResponseCapture field from the PR; none are needed on main. With #248, a transparent-mode completion by a principal without a bucket read grant is not cached (fewer replays, never less safe); the cold-auth integration test now asserts that, and the transparent subtest seeds the principal as if it had already read. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6
#238 and #256 each added an identical lockedLogBuffer to the proxy test package, so it no longer compiles on main. Keep the copy in lifecycle_test.go. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6
ovaistariq
left a comment
There was a problem hiding this comment.
Reviewed: cached CompleteMultipartUpload replays are now bound to the validated principal (snapshot at request start, re-checked after the cache read) and forwarded upstream on any mismatch, closing the unauthenticated replay window. Rebased on main with the binding done through the existing ValidateAndGetCredentials and ParseAuthInfo, no new interfaces.
ovaistariq
left a comment
There was a problem hiding this comment.
Approving after rebase review.
|
Closing: approved and green, but the branch ruleset requires signed commits and this PR's two original commits (36d0c89, dc07b3c) are unsigned, so the merge is blocked. The identical change, rebased on main and simplified onto the existing ValidateAndGetCredentials/ParseAuthInfo path, is re-submitted as a single signed commit on a fresh branch. |
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:
Generated by Perfloop. Measurements and checks. Reproduce this comparison (tenant access required).
Note
High Risk
This changes authorization for a cache that can return successful completion bodies and ETags; a bug could leak completion metadata across principals.
Overview
Multipart completion replay is now authenticated and caller-scoped. TAG only caches a fully captured successful
CompleteMultipartUploadwhen it can validate the caller at request start, stores the access key with the five-second entry, and replays only to that same principal for the exact bucket, key, and upload ID. Other callers are forwarded upstream; legacy entries without a saved identity are treated as misses.cache.GetCompletion/PutCompletionnow require an access key.MakeCompletionKeyURL-encodes components that contain|so distinct tuples cannot collide.HandleCompleteMultipartUploadresolves the principal viacompletionPrincipal(including presigned completions via anUNSIGNED-PAYLOADvalidation clone) and re-validates authorization after a slow completion-cache read so a revoked bucket grant cannot replay a cached success.README and S3 compatibility docs describe the new replay rules. Unit, proxy, and a large integration suite cover cross-principal denial, presigned retry, delimiter aliases, cold transparent auth, and grant revocation during cache read. Integration test setup can inject a custom cache client and binds the embedded cache memberlist to loopback.
Reviewed by Cursor Bugbot for commit e2afe03. Bugbot is set up for automated code reviews on this repo. Configure here.