Repository navigation
fix(uploads): phase 1 — shadow auth on /uploads/ + noindex - #530
Merged
Merged
Conversation
/uploads/<file> is served without checking the session. A plain login gate
would break legitimate machine consumers (scripts fetching files over HTTP,
MMS providers fetching media), so this ships in phases, controlled by
UPLOADS_AUTH_MODE (only when CANVAS_REQUIRE_AUTH is on):
shadow (default) - serve as before; log every request that WOULD be denied to
uploads/.uploads-auth-shadow.jsonl (dotfile, never served)
enforce - no Clerk session -> 401 (browsers: login redirect), decided
before revealing whether the file exists
off - unchanged
Every served upload now carries X-Robots-Tag: noindex, nofollow, noarchive.
Tests: 12 new (shadow logs anon / not signed-in, enforce 401 + redirect + no
existence oracle, signed-in served, off/auth-off unchanged, noindex, log not
served, log failure never breaks serving). Mutant without the check fails 4.
Full suite 765 passed, 26 skipped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MCERQUA
added a commit
that referenced
this pull request
Oct 16, 2026
/uploads/<file> is served without checking the session. A plain login gate
would break legitimate machine consumers (scripts fetching files over HTTP,
MMS providers fetching media), so this ships in phases, controlled by
UPLOADS_AUTH_MODE (only when CANVAS_REQUIRE_AUTH is on):
shadow (default) - serve as before; log every request that WOULD be denied to
uploads/.uploads-auth-shadow.jsonl (dotfile, never served)
enforce - no Clerk session -> 401 (browsers: login redirect), decided
before revealing whether the file exists
off - unchanged
Every served upload now carries X-Robots-Tag: noindex, nofollow, noarchive.
Tests: 12 new (shadow logs anon / not signed-in, enforce 401 + redirect + no
existence oracle, signed-in served, off/auth-off unchanged, noindex, log not
served, log failure never breaks serving). Mutant without the check fails 4.
Full suite 765 passed, 26 skipped.
Co-authored-by: Mike <mike@jam-bot.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
/uploads/<file>is served without checking the session. Requiring a login outright would break legitimate machine consumers (scripts fetching files over HTTP, MMS providers fetching media), so this is phase 1 of a staged change, controlled byUPLOADS_AUTH_MODEand active only whenCANVAS_REQUIRE_AUTH=true:shadow(default): behaviour unchanged, but every request that would be denied is appended touploads/.uploads-auth-shadow.jsonl(a dotfile, never served), so the real consumers can be measured before anything is enforced.enforce: no valid Clerk session → 401 (browsers get the login redirect canvas pages already use), decided before revealing whether the file exists.off: unchanged.Every served upload now also carries
X-Robots-Tag: noindex, nofollow, noarchive.Self-hosted installs (auth off) are unaffected.