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 {
1414 node instanceof RequestForgery:: Sanitizer
1515 }
1616
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+ }
1731 override predicate isSanitizerEdge ( DataFlow:: Node source , DataFlow:: Node sink ) {
18- sanitizingPrefixEdge ( source , sink )
32+ strictSanitizingPrefixEdge ( source , sink )
1933 }
2034
2135 override predicate isSanitizerGuard ( TaintTracking:: SanitizerGuardNode nd ) {
You can’t perform that action at this time.
0 commit comments