code-settings-sync: Why is NODE_TLS_REJECT_UNAUTHORIZED set to 0?
š Describe the bug
When running my app with Node.js 11 within VS Code, I get the following message when making an https request:
(node:28306) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ā0ā makes TLS connections and HTTPS requests insecure by disabling certificate verification.
When I run my app with Node.js 11 without VS Code, I do not get this message.
I narrowed it down to this extension setting the variable to 0: https://github.com/shanalikhan/code-settings-sync/blob/e80b2ceca227490e5e12f33d419659343e2a705c/src/environmentPath.ts#L84
Why is this being set and does it have to be?
š“ Visual Studio Code Version : [ 1.31.1 ]
š“ Code Settings Sync Version : [ 3.2.5 ]
š“ Standard or Insiders : [ standard ]
š“ Operating System : [ macOS ]
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (6 by maintainers)
This is done , several users reported earlier that they are facing problems in certificates while connecting to github.
Is there any problem you are facing with this configuration ?
Yes, this is highly insecure. You are disabling TLS validation for any process running within VS Code. Now my app does not validate SSL certificates when run with VS Code
The solution should never be a complete disable of such a low level security feature which is paramount for secure systems. Especially if it side effects into the whole process. The problem is with those usersā machines/networks and a library should never try and fix a problem that does not even come remotely close to its primary function.
I believe I grepped my VS Code extensions folder for that environment variable key and then found the line (and therefore the extension) where it was being set.
If users report SSL trust issues, they should be sent here: https://code.visualstudio.com/docs/setup/network#_ssl-certificates
Edit: Worst case, the user with the issue can turn it off in VS Code if they wish with
--ignore-certificate-errors, but it should not be the default for everyone.I sent PR #779 which removes the disabling of TLS certificate validation. It would make this safe to use again.
@MattMorgis thanks, I found my culprit āAzure Reposā extension from Microsoft š
@MattMorgis after the 3.2.6 update I havenāt been able to use this extension. Whenever I try to update/upload I get an error (Sync: Internet not connected or unable to connect to GitHub. Exception logged in Console). When I look at the console thereās a couple of āunable to verify the first certificateā errors. I have tried setting my
http.proxyStrictSSLto false and launching vs code with the--ignore-certificate-errorsflag without any luck.What do you think of having a setting that would set
NODE_TLS_REJECT_UNAUTHORIZEDto 0 right before a network request and set it back to 1 right after? Or is that still insecure?Indeed. I had to uninstall the plugin for now to restore normal behaviour.
I am open for PR if it solves the problem in both ways, installing CA and not using validation.