Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 075e47d

Browse files
committed
JS: Add header/headers response type
1 parent ea4bfda commit 075e47d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

javascript/ql/src/semmle/javascript/frameworks/ClientRequests.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class ClientRequest extends DataFlow::InvokeNode {
5353
* - Any of the following additional response types defined by this library:
5454
* - `fetch.response`: The result is a `Response` object from [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Response).
5555
* - `stream`: The result is a Node.js stream and `http.IncomingMessage` object
56+
* - `header`: The result the value of a header, as a string
57+
* - `headers`: The result is a mapping from header names to their values.
5658
* - `error`: The result is an error in an unspecified format, possibly containing information from the response
5759
* - An empty string, indicating an unknown response type.
5860
* - Any value provided by custom implementations of `ClientRequest::Range`.
@@ -461,10 +463,9 @@ module ClientRequest {
461463
prop = "responseXML" and responseType = "document"
462464
)
463465
or
464-
responseType = "text" and
465466
exists(string method | result = getAnAlias().getAMethodCall(method) |
466-
method = "getAllResponseHeaders" or
467-
method = "getResponseHeader"
467+
method = "getAllResponseHeaders" and responseType = "headers" or
468+
method = "getResponseHeader" and responseType = "header"
468469
)
469470
)
470471
}
@@ -540,7 +541,9 @@ module ClientRequest {
540541
exists(string method | result = getAnAlias().getAMethodCall(method) |
541542
method = "getResponse" and responseType = getAssignedResponseType()
542543
or
543-
method = "getResponseHeader" and responseType = "text"
544+
method = "getResponseHeader" and responseType = "header"
545+
or
546+
method = "getResponseHeaders" and responseType = "headers"
544547
or
545548
method = "getResponseJson" and responseType = "json"
546549
or

0 commit comments

Comments
 (0)