File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
javascript/ql/src/experimental/Security/CWE-918 Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,22 @@ class Configuration extends TaintTracking::Configuration {
14
14
node instanceof RequestForgery:: Sanitizer
15
15
}
16
16
17
+ private predicate hasSanitizingSubstring ( DataFlow:: Node nd ) {
18
+ nd .getStringValue ( ) .regexpMatch ( ".*[?#].*" )
19
+ or
20
+ hasSanitizingSubstring ( StringConcatenation:: getAnOperand ( nd ) )
21
+ or
22
+ hasSanitizingSubstring ( nd .getAPredecessor ( ) )
23
+ }
24
+
25
+ private predicate strictSanitizingPrefixEdge ( DataFlow:: Node source , DataFlow:: Node sink ) {
26
+ exists ( DataFlow:: Node operator , int n |
27
+ StringConcatenation:: taintStep ( source , sink , operator , n ) and
28
+ hasSanitizingSubstring ( StringConcatenation:: getOperand ( operator , [ 0 .. n - 1 ] ) )
29
+ )
30
+ }
17
31
override predicate isSanitizerEdge ( DataFlow:: Node source , DataFlow:: Node sink ) {
18
- sanitizingPrefixEdge ( source , sink )
32
+ strictSanitizingPrefixEdge ( source , sink )
19
33
}
20
34
21
35
override predicate isSanitizerGuard ( TaintTracking:: SanitizerGuardNode nd ) {
You can’t perform that action at this time.
0 commit comments