Repository navigation
Conversation
Bind P-384 keys to ES384 and P-521 keys to ES512, and verify the raw r||s signature with swift-crypto. A JWK whose alg disagrees with its curve still takes the server fallback. Fixes SDK-3343
Run claims() against a local Auth server that signs with a P-384 or a P-521 key, in a new supabase-ecdsa project that starts once per algorithm. The ES384 test fails until an Auth release includes ES384 signing (supabase/auth#2989); ES512 runs first so it still reports. Refs SDK-3349
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
Coverage Report for CI Build 47321440103Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.006%) to 96.402%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
AuthClient.claims()now verifies ES384 and ES512 access tokens on the device, as it already does for ES256, RS256, and EdDSA. Before, these tokens always took the server fallback.JWTVerifierbinds a JWK withkty: ECandcrv: P-384to ES384, and one withcrv: P-521to ES512. As before, a JWK whosealgdoes not match its curve is not bound and takes the fallback. The algorithm comes from the key, never from the token header.P384.Signing/P521.Signingon the rawr || ssignature (96 / 132 bytes), with SHA-384 / SHA-512. No new dependency.JWK+EC.swiftbuilds the P-256, P-384, and P-521 keys through one helper that checks the coordinate length (32 / 48 / 66 bytes).Spec: supabase/sdk#418 (
get_claims.md, "Signing algorithms").Tests
JWTVerifierTests): a valid token verifies for both curves. A tampered payload, another key, and a short signature fail. Analg/crvmismatch takes the fallback. Bad coordinates and an off-curve point fail closed.AuthClientTests:claims(jwt:)end to end with an ES384 and an ES512 JWKS.claimsVerifiesES384LocallyAgainstJWKSandclaimsVerifiesES512LocallyAgainstJWKSrun against a newsupabase-ecdsaproject. It starts once per algorithm with a key fromscripts/gen-ecdsa-signing-key.sh, the same way the EdDSA test works. CI runs ES512 first.Local results:
claimsVerifiesES512LocallyAgainstJWKSpasses against a live stack.claimsVerifiesES384LocallyAgainstJWKSfails, and this is expected: sign-up returns 500error generating jwt token, because no Auth release signs ES384 yet.Server behavior
GetSigningAlg). Confirmed with the live integration test.Deviations from the plan
claims(jwt:)test inAuthClientTests+SessionsAndClaims.swift, which the plan did not name.Draft until an Auth release with ES384 signing is in the local stack.
Fixes SDK-3343
Fixes SDK-3349