Skip to content

Commit 3783133

Browse files
committed
Fix sink
1 parent c9fadd9 commit 3783133

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

swift/ql/lib/codeql/swift/security/CommandInjectionExtensions.qll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ 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+
47+
private class ProcessHost extends MemberRefExpr {
48+
ProcessHost() { this.getBase() instanceof ProcessRef }
49+
}
50+
3251
/** An expression of type `Process`. */
3352
private class ProcessRef extends Expr {
3453
ProcessRef() {

0 commit comments

Comments
 (0)