Skip to content

Commit c66a34b

Browse files
authored
Merge pull request github#6533 from erik-krogh/cwdPath
Approved by asgerf
2 parents c0e8680 + 99d7e8b commit c66a34b

File tree

4 files changed

+322
-1
lines changed

4 files changed

+322
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* The `js/tainted-path` query now recognizes the `cwd` option to shell invocations as a sink.

javascript/ql/src/semmle/javascript/security/dataflow/TaintedPathCustomizations.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,18 @@ module TaintedPath {
696696
}
697697
}
698698

699+
/**
700+
* The `cwd` option to a shell execution.
701+
*/
702+
private class ShellCwdSink extends TaintedPath::Sink {
703+
ShellCwdSink() {
704+
exists(SystemCommandExecution sys, API::Node opts |
705+
opts.getARhs() = sys.getOptionsArg() and // assuming that an API::Node exists here.
706+
this = opts.getMember("cwd").getARhs()
707+
)
708+
}
709+
}
710+
699711
/**
700712
* Holds if there is a step `src -> dst` mapping `srclabel` to `dstlabel` relevant for path traversal vulnerabilities.
701713
*/

0 commit comments

Comments
 (0)