Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
URLs leak into server logs, browser history, the Referer header (sent to every third-party CDN, ad pixel, and analytics script on the destination page), and even copy-paste operations. A JWT in a URL is a leaked JWT.
Send JWTs in the Authorization: Bearer … header, or in a Secure; HttpOnly; SameSite cookie. Never in the URL.
OWASP ASVS V3.2.3 explicitly forbids credentials in URL parameters.
// ok: auth.jwt.in-urlexport const goodLink = 'https://app.example.com/dashboard';// ok: auth.jwt.in-url -- a non-JWT base64 redirect param, not a tokenexport const redirectLink = 'https://app.example.com/login?next=aHR0cHM6Ly9hcHAvaG9tZQ';// ok: auth.jwt.in-url -- token in Authorization header, not URLexport function fetchWithToken(token: string) { return fetch('https://api.example.com/files/123', { headers: { Authorization: `Bearer ${token}` }, });}
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.