Skip to content

Commit 6a9089b

Browse files
committed
recognize bound functions in js/shell-command-constructed-from-input
1 parent e2bba97 commit 6a9089b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ module UnsafeShellCommandConstruction {
5151
*/
5252
class ExternalInputSource extends Source, DataFlow::ParameterNode {
5353
ExternalInputSource() {
54-
this =
55-
Exports::getAValueExportedBy(Exports::getTopmostPackageJSON())
56-
.getAFunctionValue()
57-
.getAParameter() and
54+
exists(int bound, DataFlow::FunctionNode func |
55+
func =
56+
Exports::getAValueExportedBy(Exports::getTopmostPackageJSON())
57+
.getABoundFunctionValue(bound) and
58+
this = func.getParameter(any(int arg | arg >= bound))
59+
) and
5860
not this.getName() = ["cmd", "command"] // looks to be on purpose.
5961
}
6062
}

0 commit comments

Comments
 (0)