Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
Authorization codes, client_secret, access/refresh tokens, and the code_verifier then travel unencrypted. A network attacker can read or rewrite them and take over the flow.
RFC 6749 §3.1 / §10.9 require TLS for the authorization and token endpoints. Use https:// for every authorize, token, and userinfo URL. http://localhost is fine for local development and is not flagged.
// All OAuth/OIDC endpoints use TLS; the only http:// URL is a loopback dev// host, which is explicitly allowed.// ok: auth.oauth.insecure-token-endpointexport const authorizeUrl = 'https://auth.example.com/authorize?response_type=code&client_id=abc&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcb';export async function exchange(code: string) { // ok: auth.oauth.insecure-token-endpoint return fetch('https://idp.example.com/oauth/token', { method: 'POST', body: `grant_type=authorization_code&code=${code}&client_id=abc`, });}// Local development against a loopback IdP — not flagged.// ok: auth.oauth.insecure-token-endpointconst devTokenEndpoint = 'http://localhost:8080/connect/token';// A plain http URL with no OAuth markers is out of scope for this rule.// ok: auth.oauth.insecure-token-endpointconst healthCheck = 'http://status.example.com/healthz';export function endpoints() { return [devTokenEndpoint, healthCheck];}
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.