Skip to content

Commit 6971091

Browse files
committed
tls: validate 'as' option using validateOneOf
1 parent c5466e9 commit 6971091

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/tls.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ const { Buffer } = require('buffer');
6060
const { canonicalizeIP } = internalBinding('cares_wrap');
6161
const tlsCommon = require('internal/tls/common');
6262
const tlsWrap = require('internal/tls/wrap');
63-
const { validateString } = require('internal/validators');
63+
const {
64+
validateOneOf,
65+
validateString,
66+
} = require('internal/validators');
6467
const { X509Certificate } = require('crypto');
6568

6669
// Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations
@@ -174,6 +177,7 @@ function getCACertificates(options = {}) {
174177

175178
const { type = 'default', as = 'buffer' } = options;
176179
validateString(type, 'type');
180+
validateOneOf(as, 'as', ['buffer', 'x509']);
177181

178182
let certs;
179183
switch (type) {

test/parallel/test-tls-get-ca-certificates-x509-option.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ function testX509Option() {
1919
}
2020

2121
testX509Option();
22-

0 commit comments

Comments
 (0)