JS: Exclude client-side sources from RegExpInjection

This commit is contained in:
Asger Feldthaus
2021-03-08 11:15:47 +00:00
parent 2e57a7d3e9
commit aa1c8c041e
2 changed files with 8 additions and 1 deletions

View File

@@ -27,7 +27,10 @@ module RegExpInjection {
* expression injection.
*/
class RemoteFlowSourceAsSource extends Source {
RemoteFlowSourceAsSource() { this instanceof RemoteFlowSource }
RemoteFlowSourceAsSource() {
this instanceof RemoteFlowSource and
not this instanceof ClientSideRemoteFlowSource
}
}
/**

View File

@@ -0,0 +1,4 @@
function foo() {
let taint = window.location.hash.substring(1);
new RegExp(taint); // OK - we do not flag RegExp injection on the client side as the impact is too low
}