mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
allow parameters that end with "Command" in js/shell-command-constructed-from-input
This commit is contained in:
@@ -53,7 +53,12 @@ module UnsafeShellCommandConstruction {
|
||||
class ExternalInputSource extends Source, DataFlow::ParameterNode {
|
||||
ExternalInputSource() {
|
||||
this = Exports::getALibraryInputParameter() and
|
||||
not this.getName() = ["cmd", "command"] // looks to be on purpose.
|
||||
not (
|
||||
// looks to be on purpose.
|
||||
this.getName() = ["cmd", "command"]
|
||||
or
|
||||
this.getName().regexpMatch(".*(Cmd|Command)$") // ends with "Cmd" or "Command"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -483,4 +483,9 @@ module.exports.splitConcat = function (name) {
|
||||
let args = ' my name is ' + name; // NOT OK
|
||||
let cmd = 'echo';
|
||||
cp.exec(cmd + args);
|
||||
}
|
||||
|
||||
module.exports.myCommand = function (myCommand) {
|
||||
let cmd = `cd ${cwd} ; ${myCommand}`; // OK - the parameter name suggests that it is purposely a shell command.
|
||||
cp.exec(cmd);
|
||||
}
|
||||
Reference in New Issue
Block a user