OIDC scopes with haudience #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/oidc-scopes-with-audience"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds POST /api/v1/admin/clients/{id}/rotate-hmac-secret returning the fresh HMAC secret exactly once. Audit log entry uses ActionClientSecretRotated with kind="hmac" to distinguish from classic secret rotation. main.go wires the AES-256 HMAC encryption key (loaded once via the new loadHMACEncryptionKey helper) into both the client service and the ClientAuth middleware so both sides can seal/unseal coherently. When auth.hmac_secret_encryption_key is unset the helper logs a warning and returns nil, leaving the rest of the server functional but disabling client_secret_jwt at runtime.Two changes in one because they share the same verifier and introducing the verifier without using it would leave the bug open. 1) Inline JAR (?request=JWT) used parseRequestObject which called ParseUnverified. An attacker could forge an unsigned JWT and override every authorize parameter (scope, audience, redirect_uri, …) on behalf of the client. The handler now goes through ParseAndVerifyRequestObject which mandates a signed JWT verified against the client's JWKS. 2) request_uri now branches on the URI scheme: - urn:ietf:params:oauth:request_uri:… → existing PAR flow - http(s)://… → must be in client.RequestURIs, then FetchRequestURI + ParseAndVerifyRequestObject (RFC 9101 §5.2.2) The handler grew a SetJWKSCache wiring so the shared cache the ClientAuth middleware already uses is reused for request object signature verification. parseRequestObject (unverified) is removed.Adds three schema bits needed for the optional JWT access token path: - api_resources.token_format ('opaque' default, 'jwt' to opt in). The branchment cannot live on signing_alg because that column already defaults to 'RS256' and is never NULL. - revoked_jtis (jti PK, expires_at): denylist consulted by /introspect and populated by /revoke for JWT access tokens. - access_tokens.jti (nullable): set when the row tracks a JWT so /revoke can find the JTI without re-parsing the JWT body. Model helpers: APIResource.EmitsJWTAccessTokens() and the TokenFormatOpaque/TokenFormatJWT constants for callers to switch on.Covers validateEncryptionPair across the partial-config and unsupported-value paths, plus a sanity guard that the two supportedJWE{Algs,Encs} maps stay non-empty and include the OIDC Core baseline (RSA-OAEP-256 + A256GCM).