Skip to content

Commit

Permalink
tls: permit null as a cipher value
Browse files Browse the repository at this point in the history
Allow null along with undefined for cipher value.

Fixes: #36292

PR-URL: #36318
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
Trott authored and danielleadams committed Dec 7, 2020
1 parent 29b5236 commit f317bba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/_tls_common.js
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-tls-set-ciphers.js
Expand Up @@ -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');

0 comments on commit f317bba

Please sign in to comment.