Skip to content
vetkitChecksChangelogDocumentation

vetkit.swift.cors.vapor-origin-reflection-with-credentials

Vapor's CORS middleware reflects any request Origin (.originBased) while allowing credentials. Any website can make authenticated cross-origin requests and read the responses.

Last updated:

Suite: Security

swift

Vapor's CORS middleware reflects any request Origin (.originBased) while allowing credentials. Any website can make authenticated cross-origin requests and read the responses.

Category: SECURITY · Engine rule severity: ERROR

How to fix it

Use .custom("https://app.example.com") / .any([...]) with an explicit list of trusted origins when allowCredentials is true.

Rule pattern example

The engine’s matching pattern, not a confirmed exploit. Metavariables and ellipses describe matching syntax.

CORSMiddleware.Configuration(..., allowedOrigin: .originBased, ..., allowCredentials: true, ...)

References

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

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.