Enhance PipeCall to exclude non-function and non-object arguments in pipe method detection

This commit is contained in:
Napalys Klicius
2025-05-22 12:19:05 +02:00
parent 4332de464a
commit d7f86db76c
3 changed files with 8 additions and 5 deletions

View File

@@ -15,7 +15,12 @@ import javascript
* A call to the `pipe` method on a Node.js stream.
*/
class PipeCall extends DataFlow::MethodCallNode {
PipeCall() { this.getMethodName() = "pipe" and this.getNumArgument() = [1, 2] }
PipeCall() {
this.getMethodName() = "pipe" and
this.getNumArgument() = [1, 2] and
not this.getArgument(0).asExpr() instanceof Function and
not this.getArgument(0).asExpr() instanceof ObjectExpr
}
/** Gets the source stream (receiver of the pipe call). */
DataFlow::Node getSourceStream() { result = this.getReceiver() }