Skip to content

Commit f317bba

Browse files
Trottdanielleadams
authored andcommittedDec 7, 2020
tls: permit null as a cipher value
Allow null along with undefined for cipher value. Fixes: #36292 PR-URL: #36318 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 29b5236 commit f317bba

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎lib/_tls_common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ exports.createSecureContext = function createSecureContext(options) {
263263
}
264264
}
265265

266-
if (ciphers !== undefined)
266+
if (ciphers != null)
267267
validateString(ciphers, 'options.ciphers');
268268

269269
// Work around an OpenSSL API quirk. cipherList is for TLSv1.2 and below,

‎test/parallel/test-tls-set-ciphers.js

+4
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,7 @@ test('AES256-SHA', ':', U, U, 'ERR_INVALID_ARG_VALUE');
104104
// Using '' is synonymous for "use default ciphers"
105105
test('TLS_AES_256_GCM_SHA384', '', 'TLS_AES_256_GCM_SHA384');
106106
test('', 'TLS_AES_256_GCM_SHA384', 'TLS_AES_256_GCM_SHA384');
107+
108+
// Using null should be treated the same as undefined.
109+
test(null, 'AES256-SHA', 'AES256-SHA');
110+
test('AES256-SHA', null, 'AES256-SHA');

0 commit comments

Comments
 (0)
Please sign in to comment.