File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
lib/semmle/javascript/security
test/query-tests/Security/CWE-601/ClientSideUrlRedirect Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ module TaintedUrlSuffix {
108
108
or
109
109
// Assume calls to regexp.exec always extract query/fragment parameters.
110
110
exists ( MethodCallNode call |
111
- call = any ( RegExpLiteral re ) . flow ( ) . ( DataFlow:: SourceNode ) .getAMethodCall ( "exec" ) and
111
+ call = any ( DataFlow:: RegExpCreationNode re ) .getAMethodCall ( "exec" ) and
112
112
src = call .getArgument ( 0 ) and
113
113
dst = call
114
114
)
Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ window.location = /.*redirect=([^&]*).*/.exec(document.location.href)[1];
6
6
window . location = indirect . exec ( document . location . href ) [ 1 ] ;
7
7
} ) ;
8
8
9
- // NOT OK [INCONSISTENCY]
9
+ // NOT OK
10
10
window . location = new RegExp ( '.*redirect=([^&]*).*' ) . exec ( document . location . href ) [ 1 ] ;
11
11
12
12
( function ( ) {
13
13
var indirect = new RegExp ( '.*redirect=([^&]*).*' )
14
14
window . location = indirect . exec ( document . location . href ) [ 1 ] ;
15
15
} ) ;
16
16
17
- // NOT OK [INCONSISTENCY]
17
+ // NOT OK
18
18
window . location = new RegExp ( / .* r e d i r e c t = ( [ ^ & ] * ) .* / ) . exec ( document . location . href ) [ 1 ] ;
19
19
20
20
( function ( ) {
@@ -23,7 +23,7 @@ window.location = new RegExp(/.*redirect=([^&]*).*/).exec(document.location.href
23
23
} ) ;
24
24
25
25
function foo ( win ) {
26
- win . location . assign ( new RegExp ( / .* r e d i r e c t = ( [ ^ & ] * ) .* / ) . exec ( win . location . href ) [ 1 ] ) ; // NOT OK [INCONSISTENCY]
26
+ win . location . assign ( new RegExp ( / .* r e d i r e c t = ( [ ^ & ] * ) .* / ) . exec ( win . location . href ) [ 1 ] ) ; // NOT OK
27
27
}
28
28
29
29
foo ( window ) ;
You can’t perform that action at this time.
0 commit comments