tls: move tls.parseCertString to end-of-life · nodejs/node@807c7e1 · GitHub
Skip to content

Commit 807c7e1

Browse files
committed
tls: move tls.parseCertString to end-of-life
The internal use of tls.parseCertString was removed in a336444. The function does not handle multi-value RDNs correctly, leading to incorrect representations and security concerns. This change is breaking in two ways: tls.parseCertString is removed (but has been runtime-deprecated since Node.js 9) and _tls_common.translatePeerCertificate does not translate the `subject` and `issuer` properties anymore. This change also removes the recommendation to use querystring.parse instead, which is similarly dangerous. PR-URL: #41479 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent f7be6ab commit 807c7e1

6 files changed

Lines changed: 21 additions & 148 deletions

File tree

doc/api/deprecations.md

Lines changed: 10 additions & 17 deletions

lib/_tls_common.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ const {
5555
configSecureContext,
5656
} = require('internal/tls/secure-context');
5757

58-
const {
59-
parseCertString,
60-
} = require('internal/tls/parse-cert-string');
61-
6258
function toV(which, v, def) {
6359
if (v == null) v = def;
6460
if (v === 'TLSv1') return TLS1_VERSION;
@@ -126,13 +122,9 @@ function translatePeerCertificate(c) {
126122
if (!c)
127123
return null;
128124

129-
// TODO(tniessen): can we remove parseCertString without breaking anything?
130-
if (typeof c.issuer === 'string') c.issuer = parseCertString(c.issuer);
131125
if (c.issuerCertificate != null && c.issuerCertificate !== c) {
132126
c.issuerCertificate = translatePeerCertificate(c.issuerCertificate);
133127
}
134-
// TODO(tniessen): can we remove parseCertString without breaking anything?
135-
if (typeof c.subject === 'string') c.subject = parseCertString(c.subject);
136128
if (c.infoAccess != null) {
137129
const info = c.infoAccess;
138130
c.infoAccess = ObjectCreate(null);

lib/internal/tls/parse-cert-string.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

lib/tls.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ const { canonicalizeIP } = internalBinding('cares_wrap');
6464
const _tls_common = require('_tls_common');
6565
const _tls_wrap = require('_tls_wrap');
6666
const { createSecurePair } = require('internal/tls/secure-pair');
67-
const { parseCertString } = require('internal/tls/parse-cert-string');
6867

6968
// Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations
7069
// every {CLIENT_RENEG_WINDOW} seconds. An error event is emitted if more
@@ -338,12 +337,6 @@ exports.Server = _tls_wrap.Server;
338337
exports.createServer = _tls_wrap.createServer;
339338
exports.connect = _tls_wrap.connect;
340339

341-
exports.parseCertString = internalUtil.deprecate(
342-
parseCertString,
343-
'tls.parseCertString() is deprecated. ' +
344-
'Please use querystring.parse() instead.',
345-
'DEP0076');
346-
347340
exports.createSecurePair = internalUtil.deprecate(
348341
createSecurePair,
349342
'tls.createSecurePair() is deprecated. Please use ' +

test/parallel/test-tls-parse-cert-string.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

test/parallel/test-tls-translate-peer-certificate.js

Lines changed: 11 additions & 10 deletions

0 commit comments

Comments
 (0)