Closed
Description
Note: this is not about deprecation, it is about printing runtime warnings about security impact of some of the Node.js environment options. That would probably be a semver-major change.
Environment options are more dangereous because:
- It is very simple to blindly copy-paste suggestions from the internet without understanding the security impact — more simple than writing unsafe code.
- Users are more likely to blindly run some programs (like
npm
) with those than modify them to use unsafe API. - User might not even know that they are using unsafe env options: other appliations, stale/corrupted env, some libraries from npm — those all can set unsafe env options without user noticing that.
I have seen npm credentials in logs from npm being run with NODE_DEBUG=http
and those logs being attached to issues.
I have seen modules setting NODE_TLS_REJECT_UNAUTHORIZED
.
So far, the ones that I am aware of:
Upd: done in tls: warn on NODE_TLS_REJECT_UNAUTHORIZED = '0' #21900, thanks, @cjihrig!NODE_TLS_REJECT_UNAUTHORIZED=0
(Propose NODE_TLS_REJECT_UNAUTHORIZED be renamed #5258),Upd: done in util: Adding warnings when NODE_DEBUG is set as http/http2 #21914, thanks, @antsmartian!NODE_DEBUG=http
(exposes auth data, logs are unsafe to share),--inspect=0.0.0.0
flag? Not an env var, but highly copy-pasted.
Anything else?
I also would like some discussion here, as I am not sure if that is the best approach in this situation.
/cc @nodejs/security-wg