joyent/node — pull request #4023 by bnoordhuis (2012-09-14 22:21:36+00:00)
Title: tls, https: default to rejectUnauthorized=true in tls.connect and https.request

Quoting the commit log:

tls, https: validate server certificates by default

This commit changes the default value of the rejectUnauthorized option from
false to true.

What that means is that tls.connect(), https.get() and https.request() will
reject invalid server certificates from now on, including self-signed
certificates.

There is an escape hatch: if you set the NODE_TLS_REJECT_UNAUTHORIZED
environment variable to the literal string "0", node.js reverts to its
old behavior.

Fixes #3949.

The second commit updates the tests to set `rejectUnauthorized` explicitly instead of mucking with the environment.

Suggested reviewer: @indutny