Skip to content

feat(auth): verify ES384 and ES512 jwts locally in get_claims - #2190

Open
spydon wants to merge 2 commits into
mainfrom
lukasklingsbo/sdk-3345-supabase-py-verify-es384-and-es512
Open

spydon wants to merge 2 commits into
mainfrom
lukasklingsbo/sdk-3345-supabase-py-verify-es384-and-es512

Conversation

@spydon

@spydon spydon commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

get_claims now verifies ES384 (P-384) and ES512 (P-521) tokens against the JWK Set instead of calling /user, following the spec in supabase/sdk#418.

  • Bind kty: EC keys with crv: P-384 and crv: P-521. A JWK whose alg and crv disagree still takes the fallback.
  • Unit tests for valid tokens, wrong signatures and alg/crv mismatches.
  • No integration test yet: Supabase CLI 3.1.0 only generates ES256 and RS256 signing keys.

SDK-3345

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features

    • JWTs signed with ES384 or ES512 can now be verified locally when their EC keys use the matching curves.
  • Bug Fixes

    • Tokens with mismatched algorithms, key curves, or signatures are handled correctly, including falling back to user lookup when local verification is not supported.

Local JWT verification now supports ES384 with P-384 keys and ES512 with P-521 keys when the JWK algorithm is absent or matches the curve. Sync and async tests cover successful verification, invalid signatures, algorithm mismatches, and fallback to /user for unsupported or conflicting JWK declarations.

Sequence Diagram(s)

sequenceDiagram
  participant get_claims
  participant JWKS
  participant _bind_algorithm
  participant JWT_verifier
  get_claims->>JWKS: Fetch signing keys
  get_claims->>_bind_algorithm: Bind JWK curve and alg
  _bind_algorithm-->>get_claims: Return ES384 or ES512
  get_claims->>JWT_verifier: Verify token signature
Loading

Possibly related PRs

Change: Feature

Merge Risk: Minimal · up to 97258

This change adds local verification of ES384 and ES512 tokens in get_claims, with fallback to /user when a JWK declaration is unsupported or conflicting. No concrete merge-blocking risk was identified in the supplied change.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7de3d5e3-757a-4e73-ae10-caa3f242b682
Commits

Reviewing files that changed from the base of the PR and between 5ec655e and 972584e.

Files selected for processing: 3

  • src/auth/src/supabase_auth/helpers.py
  • src/auth/tests/_async/test_get_claims.py
  • src/auth/tests/_sync/test_get_claims.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

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.

1 participant