mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
support all ClientRequests in js/disabling-certificate-validation
This commit is contained in:
@@ -16,7 +16,7 @@ import javascript
|
||||
*/
|
||||
DataFlow::ObjectLiteralNode tlsOptions() {
|
||||
exists(DataFlow::InvokeNode invk | result.flowsTo(invk.getAnArgument()) |
|
||||
invk instanceof NodeJSLib::NodeJSClientRequest
|
||||
invk instanceof ClientRequest
|
||||
or
|
||||
invk = DataFlow::moduleMember("https", "Agent").getAnInstantiation()
|
||||
or
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
| tst2.js:8:5:8:29 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |
|
||||
| tst.js:15:3:15:27 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |
|
||||
| tst.js:18:1:18:40 | process ... HORIZED | Disabling certificate validation is strongly discouraged. |
|
||||
| tst.js:21:3:21:27 | rejectU ... : false | Disabling certificate validation is strongly discouraged. |
|
||||
|
||||
24
javascript/ql/test/query-tests/Security/CWE-295/tst2.js
Normal file
24
javascript/ql/test/query-tests/Security/CWE-295/tst2.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const request = require('request');
|
||||
|
||||
let requestOptions = {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json"
|
||||
},
|
||||
rejectUnauthorized: false,
|
||||
requestCert: true,
|
||||
agent: false
|
||||
}
|
||||
|
||||
module.exports.post = (url, requestBody, apiContext) => {
|
||||
Object.assign(requestOptions, {
|
||||
body: JSON.stringify(requestBody),
|
||||
headers : Object.assign(requestOptions.headers, apiContext)
|
||||
})
|
||||
|
||||
return request.post(url, requestOptions).then((res) => {
|
||||
return Promise.resolve(res.body);
|
||||
}).catch((err) => {
|
||||
return Promise.resolve(err);
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user