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
pscanrules: Update CSPMissing for current guidance (Issue 7653) (#4338)
Implementations that followed current guidance with respect to which
headers to use would see alerts raised at Low threshold. Now, the
alerts reflect the current guidance (ie, don't use the obsolete CSP
headers).
Make obsolete CSP alert more distinct:
- Obsolete CSP header usage is always flagged, not just at LOW
- General refactoring suggested by reviewers
Support for example alerts.
Signed-off-by: David Hall <[email protected]>
Copy file name to clipboardExpand all lines: addOns/pscanrules/CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
14
14
- The HeartBleed scan rule alert now includes a CVE tag.
15
15
- Timestamp Disclosure scan rule now excludes values in "RateLimit-Reset", "X-RateLimit-Reset", and "X-Rate-Limit-Reset" headers (Issue 7747).
16
16
17
+
### Fixed
18
+
- The CSP Missing scan rule now alerts when the Content-Security-Policy header is missing, and when the obsolete X-Content-Security-Policy or X-WebKit-CSP are found (Issue 7653).
19
+
17
20
## [45] - 2023-01-03
18
21
### Changed
19
22
- The Private Address Disclosure and Session ID in URL Rewrite scan rules now include example alert functionality for documentation generation purposes (Issue 6119 and 7100).
Copy file name to clipboardExpand all lines: addOns/pscanrules/src/main/java/org/zaproxy/zap/extension/pscanrules/ContentSecurityPolicyMissingScanRule.java
+60-57Lines changed: 60 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@
19
19
*/
20
20
packageorg.zaproxy.zap.extension.pscanrules;
21
21
22
+
importjava.util.Arrays;
22
23
importjava.util.List;
23
24
importjava.util.Map;
24
25
importnet.htmlparser.jericho.Source;
@@ -62,67 +63,16 @@ public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) {
62
63
return;
63
64
}
64
65
65
-
// Get the various CSP headers
66
-
booleancspHeaderFound = false,
67
-
cspROHeaderFound = false,
68
-
xCspHeaderFound = false,
69
-
xWebKitHeaderFound = false;
70
-
71
-
// Content-Security-Policy is supported by Chrome 25+, Firefox 23+, Safari 7+, but not but
Copy file name to clipboardExpand all lines: addOns/pscanrules/src/main/javahelp/org/zaproxy/zap/extension/pscanrules/resources/help/contents/pscanrules.html
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -90,9 +90,12 @@ <H2>Charset Mismatch</H2>
90
90
91
91
<H2>Content Security Policy (CSP) Header Not Set</H2>
92
92
This checks HTML response headers for the presence of a Content Security Policy header, or the response body for CSP specified via META tag.<br>
93
-
By default this rule checks for the presence of the "Content-Security-Policy" header,
94
-
and at the Low threshold also checks for the "X-Content-Security-Policy" and "X-WebKit-CSP" headers.<br>
95
-
Redirects and non-HTML responses are ignored except at the Low threshold.
93
+
By default this rule checks for the presence of the "Content-Security-Policy", "X-Content-Security-Policy",
94
+
and "X-WebKit-CSP" headers. Redirects and non-HTML responses are ignored except at the Low threshold.
95
+
<p>
96
+
If a "Content-Security-Policy" header is not found, an alert is raised.
97
+
<p>
98
+
If an "X-Content-Security-Policy" or "X-WebKit-CSP" header is found, an INFO alert is raised. This may represent an outdated enforcement implementation.
96
99
<p>
97
100
If a "Content-Security-Policy-Report-Only" header is found on a response an INFO alert is raised. This may represent an enforcement effort
98
101
that is actively being refined or developed, or one which is only partially implemented.
Copy file name to clipboardExpand all lines: addOns/pscanrules/src/main/resources/org/zaproxy/zap/extension/pscanrules/resources/Messages.properties
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -53,8 +53,9 @@ pscanrules.charsetmismatch.extrainfo.xml=There was a charset mismatch between th
53
53
pscanrules.contentsecuritypolicymissing.name=Content Security Policy (CSP) Header Not Set
54
54
pscanrules.contentsecuritypolicymissing.desc=Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement or distribution of malware. CSP provides a set of standard HTTP headers that allow website owners to declare approved sources of content that browsers should be allowed to load on that page \u2014 covered types are JavaScript, CSS, HTML frames, fonts, images and embeddable objects such as Java applets, ActiveX, audio and video files.
pscanrules.contentsecuritypolicymissing.soln=Ensure that your web server, application server, load balancer, etc. is configured to set the Content-Security-Policy header, to achieve optimal browser support: "Content-Security-Policy" for Chrome 25+, Firefox 23+ and Safari 7+, "X-Content-Security-Policy" for Firefox 4.0+ and Internet Explorer 10+, and "X-WebKit-CSP" for Chrome 14+ and Safari 6+.
pscanrules.contentsecuritypolicymissing.soln=Ensure that your web server, application server, load balancer, etc. is configured to set the Content-Security-Policy header.
57
+
pscanrules.contentsecuritypolicymissing.obs.name=Obsolete Content Security Policy (CSP) Header Found
58
+
pscanrules.contentsecuritypolicymissing.obs.desc=The "X-Content-Security-Policy" and "X-WebKit-CSP" headers are no longer recommended.
58
59
pscanrules.contentsecuritypolicymissing.ro.name=Content Security Policy (CSP) Report-Only Header Found
59
60
pscanrules.contentsecuritypolicymissing.ro.desc=The response contained a Content-Security-Policy-Report-Only header, this may indicate a work-in-progress implementation, or an oversight in promoting pre-Prod to Prod, etc.\n\nContent Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement or distribution of malware. CSP provides a set of standard HTTP headers that allow website owners to declare approved sources of content that browsers should be allowed to load on that page \u2014 covered types are JavaScript, CSS, HTML frames, fonts, images and embeddable objects such as Java applets, ActiveX, audio and video files.
0 commit comments