Repository navigation
fix: accept URL-only presigned GETs in transparent local auth - #266
Merged
Merged
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 change affects local authentication and cache decisions in TAG’s proxy paths. Do not merge until URL-only presigned GETs retain their upstream fallback in tiered mode.
|
PR #266 lets URL-only presigned GETs (no X-Amz-Content-Sha256, which browsers and SDK presigners never send) reach transparent local validation instead of always forwarding upstream. That makes validatePresigned reachable by real clients for the first time, and it was weaker than AWS: X-Amz-Expires was only enforced when present and integer-parsable, had no upper bound, and X-Amz-Date was never checked for future skew. validatePresigned now applies the AWS lifetime rules: - X-Amz-Expires must be present exactly once, parse as an integer, and lie in [1, 604800]; anything else is ErrInvalidExpires (mapped to malformed_auth in proxy/forwarder.go). The range check runs before the Duration conversion, so the multiplication cannot overflow. - The URL is rejected (ErrExpiredRequest) once that many seconds have passed since X-Amz-Date, unconditionally. - X-Amz-Date more than maxRequestAge (15m) in the future is rejected with ErrExpiredRequest, matching the header-signed skew rule, which is unchanged. Table-driven tests cover missing, duplicate, non-integer, empty, zero, negative, 604801, int64 max, past-int64, expired, future-beyond-skew, and the accepted boundaries 1, 604800, and exactly 15 minutes ahead. Also dropped from the PR: the tiered.go hunk that type-asserted *transparentForwarder and forced validated URL-only presigned GETs back upstream. It contradicted tiered mode's documented contract that local metadata is authoritative for existence (a validated miss is NoSuchKey), so validated presigned GETs now take the normal tiered path. The integration test that asserted the forwarding behaviour goes with it; docs/security.md describes the new expiry rules. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6
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.
Valid URL-only SigV4 presigned GETs using
UNSIGNED-PAYLOADcan now pass TAG's transparent local-auth gate withoutX-Amz-Content-Sha256. The validator identifies query authentication before applying the header requirement, then checks the signature using the learned key and the bucket grant. Header-authenticated requests and non-GET methods still require the header.The Router regression test warms a private object through a successful controlled-origin GET that returns an encrypted signing-key envelope. After TAG learns the exact key and bucket grant, both the URL-only GET and the same signed URL with an unsigned hash header return the same cached bytes with
X-Cache: HIT. Tampered signatures, ordinarily expired URLs, unknown keys, missing bucket grants, and header-authenticated GETs without the hash do not receive a local cache hit.Signing mode keeps its existing hash requirement, and tiered mode keeps URL-only presigned GETs on its existing upstream path. This change does not address malformed-expiry or future-skew validation.
The auth and proxy package tests, the two focused Router tests,
make build, andmake lint-cipass. The broadermake testsuite remains target-CI work. The Router tests use the repository's in-memory S3 origin and embedded cache; they do not establish acceptance against live Tigris. The standalone assertion program used for the source comparison is not included in this PR. Production prevalence and performance effects are unmeasured; no speedup is claimed.This condition holds with this change and does not hold at
628616fd9e19fac473837eb45eb46115e3d33313:For TAG's transparent local-auth gate on path-style GETs with a learned key for the exact access-key/date/region and a live grant for the bucket, a current AWS SDK SigV4 query presign using UNSIGNED-PAYLOAD and a positive 300-second expiry is AuthValidated without Authorization or X-Amz-Content-Sha256; the identical URL with an unsigned payload-hash header is also AuthValidated, while a tampered or ordinarily expired URL, an unknown key, a missing bucket grant, a header-authenticated GET without the hash, and a query-authenticated non-GET without the hash are not AuthValidated..Generated by Perfloop.
Note
Medium Risk
Changes SigV4 validation and presigned URL expiry rules on the transparent local-auth cache path; mis-validation could affect cache hits vs upstream fallback, though signing mode and negative cases remain covered by new tests.
Overview
Transparent local auth now accepts AWS SDK–style presigned GET URLs that omit
X-Amz-Content-Sha256(query auth withUNSIGNED-PAYLOAD), so warmed objects can be served withX-Cache: HITafter key learning and bucket authorization. Header-signed requests and presigned non-GET methods still require the payload-hash header.Presigned lifetime checks are tightened to match AWS:
X-Amz-Expiresmust appear exactly once as an integer in[1, 604800], URLs expire after that window fromX-Amz-Date, and dates more than 15 minutes in the future are rejected (ErrInvalidExpires→ malformed auth at the proxy).Signing mode is unchanged for clients:
signingForwarderstill rejects any request missingX-Amz-Content-Sha256before calling the shared validator. README anddocs/security.mddocument the split behavior.Reviewed by Cursor Bugbot for commit 5543882. Bugbot is set up for automated code reviews on this repo. Configure here.