Skip to content
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

feat: add jwks support #407

Merged
merged 1 commit into from
Feb 9, 2024
Merged

feat: add jwks support #407

merged 1 commit into from
Feb 9, 2024

Conversation

hf
Copy link
Contributor

@hf hf commented Jan 2, 2024

Adds JWKS support, similar to what PostgREST supports.

Why is this necessary?

This opens up avenues where foreign JWTs like those issued by Firebase Auth, Cognito, Clerk, Auth0 can be used directly with Storage, bypassing Supabase Auth or other symmetric use cases.

It also helps with secret rotation.

How it works?

Set the JWT_JWKS env var to a JWKS value. In a multi-tenant setup the jwt_jwks column should encode the JWKS as a string, which is then parsed.

Security Information

This only affects storage calls that are made "in the name of the user." Signed URLs still continue to use the secret and ignore the existence of the JWKS.

JWK support is built-in to Node.js, so no third-party libraries are used.

@hf hf force-pushed the hf/add-jwks-support branch 9 times, most recently from 4d11f54 to c77fe93 Compare January 8, 2024 12:36
@hf hf marked this pull request as ready for review January 8, 2024 12:36
@hf hf changed the title [wip] feat: add jwks support feat: add jwks support Jan 8, 2024
@supabase supabase deleted a comment from github-actions bot Jan 8, 2024
@hf hf force-pushed the hf/add-jwks-support branch 2 times, most recently from 78a6aa7 to f4895a6 Compare January 8, 2024 12:44
@fenos
Copy link
Contributor

fenos commented Jan 15, 2024

You will need to add a migration under migrations/multitenant to add the jwt_jwks column

@hf
Copy link
Contributor Author

hf commented Jan 15, 2024

You will need to add a migration under migrations/multitenant to add the jwt_jwks column

Oh yeah, forgot about that!

@hf hf force-pushed the hf/add-jwks-support branch 7 times, most recently from fe3c5a9 to 565f617 Compare February 2, 2024 13:07
@hf
Copy link
Contributor Author

hf commented Feb 2, 2024

@fenos Can you check why the tests are failing -- I can't seem to figure out what the error is.

@hf hf force-pushed the hf/add-jwks-support branch from 565f617 to b7d73a8 Compare February 2, 2024 13:20
@fenos fenos merged commit 50e4298 into master Feb 9, 2024
1 check passed
@fenos fenos deleted the hf/add-jwks-support branch February 9, 2024 09:45
Copy link

github-actions bot commented Feb 9, 2024

🎉 This PR is included in version 0.47.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants