Ktor session cookie without secure or httpOnly flag
Rule ID: vetkit.kotlin.ktor.session-cookie-insecure
A Ktor session cookie is configured without cookie.secure = true (Ktor's default) or with cookie.httpOnly = false, so the session id can be sent over plain HTTP or read by page scripts.
Last updated:
Suite: Security
kotlin
A Ktor session cookie is configured without cookie.secure = true (Ktor's default) or with cookie.httpOnly = false, so the session id can be sent over plain HTTP or read by page scripts.
Category: SECURITY · Engine rule severity: WARNING
How to fix it
Set cookie.secure = true and keep cookie.httpOnly = true (the default) in the cookie<T>(...) { } block; add cookie.extensions["SameSite"] = "lax". Use a development-only flag if plain HTTP is needed while developing.
References
Source: packages/engine/rules/sast/kotlin.yml.
Related checks
- Ktor CORS anyHost with credentials allows any origin
- Android SharedPreferences plaintext secret in Kotlin
- Kotlin Android WebView allowFileAccess enabled
- Kotlin WebView onReceivedSslError calls proceed()
- Kotlin Android WebView addJavascriptInterface exposed
- Kotlin Android WebView loads URL from Intent extra
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.