MEDIUM AI PREVALENCE: HIGH auth.ruby.cors.wildcard-origin-with-credentials
A rack-cors allow block combines origins '*' with credentials: true.
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
That instructs browsers to send cookies and Authorization headers to a resource that trusts EVERY origin, which is exactly the combination the CORS spec forbids and a CSRF/data-theft primitive (CWE-942). LLM-generated CORS setups routinely pair a wildcard origin with credentials to make cross-site auth "just work".
Decide what the endpoint actually needs:
- Public, no cookies/auth cross-site ->
origins '*'with nocredentials: true(the default). - Authenticated for a known frontend -> enumerate the exact origins, e.g.
origins 'https://app.example.com', and keepcredentials: true.
Never combine a wildcard origin 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.ruby.cors.wildcard-origin-with-credentials -- <reason>