Skip to content

fix: encode ? in the paths of signed URLs - #1793

Open
spydon wants to merge 2 commits into
masterfrom
fix/encode-signed-url-paths
Open

spydon wants to merge 2 commits into
masterfrom
fix/encode-signed-url-paths

Conversation

@spydon

@spydon spydon commented Dec 3, 2026 •

Copy link
Copy Markdown

Signed URLs for a key with ? cut the path at the ?, so the token is lost and the URL can't be used.

  • POST /object/sign/:bucket and POST /object/upload/sign/:bucket/* put the raw key into the URL. They now encode ? in the path. Other characters are unchanged, so URLs for every other key stay byte-identical.
  • POST /object/sign/:bucket/* signed the url claim from decodeURI(request.url), which keeps %3F encoded, so the download check never matched. It now signs ${bucketId}/${objectName}, like the other routes.
  • New tests sign a ? key on each route and then use the returned URL. All three fail on master.

supabase-js runs these URLs through encodeURI, which turns %3F into %253F, so ? keys stay broken there until it stops doing that. They are already broken there today.

@spydon spydon changed the title fix: encode ? and # in the paths of signed URLs fix: encode ? in the paths of signed URLs Dec 3, 2026
@spydon
spydon marked this pull request as ready for review December 3, 2026 13:52
@spydon
spydon requested a review from a team as a code owner December 3, 2026 13:52
Copilot AI balanced review requested due to automatic review settings December 3, 2026 13:52
@coveralls

coveralls commented Dec 3, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 47120117490

Coverage decreased (-0.001%) to 88.876%

Details

  • Coverage decreased (-0.001%) from the base build.
  • Patch coverage: 5 of 5 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 19646
Covered Lines: 17986
Line Coverage: 91.55%
Relevant Branches: 12367
Covered Branches: 10466
Branch Coverage: 84.63%
Branches in Coverage %: Yes
Coverage Strength: 1278.48 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the signed-URL handling changes for object paths containing ?.

No open issues 🎉

What changed in this PR

Fixes signed download and upload URLs for object paths containing ?, keeping URL encoding separate from the object identity stored in tokens.

Changes:

  • Encodes ? in generated signed URL paths.
  • Builds single-object signing claims directly from bucket and object names.
  • Adds regression tests that redeem URLs from all three signing routes.
File Description
src/​test/​object.test.ts Adds question-mark regression tests and updates the signing API call.
src/​storage/​object.ts Encodes question marks and signs literal object identities.
src/​http/​routes/​object/​getSignedURL.ts Removes the request URL argument from single-object signing.

Review effort: Balanced

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants