Skip to content

Commit b382465

Browse files
authored
Merge pull request github#12679 from ctbellanti/improved-certificate-validation
JS: Improved coverage for disabled certificate validation
2 parents d03dd49 + 4778332 commit b382465

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

javascript/ql/src/Security/CWE-295/DisablingCertificateValidation.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ DataFlow::InvokeNode tlsInvocation() {
1919
or
2020
result = DataFlow::moduleMember("https", "Agent").getAnInstantiation()
2121
or
22+
result = DataFlow::moduleMember("https", "createServer").getACall()
23+
or
2224
exists(DataFlow::NewNode new |
2325
new = DataFlow::moduleMember("tls", "TLSSocket").getAnInstantiation()
2426
|
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The `DisablingCertificateValidation.ql` query has been updated to check `createServer` from `https` for disabled certificate validation.

javascript/ql/test/query-tests/Security/CWE-295/DisablingCertificateValidation.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
| tst.js:45:2:45:28 | rejectU ... !!false | Disabling certificate validation is strongly discouraged. |
1010
| tst.js:48:2:48:26 | rejectU ... : !true | Disabling certificate validation is strongly discouraged. |
1111
| tst.js:74:9:74:33 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |
12+
| tst.js:80:5:80:29 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |

javascript/ql/test/query-tests/Security/CWE-295/tst.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,8 @@ function getSomeunsafeOptions() {
7474
rejectUnauthorized: false // NOT OK
7575
}
7676
}
77-
new https.Agent(getSomeunsafeOptions());
77+
new https.Agent(getSomeunsafeOptions());
78+
79+
https.createServer({
80+
rejectUnauthorized: false // NOT OK
81+
});

0 commit comments

Comments
 (0)