recognize bound functions in js/shell-command-constructed-from-input

This commit is contained in:
Erik Krogh Kristensen
2020-12-22 11:11:59 +01:00
parent e2bba97794
commit 6a9089b15e

View File

@@ -51,10 +51,12 @@ module UnsafeShellCommandConstruction {
*/
class ExternalInputSource extends Source, DataFlow::ParameterNode {
ExternalInputSource() {
this =
Exports::getAValueExportedBy(Exports::getTopmostPackageJSON())
.getAFunctionValue()
.getAParameter() and
exists(int bound, DataFlow::FunctionNode func |
func =
Exports::getAValueExportedBy(Exports::getTopmostPackageJSON())
.getABoundFunctionValue(bound) and
this = func.getParameter(any(int arg | arg >= bound))
) and
not this.getName() = ["cmd", "command"] // looks to be on purpose.
}
}