Skip to content

fix(auth): accept the RFC 8037 EdDSA alg for OKP keys - #2060

Open
jclab-joseph wants to merge 2 commits into
supabase:mainfrom
jclab-product:feat/accept-rfc8037-eddsa-alg
Open

fix(auth): accept the RFC 8037 EdDSA alg for OKP keys#2060
jclab-joseph wants to merge 2 commits into
supabase:mainfrom
jclab-product:feat/accept-rfc8037-eddsa-alg

Conversation

@jclab-joseph

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix.

This PR fixes JWT verification for EdDSA tokens signed with Ed25519 or Ed448 keys.

What is the current behavior?

JWT verification only recognizes the JOSE algorithm names that identify the curve directly, such as Ed25519 and Ed448.

However, RFC 8037 specifies alg as EdDSA, with the specific curve provided by the JWK's crv field. Conformant libraries and services—including jose for JavaScript, go-jose, python-jose, and the Supabase Storage API—emit Ed25519 tokens using this format.

As a result, a valid Ed25519 token with alg: "EdDSA" fails verification with :error_generating_signer, even when the matching key is present in the tenant's JWKS.

What is the new behavior?

JWT verification now recognizes the EdDSA algorithm and resolves the appropriate signer using the JWK's crv value.

For example:

  • alg: "EdDSA" with crv: "Ed25519" resolves to the Ed25519 signer.
  • alg: "EdDSA" with crv: "Ed448" resolves to the Ed448 signer.
  • An OKP key using an unsupported curve continues to fail cleanly instead of selecting an invalid signer.

This allows standards-compliant EdDSA tokens produced by commonly used JOSE libraries and the Supabase Storage API to be verified successfully.

Additional context

RFC 8037 separates the signing algorithm from the selected Edwards curve:

  • The JWT header uses alg: "EdDSA".
  • The JWK identifies the curve through its crv field.

This change preserves support for the existing curve-specific spellings while adding support for the RFC-compliant EdDSA representation.

JWT verification only recognised the JOSE spelling of the Ed algorithms,
where the signer is named after the curve ("Ed25519"/"Ed448"). RFC 8037
instead fixes `alg` to "EdDSA" and carries the curve in the JWK, which is
what conformant libraries emit — jose (JS), go-jose, python-jose and the
Supabase storage API all sign and verify Ed25519 tokens that way. Such a
token failed with :error_generating_signer even though its key was in the
tenant's JWKS.

The EdDSA spelling now resolves the signer from the JWK's curve, and an
OKP key with an unsupported curve still fails cleanly.
@jclab-joseph
jclab-joseph force-pushed the feat/accept-rfc8037-eddsa-alg branch from 472d946 to 88ac106 Compare July 30, 2026 23:32
Comment thread test/realtime_web/channels/auth/jwt_verification_test.exs Outdated
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.

2 participants