mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
move the "commander" source
This commit is contained in:
@@ -73,6 +73,12 @@ module IndirectCommandInjection {
|
||||
API::moduleImport("dashdash"),
|
||||
API::moduleImport("dashdash").getMember("createParser").getReturn()
|
||||
].getMember("parse").getACall()
|
||||
or
|
||||
// `require('commander').myCmdArgumentName`
|
||||
this = commander().getAMember().getAnImmediateUse()
|
||||
or
|
||||
// `require('commander').opt()` => `{a: ..., b: ...}`
|
||||
this = commander().getMember("opts").getACall()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,19 +111,6 @@ module IndirectCommandInjection {
|
||||
result = commander().getAMember().getReturn()
|
||||
}
|
||||
|
||||
/**
|
||||
* A source of user input from the command-line parsed by the `commander` library.
|
||||
*/
|
||||
private class CommanderSource extends Source {
|
||||
CommanderSource() {
|
||||
// the parsed commands are stored as properties on the command object.
|
||||
this = commander().getAMember().getAnImmediateUse()
|
||||
or
|
||||
// or the `opts()` method gets a list of them.
|
||||
this = commander().getMember("opts").getACall()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of `yargs`.
|
||||
* Either directly imported as a module, or through some chained method call.
|
||||
|
||||
Reference in New Issue
Block a user