-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcookie-missing-httponly.yaml
More file actions
31 lines (31 loc) · 923 Bytes
/
Copy pathcookie-missing-httponly.yaml
File metadata and controls
31 lines (31 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
rules:
- id: cookie-missing-httponly
patterns:
- pattern-not-inside: |
http.Cookie{
...,
HttpOnly: true,
...,
}
- pattern: |
http.Cookie{
...,
}
message: |
A session cookie was detected without setting the 'HttpOnly' flag.
The 'HttpOnly' flag for cookies instructs the browser to forbid
client-side scripts from reading the cookie which mitigates XSS
attacks. Set the 'HttpOnly' flag by setting 'HttpOnly' to 'true'
in the Cookie.
metadata:
cwe: "CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag"
owasp: 'A3: Sensitive Data Exposure'
references:
- https://github.com/0c34/govwa/blob/139693e56406b5684d2a6ae22c0af90717e149b8/util/cookie.go
- https://golang.org/src/net/http/cookie.go
category: security
fix-regex:
regex: (HttpOnly\s*:\s+)false
replacement: \1true
severity: WARNING
languages: [go]