diff --git a/lib/_tls_common.js b/lib/_tls_common.js index ef40ea2591e879..b1d28b9c49aad4 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -263,7 +263,7 @@ exports.createSecureContext = function createSecureContext(options) { } } - if (ciphers !== undefined) + if (ciphers != null) validateString(ciphers, 'options.ciphers'); // Work around an OpenSSL API quirk. cipherList is for TLSv1.2 and below, diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index 57bd2f8652a3e0..f08af9b089adb9 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -104,3 +104,7 @@ test('AES256-SHA', ':', U, U, 'ERR_INVALID_ARG_VALUE'); // Using '' is synonymous for "use default ciphers" test('TLS_AES_256_GCM_SHA384', '', 'TLS_AES_256_GCM_SHA384'); test('', 'TLS_AES_256_GCM_SHA384', 'TLS_AES_256_GCM_SHA384'); + +// Using null should be treated the same as undefined. +test(null, 'AES256-SHA', 'AES256-SHA'); +test('AES256-SHA', null, 'AES256-SHA');