@@ -68,6 +68,11 @@ class ClientRequest extends DataFlow::InvokeNode {
68
68
* wrapped in a promise object.
69
69
*/
70
70
DataFlow:: Node getAResponseDataNode ( ) { result = getAResponseDataNode ( _, _) }
71
+
72
+ /**
73
+ * Gets a data-flow node that determines where in the file-system the result of the request should be saved.
74
+ */
75
+ DataFlow:: Node getASavePath ( ) { result = self .getASavePath ( ) }
71
76
}
72
77
73
78
deprecated class CustomClientRequest = ClientRequest:: Range ;
@@ -103,6 +108,11 @@ module ClientRequest {
103
108
* See the decription of `responseType` in `ClientRequest::getAResponseDataNode`.
104
109
*/
105
110
DataFlow:: Node getAResponseDataNode ( string responseType , boolean promise ) { none ( ) }
111
+
112
+ /**
113
+ * Gets a data-flow node that determines where in the file-system the result of the request should be saved.
114
+ */
115
+ DataFlow:: Node getASavePath ( ) { none ( ) }
106
116
}
107
117
108
118
/**
@@ -180,6 +190,14 @@ module ClientRequest {
180
190
}
181
191
182
192
override DataFlow:: Node getADataNode ( ) { result = getArgument ( 1 ) }
193
+
194
+ override DataFlow:: Node getASavePath ( ) {
195
+ exists ( DataFlow:: CallNode write |
196
+ write = DataFlow:: moduleMember ( "fs" , "createWriteStream" ) .getACall ( ) and
197
+ write = this .getAMemberCall ( "pipe" ) .getArgument ( 0 ) .getALocalSource ( ) and
198
+ result = write .getArgument ( 0 )
199
+ )
200
+ }
183
201
}
184
202
185
203
/** Gets the string `url` or `uri`. */
@@ -632,6 +650,10 @@ module ClientRequest {
632
650
override DataFlow:: Node getHost ( ) { none ( ) }
633
651
634
652
override DataFlow:: Node getADataNode ( ) { none ( ) }
653
+
654
+ override DataFlow:: Node getASavePath ( ) {
655
+ result = this .getArgument ( 1 ) .getALocalSource ( ) .getAPropertyWrite ( "target" ) .getRhs ( )
656
+ }
635
657
}
636
658
637
659
/**
0 commit comments