mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: add RemoteServerResponse as a heuristic remote flow source
This commit is contained in:
@@ -31,4 +31,25 @@ private class JSONStringifyAsCommandInjectionSource extends HeuristicSource,
|
||||
JSONStringifyAsCommandInjectionSource() {
|
||||
this = DataFlow::globalVarRef("JSON").getAMemberCall("stringify")
|
||||
}
|
||||
|
||||
override string getSourceType() { result = "a string from JSON.stringify" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A response from a remote server.
|
||||
*/
|
||||
class RemoteServerResponse extends HeuristicSource, RemoteFlowSource {
|
||||
RemoteServerResponse() {
|
||||
exists(ClientRequest r |
|
||||
this = r.getAResponseDataNode() and
|
||||
not exists(string url, string protocolPattern |
|
||||
// exclude URLs to the current host
|
||||
r.getUrl().mayHaveStringValue(url) and
|
||||
protocolPattern = "(?[a-z+]{3,10}:)" and
|
||||
not url.regexpMatch(protocolPattern + "?//.*")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override string getSourceType() { result = "a response from a remote server" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user