We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 450eebc commit 1071421Copy full SHA for 1071421
java/ql/src/semmle/code/java/security/XSS.qll
@@ -150,3 +150,20 @@ class ServletWriterSource extends MethodAccess {
150
)
151
}
152
153
+
154
+/**
155
+ * Holds if `s` is an HTTP Content-Type vulnerable to XSS.
156
+ */
157
+bindingset[s]
158
+predicate isXssVulnerableContentType(string s) {
159
+ s.regexpMatch("(?i)text/(html|xml|xsl|rdf|vtt|cache-manifest).*") or
160
+ s.regexpMatch("(?i)application/(.*\\+)?xml.*") or
161
+ s.regexpMatch("(?i)cache-manifest.*") or
162
+ s.regexpMatch("(?i)image/svg\\+xml.*")
163
+}
164
165
166
+ * Holds if `s` is an HTTP Content-Type that is not vulnerable to XSS.
167
168
169
+predicate isXssSafeContentType(string s) { not isXssVulnerableContentType(s) }
0 commit comments