How to fix: OIDC discovery omits code_challenge_methods_supported
The authorization-server metadata advertises the authorization-code response type without PKCE support. code_challenge_methods_supported is the field a client reads to discover PKCE is available, and it is absent.
Why it matters
A conforming client decides whether to send a code_challenge based on this field. When it is absent, well-behaved client libraries skip PKCE, which leaves the authorization code unbound to the requesting client: an attacker who intercepts the code at the redirect (a custom URI scheme another app registered, a leaked Referer, a compromised proxy) can exchange it themselves.
The metadata may be understating the server, since many implementations accept a code_challenge without advertising it. That is exactly the problem: correctness now depends on every client hardcoding PKCE rather than on discovery. RFC 8414 defines the field and RFC 9700 requires PKCE for all authorization-code clients, public and confidential alike, so publishing it is the cheap half of the fix.
How to fix it
- 1Add "code_challenge_methods_supported": ["S256"] to the metadata document.
- 2Require a code_challenge on every authorization-code request at the server, and reject the plain method.
- 3In clients, enable PKCE explicitly rather than relying on discovery to turn it on.
Code examples
Metadata: advertise S256
{
"issuer": "https://auth.example.com",
"authorization_endpoint": "https://auth.example.com/authorize",
"token_endpoint": "https://auth.example.com/token",
"response_types_supported": ["code"],
"code_challenge_methods_supported": ["S256"]
}Check an issuer
curl -s https://auth.example.com/.well-known/openid-configuration \
| jq '{response_types_supported, code_challenge_methods_supported}'References
Detected automatically by VulnRadar. The check id is api-oidc-discovery-pkce-not-advertised, stable across every scan so you can filter or diff on it.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
Questions
- How severe is OIDC discovery omits code_challenge_methods_supported?
- VulnRadar rates this low severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id api-oidc-discovery-pkce-not-advertised, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does OIDC discovery omits code_challenge_methods_supported map to?
- It maps to CWE-1021. In the OWASP Top 10 it falls under A07:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.