A Ktor CORS configuration combines anyHost() with allowCredentials = 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
This tells the browser to send cookies and Authorization headers on cross-origin requests from ANY origin and to expose the authenticated response back to that origin, so any malicious website a logged-in user visits can call this API with their credentials and read the result (CWE-942, Permissive Cross-domain Policy). This is a common AI-generated mistake: anyHost() is used to "make CORS work" while credentials are also enabled.
Never pair anyHost() with credentials. Allow only the specific origins that need credentialed access: allowHost("app.example.com", schemes = listOf("https"))
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.kotlin.cors.anyhost-credentials -- <reason>