File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -586,22 +586,27 @@ module NodeJSLib {
586
586
}
587
587
}
588
588
589
+ /**
590
+ * Gets a possibly promisified (using `util.promisify`) version of the input `func`.
591
+ */
592
+ DataFlow:: SourceNode maybePromisified ( DataFlow:: SourceNode func ) {
593
+ result = func
594
+ or
595
+ exists ( DataFlow:: CallNode promisify |
596
+ promisify = DataFlow:: moduleMember ( "util" , "promisify" ) .getACall ( )
597
+ |
598
+ result = promisify and promisify .getArgument ( 0 ) .getALocalSource ( ) = func
599
+ )
600
+ }
601
+
589
602
/**
590
603
* A call to a method from module `child_process`.
591
604
*/
592
605
private class ChildProcessMethodCall extends SystemCommandExecution , DataFlow:: CallNode {
593
606
string methodName ;
594
607
595
608
ChildProcessMethodCall ( ) {
596
- this = DataFlow:: moduleMember ( "child_process" , methodName ) .getACall ( )
597
- or
598
- exists ( DataFlow:: CallNode promisify |
599
- promisify = DataFlow:: moduleMember ( "util" , "promisify" ) .getACall ( )
600
- |
601
- this = promisify .getACall ( ) and
602
- promisify .getArgument ( 0 ) .getALocalSource ( ) =
603
- DataFlow:: moduleMember ( "child_process" , methodName )
604
- )
609
+ this = maybePromisified ( DataFlow:: moduleMember ( "child_process" , methodName ) ) .getACall ( )
605
610
}
606
611
607
612
private DataFlow:: Node getACommandArgument ( boolean shell ) {
You can’t perform that action at this time.
0 commit comments