Skip to content

Commit 352c07a

Browse files
committed
Allow non-query-specific MaD sanitizers
1 parent 10c5a47 commit 352c07a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

go/ql/lib/semmle/go/security/CommandInjectionCustomizations.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ module CommandInjection {
4747
override predicate doubleDashIsSanitizing() { exec.doubleDashIsSanitizing() }
4848
}
4949

50+
private class ExternalSanitizer extends Sanitizer {
51+
ExternalSanitizer() { barrierNode(this, "command-injection") }
52+
}
53+
5054
/**
5155
* A call to a regexp match function, considered as a barrier guard for command injection.
5256
*/

go/ql/lib/semmle/go/security/TaintedPathCustomizations.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ module TaintedPath {
5757
PathAsSink() { this = any(FileSystemAccess fsa).getAPathArgument() }
5858
}
5959

60+
private class ExternalSanitizer extends Sanitizer {
61+
ExternalSanitizer() { barrierNode(this, "path-injection") }
62+
}
63+
6064
/**
6165
* A numeric- or boolean-typed node, considered a sanitizer for path traversal.
6266
*/

go/ql/lib/semmle/go/security/Xss.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ module SharedXss {
8888
body.getAContentType().regexpMatch("(?i).*html.*")
8989
}
9090

91+
private class ExternalSanitizer extends Sanitizer {
92+
ExternalSanitizer() { barrierNode(this, ["html-injection", "js-injection"]) }
93+
}
94+
9195
/**
9296
* A JSON marshaler, acting to sanitize a possible XSS vulnerability because the
9397
* marshaled value is very unlikely to be returned as an HTML content-type.

0 commit comments

Comments
 (0)