Merge pull request #12679 from ctbellanti/improved-certificate-validation

JS: Improved coverage for disabled certificate validation
This commit is contained in:
Erik Krogh Kristensen
2023-03-30 16:24:33 +02:00
committed by GitHub
4 changed files with 12 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ DataFlow::InvokeNode tlsInvocation() {
or
result = DataFlow::moduleMember("https", "Agent").getAnInstantiation()
or
result = DataFlow::moduleMember("https", "createServer").getACall()
or
exists(DataFlow::NewNode new |
new = DataFlow::moduleMember("tls", "TLSSocket").getAnInstantiation()
|

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The `DisablingCertificateValidation.ql` query has been updated to check `createServer` from `https` for disabled certificate validation.

View File

@@ -9,3 +9,4 @@
| tst.js:45:2:45:28 | rejectU ... !!false | Disabling certificate validation is strongly discouraged. |
| tst.js:48:2:48:26 | rejectU ... : !true | Disabling certificate validation is strongly discouraged. |
| tst.js:74:9:74:33 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |
| tst.js:80:5:80:29 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |

View File

@@ -74,4 +74,8 @@ function getSomeunsafeOptions() {
rejectUnauthorized: false // NOT OK
}
}
new https.Agent(getSomeunsafeOptions());
new https.Agent(getSomeunsafeOptions());
https.createServer({
rejectUnauthorized: false // NOT OK
});