@@ -29,34 +29,26 @@ class CommandInjectionAdditionalFlowStep extends Unit {
2929 abstract predicate step ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) ;
3030}
3131
32- private class ProcessSink2 extends CommandInjectionSink instanceof DataFlow:: Node {
33- ProcessSink2 ( ) {
34- exists ( AssignExpr assign , ProcessHost s |
35- assign .getDest ( ) = s and
36- this .asExpr ( ) = assign .getSource ( )
37- )
38- or
39- exists ( AssignExpr assign , ProcessHost s , ArrayExpr a |
40- assign .getDest ( ) = s and
41- a = assign .getSource ( ) and
42- this .asExpr ( ) = a .getAnElement ( )
43- )
44- }
45- }
46-
32+ /**
33+ * A reference to any member of `Process`.
34+ */
4735private class ProcessHost extends MemberRefExpr {
4836 ProcessHost ( ) { this .getBase ( ) instanceof ProcessRef }
4937}
5038
51- /** An expression of type `Process`. */
39+ /**
40+ * An expression of type `Process`.
41+ */
5242private class ProcessRef extends Expr {
5343 ProcessRef ( ) {
5444 this .getType ( ) instanceof ProcessType or
5545 this .getType ( ) = any ( OptionalType t | t .getBaseType ( ) instanceof ProcessType )
5646 }
5747}
5848
59- /** The type `Process`. */
49+ /**
50+ * The type `Process`.
51+ */
6052private class ProcessType extends NominalType {
6153 ProcessType ( ) { this .getFullName ( ) = "Process" }
6254}
@@ -77,6 +69,24 @@ private class ProcessSink extends CommandInjectionSink instanceof DataFlow::Node
7769 }
7870}
7971
72+ /**
73+ * A `DataFlow::Node` that is written into a field of a `Process` object.
74+ */
75+ private class ProcessSink2 extends CommandInjectionSink instanceof DataFlow:: Node {
76+ ProcessSink2 ( ) {
77+ exists ( AssignExpr assign , ProcessHost s |
78+ assign .getDest ( ) = s and
79+ this .asExpr ( ) = assign .getSource ( )
80+ )
81+ or
82+ exists ( AssignExpr assign , ProcessHost s , ArrayExpr a |
83+ assign .getDest ( ) = s and
84+ a = assign .getSource ( ) and
85+ this .asExpr ( ) = a .getAnElement ( )
86+ )
87+ }
88+ }
89+
8090/**
8191 * A sink defined in a CSV model.
8292 */
0 commit comments