File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
javascript/ql/test/tutorials/Analyzing data flow in JavaScript/Global data flow Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 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 isSanitizer ( DataFlow:: Node nd ) {
15
- nd .( DataFlow:: CallNode ) .getCalleeName ( ) = "checkPath"
16
- }
12
+ predicate isBarrier ( DataFlow:: Node nd ) { nd .( DataFlow:: CallNode ) .getCalleeName ( ) = "checkPath" }
17
13
}
18
14
19
- from CommandLineFileNameConfiguration cfg , DataFlow:: Node source , DataFlow:: Node sink
20
- where cfg .hasFlow ( source , sink )
15
+ module CommandLineFileNameFlow = TaintTracking:: Global< CommandLineFileNameConfig > ;
16
+
17
+ from DataFlow:: Node source , DataFlow:: Node sink
18
+ where CommandLineFileNameFlow:: flow ( source , sink )
21
19
select source , sink
You can’t perform that action at this time.
0 commit comments