Skip to content

Commit 99af484

Browse files
committed
move the "commander" source
1 parent 2ae0400 commit 99af484

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ module IndirectCommandInjection {
7373
API::moduleImport("dashdash"),
7474
API::moduleImport("dashdash").getMember("createParser").getReturn()
7575
].getMember("parse").getACall()
76+
or
77+
// `require('commander').myCmdArgumentName`
78+
this = commander().getAMember().getAnImmediateUse()
79+
or
80+
// `require('commander').opt()` => `{a: ..., b: ...}`
81+
this = commander().getMember("opts").getACall()
7682
}
7783
}
7884

@@ -105,19 +111,6 @@ module IndirectCommandInjection {
105111
result = commander().getAMember().getReturn()
106112
}
107113

108-
/**
109-
* A source of user input from the command-line parsed by the `commander` library.
110-
*/
111-
private class CommanderSource extends Source {
112-
CommanderSource() {
113-
// the parsed commands are stored as properties on the command object.
114-
this = commander().getAMember().getAnImmediateUse()
115-
or
116-
// or the `opts()` method gets a list of them.
117-
this = commander().getMember("opts").getACall()
118-
}
119-
}
120-
121114
/**
122115
* Gets an instance of `yargs`.
123116
* Either directly imported as a module, or through some chained method call.

0 commit comments

Comments
 (0)