HIGH AI PREVALENCE: HIGH auth.cors.wildcard-with-credentials
CORS is configured with Access-Control-Allow-Origin: * and Access-Control-Allow-Credentials: true at the same time.
Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
The spec forbids this combination (browsers will block it), but developers regularly try to "fix" the resulting error by switching to origin: true (which echoes the requesting origin back), effectively turning the policy into "allow credentials from ANYWHERE". That's a CSRF-on-steroids primitive.
Decide which one you actually need:
- Public API, no cookies/auth headers needed cross-site →
origin: '*',credentials: false(default). - Authenticated API for a known frontend → enumerate the exact origins,
credentials: true.
Never combine wildcard origins with credentials enabled.
VULNERABLE
SAFE
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.
// oauthlint-disable-next-line auth.cors.wildcard-with-credentials -- <reason>