Skip to content
vetkitChecksChangelogDocumentationBlogComparisons

Ktor CORS anyHost with credentials allows any origin

Rule ID: vetkit.kotlin.ktor.cors-any-host-credentials

Ktor CORS allows any host together with credentials: the plugin reflects the request Origin, so any website can make authenticated cross-origin requests and read the responses.

Last updated:

Suite: Security

kotlin

Ktor CORS allows any host together with credentials: the plugin reflects the request Origin, so any website can make authenticated cross-origin requests and read the responses.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Replace anyHost() with allowHost("app.example.com", schemes = listOf("https")) for each trusted origin when allowCredentials = true is needed.

References

Source: packages/engine/rules/sast/kotlin.yml.

Related checks

Check your own repository for this

vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.

Start with the free Security Quick Scan · See how the platform works

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.