Skip to content

Commit aa1c8c0

Browse files
committed
JS: Exclude client-side sources from RegExpInjection
1 parent 2e57a7d commit aa1c8c0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/RegExpInjectionCustomizations.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ module RegExpInjection {
2727
* expression injection.
2828
*/
2929
class RemoteFlowSourceAsSource extends Source {
30-
RemoteFlowSourceAsSource() { this instanceof RemoteFlowSource }
30+
RemoteFlowSourceAsSource() {
31+
this instanceof RemoteFlowSource and
32+
not this instanceof ClientSideRemoteFlowSource
33+
}
3134
}
3235

3336
/**
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function foo() {
2+
let taint = window.location.hash.substring(1);
3+
new RegExp(taint); // OK - we do not flag RegExp injection on the client side as the impact is too low
4+
}

0 commit comments

Comments
 (0)