File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
javascript/ql/src/semmle/javascript/security/dataflow Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments