Skip to content

fix(security): prevent HMAC key leak in JWKS and fix redirect URI wildcard#570

Merged
lakhansamani merged 1 commit intomainfrom
fix/jwks-hmac-and-redirect-uri-wildcard
Apr 4, 2026
Merged

fix(security): prevent HMAC key leak in JWKS and fix redirect URI wildcard#570
lakhansamani merged 1 commit intomainfrom
fix/jwks-hmac-and-redirect-uri-wildcard

Conversation

@lakhansamani
Copy link
Copy Markdown
Contributor

Summary

  • HMAC JWKS (HIGH): JWKS endpoint no longer exposes HMAC symmetric keys. Only asymmetric public keys (RSA/ECDSA) are published. Exposing HMAC keys would allow anyone to forge valid JWTs.
  • Redirect URI wildcard (MEDIUM): Fixed regex so *.example.com only matches proper subdomains (sub.example.com) and not evil-example.com.

Files Changed

  • internal/http_handlers/jwks.go — filter out HMAC keys from JWKS response
  • internal/validators/url.go — fix wildcard subdomain regex boundary

Test plan

  • make test-sqlite passes (no regressions)
  • Verify JWKS endpoint returns empty keys for HMAC-only config
  • Verify *.example.com matches a.example.com but rejects evil-example.com

@lakhansamani lakhansamani merged commit 085dc31 into main Apr 4, 2026
@lakhansamani lakhansamani deleted the fix/jwks-hmac-and-redirect-uri-wildcard branch April 4, 2026 14:03
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