Skip to content

fix: accept URL-only presigned GETs in transparent local auth - #266

Merged
ovaistariq merged 5 commits into
mainfrom
perfloop-pr-open-vyvj2ekbcs
Oct 21, 2026
Merged

ovaistariq merged 5 commits into
mainfrom
perfloop-pr-open-vyvj2ekbcs

Conversation

@perfloop

@perfloop perfloop Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Valid URL-only SigV4 presigned GETs using UNSIGNED-PAYLOAD can now pass TAG's transparent local-auth gate without X-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, and make lint-ci pass. The broader make test suite 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 with UNSIGNED-PAYLOAD), so warmed objects can be served with X-Cache: HIT after 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-Expires must appear exactly once as an integer in [1, 604800], URLs expire after that window from X-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: signingForwarder still rejects any request missing X-Amz-Content-Sha256 before calling the shared validator. README and docs/security.md document the split behavior.

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

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[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.

Fix All in Claude CodeFindings

  1. P1 Existing objects appear missing ▶

Summary

Allows transparent local authentication for presigned GETs without X-Amz-Content-Sha256.

  • Transparent local auth accepts URL-only presigned GETs.

Reviews (2) · Last reviewed commit: "fix(auth): require bounded presigned exp..." · Reviewed by Greptile

ovaistariq and others added 2 commits October 20, 2026 23:34
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
Comment thread auth/validator.go Resolved
@ovaistariq
ovaistariq merged commit d3506d8 into main Oct 21, 2026
9 checks passed
@ovaistariq
ovaistariq deleted the perfloop-pr-open-vyvj2ekbcs branch October 21, 2026 19:53
@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