node/lib/internal
Sam Roberts 7393e37af1
tls: support TLSv1.3
This introduces TLS1.3 support and makes it the default max protocol,
but also supports CLI/NODE_OPTIONS switches to disable it if necessary.

TLS1.3 is a major update to the TLS protocol, with many security
enhancements. It should be preferred over TLS1.2 whenever possible.

TLS1.3 is different enough that even though the OpenSSL APIs are
technically API/ABI compatible, that when TLS1.3 is negotiated, the
timing of protocol records and of callbacks broke assumptions hard-coded
into the 'tls' module.

This change introduces no API incompatibilities when TLS1.2 is
negotiated. It is the intention that it be backported to current and LTS
release lines with the default maximum TLS protocol reset to 'TLSv1.2'.
This will allow users of those lines to explicitly enable TLS1.3 if they
want.

API incompatibilities between TLS1.2 and TLS1.3 are:

- Renegotiation is not supported by TLS1.3 protocol, attempts to call
`.renegotiate()` will always fail.

- Compiling against a system OpenSSL lower than 1.1.1 is no longer
supported (OpenSSL-1.1.0 used to be supported with configure flags).

- Variations of `conn.write('data'); conn.destroy()` have undefined
behaviour according to the streams API. They may or may not send the
'data', and may or may not cause a ERR_STREAM_DESTROYED error to be
emitted. This has always been true, but conditions under which the write
suceeds is slightly but observably different when TLS1.3 is negotiated
vs when TLS1.2 or below is negotiated.

- If TLS1.3 is negotiated, and a server calls `conn.end()` in its
'secureConnection' listener without any data being written, the client
will not receive session tickets (no 'session' events will be emitted,
and `conn.getSession()` will never return a resumable session).

- The return value of `conn.getSession()` API may not return a resumable
session if called right after the handshake. The effect will be that
clients using the legacy `getSession()` API will resume sessions if
TLS1.2 is negotiated, but will do full handshakes if TLS1.3 is
negotiated.  See https://github.com/nodejs/node/pull/25831 for more
information.

Backport-PR-URL: https://github.com/nodejs/node/pull/26951
PR-URL: https://github.com/nodejs/node/pull/26209
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2019-04-15 13:31:38 +01:00
..
assert util: inspect() should not exceed breakLength 2019-04-10 15:30:27 +01:00
bootstrap process: run RunBootstrapping in CreateEnvironment 2019-04-10 15:30:28 +01:00
cluster lib: use Array#includes instead of Array#indexOf 2019-03-27 22:10:30 +01:00
console benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
crypto crypto: fix crash of encrypted private key export without cipher 2019-04-10 15:30:31 +01:00
dns dns: refactor lib/internal/dns/utils.js 2019-04-10 15:30:24 +01:00
fs fs: reduce usage of require('util') 2019-03-30 14:45:00 +01:00
http2 tools: enable getter-return lint rule 2019-03-27 22:16:21 +01:00
main src: do not call into JS in the maxAsyncCallStackDepthChanged interrupt 2019-04-08 23:15:16 +01:00
modules module: add extra caching layer 2019-04-10 15:30:30 +01:00
per_context src,lib: make DOMException available in all Contexts 2019-03-27 22:16:25 +01:00
policy policy: reduce internal usage of public util for manifest.js 2019-03-27 22:16:15 +01:00
process src: refactor coverage connection 2019-03-30 14:44:57 +01:00
repl repl: remove usage of require('util') in repl/history 2019-03-27 22:16:14 +01:00
streams benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
test src: replace heap_utils.createHeapSnapshot with v8.getHeapSnapshot 2019-03-27 21:59:02 +01:00
util util: inspect() should not exceed breakLength 2019-04-10 15:30:27 +01:00
vm lib: save primordials during bootstrap and use it in builtins 2019-02-10 19:49:06 +01:00
worker worker: remove usage of require('util') 2019-03-30 14:44:59 +01:00
assert.js assert: add internal assert.fail() 2019-02-14 14:22:56 +01:00
async_hooks.js async_hooks: minor cleanup and improvements 2019-04-10 15:30:31 +01:00
buffer.js buffer: move Buffer prototype wiring into internal/buffer.js 2019-01-17 17:00:44 +01:00
child_process.js benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
cli_table.js lib,test: remove lib/internal/test/unicode.js 2019-01-05 22:24:55 +01:00
constants.js os: lazy loaded 2018-05-18 15:25:41 +02:00
dgram.js bootstrapper: move internalBinding to NativeModule 2018-10-17 11:15:29 -07:00
encoding.js benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
error-serdes.js lib: lazy load v8 in error-serdes 2019-03-27 22:27:44 +01:00
errors.js errors: make range mandatory in ERR_OUT_OF_RANGE 2019-03-30 14:45:02 +01:00
fixed_queue.js lib: expose FixedQueue internally and fix nextTick bug 2018-05-06 07:21:32 +02:00
freelist.js async_hooks: add missing async_hooks destroys in AsyncReset 2018-10-17 11:27:01 -07:00
freeze_intrinsics.js bootstrap: experimental --frozen-intrinsics flag 2019-03-14 17:15:27 +01:00
http.js http,https: protect against slow headers attack 2018-11-27 15:30:17 +11:00
idna.js lib: convert legacy process.binding to internalBinding 2019-02-28 23:35:33 +11:00
inspector_async_hook.js process: register the inspector async hooks in bootstrap/node.js 2019-01-17 17:00:43 +01:00
js_stream_socket.js stream: reduce internal usage of public require of util 2019-03-27 22:16:12 +01:00
linkedlist.js linkedlist: correct grammar in comments 2017-07-31 08:03:19 +08:00
net.js fs: make process.binding('fs') internal 2019-01-14 13:58:08 +01:00
options.js src: cache the result of GetOptions() in JS land 2018-11-13 23:37:33 +01:00
priority_queue.js timers: fix priority queue removeAt 2018-11-15 18:56:04 +01:00
profiler.js src: refactor coverage connection 2019-03-30 14:44:57 +01:00
querystring.js lib: move encodeStr function to internal for reusable 2018-11-28 11:25:30 +11:00
readline.js benchmark,doc,lib,test: capitalize comments 2019-03-14 11:02:41 +01:00
readme.md doc: clarify text about internal module changes 2018-07-31 08:28:40 +03:00
repl.js repl: add replDefaults to customize the writer 2019-03-14 11:02:33 +01:00
socket_list.js benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
stream_base_commons.js tls: support TLSv1.3 2019-04-15 13:31:38 +01:00
timers.js timers: move big impl comment to /internal/ 2019-03-27 22:31:45 +01:00
tls.js tls: change var to const 2018-08-12 10:44:53 -07:00
trace_events_async_hooks.js process: simplify the setup of async hooks trace events 2019-02-28 23:35:36 +11:00
tty.js tty: add NO_COLOR and FORCE_COLOR support 2019-03-27 22:10:28 +01:00
url.js benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
util.js benchmark,lib: change var to const 2019-04-08 23:53:15 +01:00
v8_prof_polyfill.js v8_prof_polyfill: remove unused catch bindings 2018-11-06 20:15:31 +01:00
v8_prof_processor.js lib: convert to Arrow Function 2018-11-28 16:33:34 +01:00
validators.js lib: extract validateNumber validator 2018-08-14 11:34:34 -04:00
worker.js worker: use copy of process.env 2019-04-09 16:36:33 +01:00

Internal Modules

The modules in lib/internal are intended for internal use in Node.js core only, and are not accessible with require() from user modules. These modules can be changed at any time. Reliance on these modules outside of core is not supported in any way.