File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
javascript/ql/lib/semmle/javascript/security Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -126,15 +126,23 @@ module TaintedUrlSuffix {
126
126
)
127
127
}
128
128
129
+ /** Holds if the `n`th child of `seq` contains a character indicating that everything thereafter is part of the suffix */
129
130
private predicate containsSuffixIndicator ( RegExpSequence seq , int n ) {
130
131
// Also include '=' as it usually only appears in the URL suffix
131
132
seq .getChild ( n ) .getAChild * ( ) .( RegExpConstant ) .getValue ( ) .regexpMatch ( ".*[?#=].*" )
132
133
}
133
134
135
+ /** Holds if the `n`th child of `seq` contains a capture group. */
134
136
private predicate containsCaptureGroup ( RegExpSequence seq , int n ) {
135
137
seq .getChild ( n ) .getAChild * ( ) .( RegExpGroup ) .isCapture ( )
136
138
}
137
139
140
+ /**
141
+ * Holds if `seq` contains a capture group that will likely match path of the URL suffix,
142
+ * thereby extracting tainted data.
143
+ *
144
+ * For example, `/#(.*)/.exec(url)` will extract the tainted URL suffix from `url`.
145
+ */
138
146
private predicate captureAfterSuffixIndicator ( RegExpSequence seq ) {
139
147
exists ( int suffix , int capture |
140
148
containsSuffixIndicator ( seq , suffix ) and
You can’t perform that action at this time.
0 commit comments