Conversation
lakhansamani
added a commit
to authorizerdev/docs
that referenced
this pull request
Nov 20, 2026
… v2.5.0) New integrations/surrealdb page: custom access token script for the ns/db/ac claims, DEFINE ACCESS ... WITH JWT URL against Authorizer's JWKS, per-user and role-based permissions, SDK and HTTP usage, and the allow-net / revocation / rotation caveats. Depends on the kid header from authorizerdev/authorizer#904. Also keeps the guide drafted for SurrealDB's own docs under specs/surrealdb-integration until it is submitted upstream.
This was referenced Nov 20, 2026
Tokens were signed without a kid header while /.well-known/jwks.json published keys under a kid. JWKS consumers that select the key by kid reject such tokens; SurrealDB's DEFINE ACCESS ... WITH JWT URL fails every request with "Missing token header 'kid'", so Authorizer could not be used as a SurrealDB authentication provider. The kid is now the key's RFC 7638 thumbprint (crypto.KeyID), used by both the signer and the JWKS handler, so they agree by construction. It is derived from the key rather than a label (previously client_id / client_id-secondary), so a key keeps its kid through a primary -> secondary rotation and tokens signed before the rotation still name a published key. HMAC tokens get no kid: their key is never published. Tests: kid present and matching JWKS for RS256 and ES256; a pre-rotation token's kid is still published after rotation; HMAC has no kid. Existing JWKS tests unchanged and passing; make test and make smoke pass. Verified end to end against SurrealDB 4.0.1.
The client-assertion verifier cached an issuer's JWKS for 10 minutes and rejected any assertion whose kid the cached set lacked. An issuer that re-labels its keys (Authorizer itself, with the thumbprint kids in this PR) or rotates them was therefore rejected until the cache expired. An unknown kid now triggers one refetch that bypasses the cache. The refetch is attacker-triggerable, so it is rate-limited to one per issuer per 60s via SetCacheNX (shared across replicas, like jti replay). Also corrects the BC1 comment on schemas.Client: JWKS kids no longer key on the client ID.
lakhansamani
force-pushed
the
fix/jwt-kid-header
branch
from
November 24, 2026 06:06
4d02d89 to
cdd3a38
Compare
Merged
lakhansamani
added a commit
to authorizerdev/docs
that referenced
this pull request
Nov 24, 2026
…storage + integration (#99) * docs: JWKS kid is the key thumbprint and is stamped on tokens (v2.5.0) Documents authorizerdev/authorizer#904: every RSA/ECDSA token carries a kid header equal to its signing key's RFC 7638 thumbprint, which is also the key's kid in /.well-known/jwks.json (previously the client ID, and tokens had no kid). Adds an upgrade note for verifiers that pinned a JWKS copy or hard-coded the client ID as the kid, and explains why rotation now keeps working for kid-strict verifiers. * docs: SurrealDB integration (Authorizer as SurrealDB's auth provider, v2.5.0) New integrations/surrealdb page: custom access token script for the ns/db/ac claims, DEFINE ACCESS ... WITH JWT URL against Authorizer's JWKS, per-user and role-based permissions, SDK and HTTP usage, and the allow-net / revocation / rotation caveats. Depends on the kid header from authorizerdev/authorizer#904. Also keeps the guide drafted for SurrealDB's own docs under specs/surrealdb-integration until it is submitted upstream. * docs: SurrealDB storage backend (v2.5.0) databases: SurrealDB entry (flags, 4.0+, http(s) recommended, namespace and credential levels, own migrations, --fga-store). server-config: type list and --surrealdb-namespace. helm-chart, introduction: lists. integrations/surrealdb: Authorizer can store its own data in the same SurrealDB. * docs: client_id in access tokens (RFC 9068) and azp in ID tokens (v2.5.0) authorizerdev/authorizer#913. Token claims table, discovery claims_supported, client_credentials client_id/aud, standards table, and the testing checklist. * docs: these changes ship in 2.4.8, not 2.5.0 * docs(surrealdb): allowed-origins and MFA notes from an end-to-end re-run on 2.4.8 Re-ran the guide against SurrealDB 4.0.1 and Authorizer main (c83107c8). Upstream guide moves to position 14 (11 is Auth0). * docs(surrealdb): correct rotation, allowed-origins and signing-key statements Re-verified against Authorizer 2.4.8 and SurrealDB 4.0.1: - SurrealDB's JWKS cache refuses a new key's tokens for up to 5 minutes after a rotation and keeps a removed key for up to 12 hours. - With --allowed-origins=* only Authorizer's own origin may sign in. - --jwt-type has no default; RS256/ES256 is required for SurrealDB. - Access token lifetime is a fixed 30 minutes; the JWKS failure reason is logged at WARN. The specs copy of the upstream guide matches surrealdb/docs.surrealdb.com#2231.
lakhansamani
added a commit
that referenced
this pull request
Nov 27, 2026
Black-box, against the real binary: - GHSA-p7g3-2258-8wmp: org A's SCIM PATCH of a shared user's userName, emails, phoneNumbers (and a mixed PatchOp) is refused with 400/mutability and writes nothing; the reset cannot reach the attacker's mailbox; case-only and single-org changes still sync. - #904: RS256/ES256 tokens carry a kid equal to the RFC 7638 thumbprint of a JWKS key that verifies them, including a pre-rotation token after a primary-to-secondary rotation; HS256 tokens have no kid. - #913: client_id on access tokens and azp == aud on ID tokens from the authorization_code, refresh_token and client_credentials grants. - #903: list_permissions with cap+1 grants returns cap results and truncated=true on GraphQL, REST and gRPC; under the cap, false.
lakhansamani
added a commit
that referenced
this pull request
Nov 27, 2026
* test(e2e): smoke coverage for 2.4.9 fixes Black-box release smoke tests against the real binary for the 2.4.9 fixes: - GHSA-rpv7-grw6-r2jv: a wrong-password login to an unverified account arms an MFA session that skip_mfa_setup, lock_mfa, totp/email OTP setup and webauthn registration options must all reject on GraphQL, REST and gRPC; the emailed OTP (read from an in-test SMTP sink) still completes login via verify_otp. - #922: restart on the same DB with a role removed from --roles; login, validate_jwt_token on an old token and the refresh grant stop honouring it. - #924/#932: a fake Redis that errors after the startup PING; revoke returns a masked internal error with an error_id on every surface, and that id is logged next to the original error. - #927: admin users sort/filter return identical ordered results on GraphQL, REST and gRPC. startServer gains a startServerWithLog variant that returns the log path. * test(e2e): smoke coverage for 2.4.7 and 2.4.8 fixes Black-box, against the real binary: - GHSA-p7g3-2258-8wmp: org A's SCIM PATCH of a shared user's userName, emails, phoneNumbers (and a mixed PatchOp) is refused with 400/mutability and writes nothing; the reset cannot reach the attacker's mailbox; case-only and single-org changes still sync. - #904: RS256/ES256 tokens carry a kid equal to the RFC 7638 thumbprint of a JWKS key that verifies them, including a pre-rotation token after a primary-to-secondary rotation; HS256 tokens have no kid. - #913: client_id on access tokens and azp == aud on ID tokens from the authorization_code, refresh_token and client_credentials grants. - #903: list_permissions with cap+1 grants returns cap results and truncated=true on GraphQL, REST and gRPC; under the cap, false. * test(e2e): opt-in make smoke-db for SereneDB, SurrealDB and SQL Server `make smoke-db DB=serenedb|surrealdb|sqlserver` starts the database in Docker and runs TestReleaseSmokeDB against the real binary: signup, login, session, refresh grant, admin users list, forgot_password and resend_verify_email twice with the superseding link redeemed, and MFA enrollment twice plus a concurrent burst. The repeated forgot_password fails with INTERNAL on SQL Server without the 2.4.7 conflict-target fix. Skipped unless SMOKE_DB_ARGS is set, so `make smoke` stays SQLite-only and needs no Docker. * test(e2e): build the smoke binary once; unique smoke-db run ids; review nits
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.
Problem
Authorizer signs asymmetric tokens (RS256/ES256) without a
kidheader, while/.well-known/jwks.jsonpublishes its keys under akid. JWKS consumers that select the verification key bykidreject the tokens outright. SurrealDB is one (DEFINE ACCESS ... WITH JWT URL):So Authorizer currently cannot be used as a SurrealDB authentication provider, unlike Auth0 and AWS Cognito, which SurrealDB documents. Auth0, Okta and Cognito always set
kid.Fix
kid= the key's RFC 7638 JWK thumbprint (crypto.KeyID), used by both the signer (token.signJWTToken) and the JWKS handler, so the header and the JWKS entry agree by construction.<client_id>for the primary key and<client_id>-secondaryfor the secondary. With label kids, demoting the old key during a rotation would give pre-rotation tokens akidthat now names the new key, and kid-strict verifiers would reject them until expiry. A thumbprint keeps the key'skidthrough the rotation.kid: their key is never published.Behaviour change (release as a minor: v2.5.0)
JWKS
kidvalues change from<client_id>/<client_id>-secondaryto key thumbprints, and the docs promised the old values (oauth2-oidc.md,client-registry.md). Effect of upgrading:/.well-known/jwks.json(most libraries, gateways, the Go example)kid.kidverifiers (SurrealDB)kid == client_idkid(second commit).Nothing changes inside Authorizer: it never reads the header
kidwhen verifying its own tokens, so no session, refresh token or login is affected.Release note: Tokens now carry a
kidheader, and JWKSkids are RFC 7638 key thumbprints instead of the client ID. If you pinned a copy of the JWKS or hard-coded the client ID as thekid, switch to fetching/.well-known/jwks.jsonbefore upgrading.Docs: authorizerdev/docs#99 (draft; merge with the release).
Unknown-
kidrefetch (second commit)The client-assertion verifier cached a trusted issuer's JWKS for 10 minutes with no refetch, so an issuer that rotated or re-labelled its keys was rejected until expiry. An unknown
kidnow triggers one cache-bypassing refetch, rate-limited to one per issuer per 60s viaSetCacheNX, because anyone can send a made-upkid.Tests
TestJWTHeaderKidMatchesJWKS(RS256, ES256): the headerkidexists and equals the published key'skid.TestJWTKidSurvivesKeyRotation: after new key → primary and old key → secondary, a token signed before the rotation still names a published key.TestJWTHMACHasNoKid.TestClientAssertion_UnknownKidRefetchesJWKS: models an issuer re-labelling its keys while cached. Accepted after exactly one refetch, and the refreshed set is cached.TestClientAssertion_UnknownKidRefetchIsRateLimited: 20 boguskids cost one extra fetch; legitimate assertions still verify.make test,make smoke,go vet ./...,make lint-go: all pass.End-to-end check with SurrealDB 4.0.1
Authorizer (this branch) with a custom access token script adding
ns/db/ac, and SurrealDB withDEFINE ACCESS authorizer ... WITH JWT URL "<authorizer>/.well-known/jwks.json":$authresolves to their record. Table permissions isolate users, and permissions on therolesclaim work.alg=none, and an HS256 forgery reusing the realkid.main: every request is refused with the missing-kiderror above.