You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/ql/src/Security/CWE-614/InsecureCookie.qhelp
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,9 @@
4
4
<qhelp>
5
5
6
6
<overview>
7
-
<p>Setting the 'secure' flag on a cookie to <code>False</code> can cause it to be sent in cleartext.
8
-
Setting the 'httponly' flag on a cookie to <code>False</code> may allow attackers access it via JavaScript.
9
-
Setting the 'samesite' flag on a cookie to <code>'None'</code> will make the cookie to be sent in third-party
10
-
contexts which may be attacker-controlled.</p>
7
+
<p>Cookies without the <code>Secure</code> flag set may be transmittd using HTTP instead of HTTPS, which leaves it vulnerable to being read by a third party.</p>
8
+
<p>Cookies without the <code>HttpOnly</code> flag set are accessible to JavaScript running in the same origin. In case of a Cross-Site Scripting (XSS) vulnerability, the cookie can be stolen by a malicious script.</p>
9
+
<p>Cookies with the <code>SameSite</code> attribute set to <code>'None'</code> will be sent with cross-origin requests, which can be controlled by third-party JavaScript code and allow for Cross-Site Request Forgery (CSRF) attacks.</p>
11
10
</overview>
12
11
13
12
<recommendation>
@@ -18,9 +17,8 @@ contexts which may be attacker-controlled.</p>
18
17
</recommendation>
19
18
20
19
<example>
21
-
<p>This example shows two ways of adding a cookie to a Flask response. The first way uses <code>set_cookie</code>'s
22
-
secure flag and the second adds the secure flag in the cookie's raw value.</p>
23
-
<samplesrc="InsecureCookie.py" />
20
+
<p>In the following examples, the cases marked GOOD show secure cookie attributes being set; whereas in the cases marked BAD they are not set.</p>
0 commit comments