1
1
import javascript
2
2
3
- class CommandLineFileNameConfiguration extends TaintTracking:: Configuration {
4
- CommandLineFileNameConfiguration ( ) { this = "CommandLineFileNameConfiguration" }
5
-
6
- override predicate isSource ( DataFlow:: Node source ) {
3
+ module CommandLineFileNameConfig implements DataFlow:: ConfigSig {
4
+ predicate isSource ( DataFlow:: Node source ) {
7
5
DataFlow:: globalVarRef ( "process" ) .getAPropertyRead ( "argv" ) .getAPropertyRead ( ) = source
8
6
}
9
7
10
- override predicate isSink ( DataFlow:: Node sink ) {
8
+ predicate isSink ( DataFlow:: Node sink ) {
11
9
DataFlow:: moduleMember ( "fs" , "readFile" ) .getACall ( ) .getArgument ( 0 ) = sink
12
10
}
13
11
14
- override predicate isAdditionalTaintStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
12
+ predicate isAdditionalFlowStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
15
13
exists ( DataFlow:: CallNode c |
16
14
c = DataFlow:: moduleImport ( "resolve-symlinks" ) .getACall ( ) and
17
15
pred = c .getArgument ( 0 ) and
@@ -20,6 +18,8 @@ class CommandLineFileNameConfiguration extends TaintTracking::Configuration {
20
18
}
21
19
}
22
20
23
- from CommandLineFileNameConfiguration cfg , DataFlow:: Node source , DataFlow:: Node sink
24
- where cfg .hasFlow ( source , sink )
21
+ module CommandLineFileNameFlow = TaintTracking:: Global< CommandLineFileNameConfig > ;
22
+
23
+ from DataFlow:: Node source , DataFlow:: Node sink
24
+ where CommandLineFileNameFlow:: flow ( source , sink )
25
25
select source , sink
0 commit comments