Conversation
725c1e3 to
3c9cc27
Compare
3c9cc27 to
3ea16ee
Compare
|
|
||
| // Create an agent that can negotiate both HTTP/1.1 and HTTP/2 | ||
| const httpsAgent = new Agent({ | ||
| rejectUnauthorized: false, // For development with self-signed certs |
Check failure
Code scanning / CodeQL
Disabling certificate validation
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
To fix this problem, ensure rejectUnauthorized is not set to false when creating the HTTPS agent. The best way is to set it to true (the default) or omit it entirely unless you have a robust mechanism to only disable certificate validation during development/testing (e.g., based on process.env.NODE_ENV). For maximum safety and minimum code change, replace rejectUnauthorized: false with rejectUnauthorized: true. If development with self-signed certificates is needed, provide a secure and explicit way for users to opt-in only during development (not shown in current code), but the sample only allows updating the flag. All changes are in packages/diagnostic/server/src/-private/serve/fetch.ts, lines 15–18.
| @@ -13,7 +13,7 @@ | ||
|
|
||
| // Create an agent that can negotiate both HTTP/1.1 and HTTP/2 | ||
| const httpsAgent = new Agent({ | ||
| rejectUnauthorized: false, // For development with self-signed certs | ||
| rejectUnauthorized: true, // Certificate validation enabled | ||
| ALPNProtocols: ['http/1.1', 'h2'], // Try HTTP/1.1 first, then HTTP/2 | ||
| }); | ||
|
|
3ea16ee to
e6f96d2
Compare
0125589 to
3daa1f7
Compare
No description provided.