-
Notifications
You must be signed in to change notification settings - Fork 25
Supabase signing keys #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 926d9aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds automatic support for Supabase JWT Signing Keys and removes legacy Supabase JWT support. The changes automatically configure JWKS endpoints for Supabase projects and improve error diagnostics for authentication failures.
- Adds automatic detection and configuration of Supabase JWKS URLs based on database connection strings
- Removes legacy support for
app.settings.jwt_secretand theSupabaseKeyCollectorclass - Implements detailed debugging information for Supabase authentication configuration issues
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/service-core/test/src/auth.test.ts | Comprehensive test suite for Supabase authentication debugging scenarios |
| packages/service-core/src/util/config/compound-config-collector.ts | Auto-configures Supabase JWKS URLs and debug tracking |
| packages/service-core/src/auth/utils.ts | Utility functions for Supabase URL parsing and authentication debugging |
| packages/service-core/src/auth/StaticSupabaseKeyCollector.ts | Exports key options for reuse in JWKS collector |
| packages/service-core/src/auth/RemoteJWKSCollector.ts | Adds support for custom key options in JWKS collection |
| packages/service-core/src/auth/KeyStore.ts | Integrates Supabase debugging and enhanced error reporting |
| modules/module-postgres/src/module/PostgresModule.ts | Removes legacy Supabase key collector registration |
| modules/module-postgres/src/auth/SupabaseKeyCollector.ts | Deletes deprecated Supabase key collector implementation |
Comments suppressed due to low confidence (1)
packages/service-core/test/src/auth.test.ts:525
- This test has the same description as the previous test on line 498. The test description should be updated to reflect that this test covers the case where Supabase project is detected but auth is not enabled.
test('Supabase signing key token without JWKS enabled', async () => {
Co-authored-by: Copilot <[email protected]>
382cfd2 to
7c14f06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad that this is now supported by Supabase! Looks good to me!
Supabase recently added support for asymmetric "JWT Signing Keys": https://supabase.com/blog/jwt-signing-keys
This now auto-configures the new JWKS endpoint if:
client_auth.supabase).db.<project-id>.supabase.co).This is roughly equivalent to manually configuring it:
https://<project-id>.supabase.co/auth/v1/.well-known/jwks.jsonasclient_auth.jwks_uri.authenticatedinclient_auth.audience.For self-hosted Supabase projects, the auto-configuration will not work, and the manual configuration as described above is required.
This also removes support for Legacy JWT keys via
SELECT current_setting('app.settings.jwt_secret'), which was previously activated whenclient_auth.supabase_jwt_secretwas not configured. Support for this was removed in hosted Supabase in December 2024. Theoretically there may still be self-hosted instances using this, but those should now hardcode the key or switch to the new signing keys.This now also detects various auth configuration issues related to Supabase, such as Supabase auth not being enabled, or using keys from a different Supabase project. These are logged in
configurationDetailsafter failed auth requests.