Skip to content

Commit 42d3012

Browse files
author
Esben Sparre Andreasen
committed
JS: let RegExpLiteral be a DataFlow::SourceNode
1 parent 76caad0 commit 42d3012

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

javascript/ql/src/semmle/javascript/dataflow/Sources.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ module SourceNode {
211211
* - object expressions
212212
* - array expressions
213213
* - JSX literals
214+
* - regular expression literals
214215
*
215216
* This class is for internal use only and should not normally be used directly.
216217
*/
@@ -224,7 +225,8 @@ module SourceNode {
224225
astNode instanceof ArrayExpr or
225226
astNode instanceof JSXNode or
226227
astNode instanceof GlobalVarAccess or
227-
astNode instanceof ExternalModuleReference
228+
astNode instanceof ExternalModuleReference or
229+
astNode instanceof RegExpLiteral
228230
)
229231
or
230232
exists(SsaExplicitDefinition ssa, VarDef def |

javascript/ql/test/library-tests/DataFlow/sources.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
| sources.js:3:2:3:1 | this |
1212
| sources.js:3:2:5:1 | functio ... x+19;\\n} |
1313
| sources.js:3:11:3:11 | x |
14+
| sources.js:7:1:7:3 | /x/ |
1415
| tst.js:1:1:1:0 | this |
1516
| tst.js:1:1:1:24 | import ... m 'fs'; |
1617
| tst.js:1:10:1:11 | fs |

javascript/ql/test/library-tests/DataFlow/sources.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ new (x => x);
33
(function(x) {
44
return x+19;
55
})(23);
6+
7+
/x/;

0 commit comments

Comments
 (0)