Skip to content

fix(auth): skip user mode when token has sb_ prefix#67

Merged
tomaspozo merged 1 commit into
mainfrom
tomas/com-237-skip-user-mode-jwt-verification-when-authorization-carries
May 16, 2026
Merged

fix(auth): skip user mode when token has sb_ prefix#67
tomaspozo merged 1 commit into
mainfrom
tomas/com-237-skip-user-mode-jwt-verification-when-authorization-carries

Conversation

@tomaspozo
Copy link
Copy Markdown
Member

@tomaspozo tomaspozo commented May 15, 2026

Summary

  • The Supabase JS SDK forwards sb_* keys in both Authorization and apikey headers. With a combined config like auth: ['user', 'secret'], the user branch saw the sb_* value in Authorization, failed JWT verification, and short-circuited with InvalidCredentialsError before secret could match.
  • Fix: in tryMode, treat an sb_-prefixed token as not-applicable (return null) so the chain falls through to secret / publishable. Real JWTs still verify as before; an invalid real JWT still short-circuits (no silent fallthrough regression).

Linear: COM-237

@tomaspozo tomaspozo requested review from a team as code owners May 15, 2026 20:33
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@67

commit: 99e5cbe

@tomaspozo tomaspozo merged commit b193216 into main May 16, 2026
7 checks passed
@tomaspozo tomaspozo deleted the tomas/com-237-skip-user-mode-jwt-verification-when-authorization-carries branch May 16, 2026 00:04
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.

withSupabase auth chain: platform-injected Authorization header breaks auth: ['user', 'secret'] for service-to-service callers

2 participants