A cookie is marked as not secure, so it is also sent over unencrypted connections
What it finds
A cookie without the Secure attribute travels over plain HTTP as well, where anyone on the network can read it. Reported for setSecure(false), secure = false on a cookie and the secure = false argument of a cookie constructor.
From the rule's source, cookie_not_secure.rs.
fun session(id: String, response: Response) { val cookie = javax.servlet.http.Cookie("session", id) cookie.setSecure(false)tx0 reports: the cookie is set without Secure cookie.secure = falsetx0 reports: the cookie is set without Secure response.cookies.append(Cookie("session", id, secure = false))tx0 reports: the cookie is set without Secure response.cookies.append(Cookie("session", id, secure = true)) settings.secure = false} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/kotlin:cookie-sent-over-http" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/kotlin:cookie-sent-over-http] reason="..."tx0 explain tx0/kotlin:cookie-sent-over-http shows the same in the terminal. Found a false positive? Report it.