Python: Add tests of requests

Also adjusts test slightly. Writing
`clientRequestDisablesCertValidation=False` to mean that certificate
validation was disabled by the `False` expression is just confusing, as
it easily reads as _certificate validate was NOT disabled_ :|

The new one ties to each request that is being made, which seems like
the right setup.
This commit is contained in:
Rasmus Wriedt Larsen
2021-12-13 13:38:58 +01:00
parent 7bf285a52e
commit 1ff56d5143
6 changed files with 63 additions and 7 deletions

View File

@@ -480,7 +480,7 @@ class HttpClientRequestTest extends InlineExpectationsTest {
HttpClientRequestTest() { this = "HttpClientRequestTest" }
override string getARelevantTag() {
result in ["clientRequestUrl", "clientRequestDisablesCertValidation"]
result in ["clientRequestUrl", "clientRequestCertValidationDisabled"]
}
override predicate hasActualResult(Location location, string element, string tag, string value) {
@@ -494,12 +494,12 @@ class HttpClientRequestTest extends InlineExpectationsTest {
)
or
exists(location.getFile().getRelativePath()) and
exists(HTTP::Client::Request req, DataFlow::Node disablingNode |
req.disablesCertificateValidation(disablingNode, _) and
location = disablingNode.getLocation() and
element = disablingNode.toString() and
value = prettyNodeForInlineTest(disablingNode) and
tag = "clientRequestDisablesCertValidation"
exists(HTTP::Client::Request req |
req.disablesCertificateValidation(_, _) and
location = req.getLocation() and
element = req.toString() and
value = "" and
tag = "clientRequestCertValidationDisabled"
)
}
}