@@ -42,26 +42,28 @@ private class CommandInjectionArrayAdditionalFlowStep extends CommandInjectionAd
42
42
}
43
43
}
44
44
45
- /**
46
- * A `DataFlow::Node` that is written into a `Process` object.
47
- */
48
- private class ProcessSink extends CommandInjectionSink instanceof DataFlow:: Node {
49
- ProcessSink ( ) {
50
- // any write into a class derived from `Process` is a sink. For
51
- // example in `Process.launchPath = sensitive` the post-update node corresponding
52
- // with `Process.launchPath` is a sink.
53
- exists ( NominalType t , Expr e |
54
- t .getABaseType * ( ) .getUnderlyingType ( ) .getName ( ) = "Process" and
55
- this .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( ) = e and
56
- e .getFullyConverted ( ) .getType ( ) = t and
57
- not e .( DeclRefExpr ) .getDecl ( ) instanceof SelfParamDecl
58
- )
59
- }
60
- }
61
-
62
45
/**
63
46
* A sink defined in a CSV model.
64
47
*/
65
48
private class DefaultCommandInjectionSink extends CommandInjectionSink {
66
49
DefaultCommandInjectionSink ( ) { sinkNode ( this , "command-injection" ) }
67
50
}
51
+
52
+ private class CommandInjectionSinks extends SinkModelCsv {
53
+ override predicate row ( string row ) {
54
+ row =
55
+ [
56
+ ";Process;true;run(_:arguments:terminationHandler:);;;Argument[0..1];command-injection" ,
57
+ ";Process;true;launchedProcess(launchPath:arguments:);;;Argument[0..1];command-injection" ,
58
+ ";Process;true;arguments;;;PostUpdate;command-injection" ,
59
+ ";Process;true;currentDirectory;;;PostUpdate;command-injection" ,
60
+ ";Process;true;environment;;;PostUpdate;command-injection" ,
61
+ ";Process;true;executableURL;;;PostUpdate;command-injection" ,
62
+ ";Process;true;standardError;;;PostUpdate;command-injection" ,
63
+ ";Process;true;standardInput;;;PostUpdate;command-injection" ,
64
+ ";Process;true;standardOutput;;;PostUpdate;command-injection" ,
65
+ ";Process;true;currentDirectoryPath;;;PostUpdate;command-injection" ,
66
+ ";Process;true;launchPath;;;PostUpdate;command-injection" ,
67
+ ]
68
+ }
69
+ }
0 commit comments