Files
node/test/parallel/test-tls-socket-default-options.js
Filip Skokan a2ce2c6def tls,tools: update BoringSSL pin and TLS errors
Use BoringSSL 0.20261020.0 for shared-library builds and expose the
package wrapper's version to the matrix updater.

The new verifier no longer emits UNABLE_TO_VERIFY_LEAF_SIGNATURE
after Node's verification callback accepts a missing-issuer error.
Expect UNABLE_TO_GET_ISSUER_CERT_LOCALLY for the affected leaf
certificates and suggest --use-system-ca for that error.

Drop the SSL_get_server_tmp_key() fallback now that BoringSSL supplies
SSL_get_peer_tmp_key() as a compatibility stub.

Refs: https://boringssl-review.googlesource.com/c/boringssl/+/103849
Refs: https://github.com/electron/electron/pull/55110/changes/b457e70e339e8bb3066b210edfb6f96582cdb374
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/66922
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-10-24 22:04:13 +00:00

69 lines
2.0 KiB
JavaScript

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
// Test directly created TLS sockets and options.
const assert = require('assert');
const {
connect, keys, tls
} = require(fixtures.path('tls-connect'));
const { untrustedLeafErrorCode } = require('../common/tls');
test(undefined, (err) => {
assert.strictEqual(err.code, untrustedLeafErrorCode);
});
test({}, (err) => {
assert.strictEqual(err.code, untrustedLeafErrorCode);
});
test(
{ secureContext: tls.createSecureContext({ ca: keys.agent1.ca }) },
(err) => { assert.ifError(err); });
test(
{ ca: keys.agent1.ca },
(err) => { assert.ifError(err); });
// Secure context options, like ca, are ignored if a sec ctx is explicitly
// provided.
test(
{ secureContext: tls.createSecureContext(), ca: keys.agent1.ca },
(err) => {
assert.strictEqual(err.code, untrustedLeafErrorCode);
});
function test(client, callback) {
callback = common.mustCall(callback);
connect({
server: {
key: keys.agent1.key,
cert: keys.agent1.cert,
},
}, common.mustCall(function(err, pair, cleanup) {
assert.strictEqual(err.code, untrustedLeafErrorCode);
let recv = '';
pair.server.server.once('secureConnection', common.mustCall((conn) => {
conn.on('data', (data) => recv += data);
conn.on('end', common.mustCall(() => {
// Server sees nothing wrong with connection, even though the client's
// authentication of the server cert failed.
assert.strictEqual(recv, 'hello');
cleanup();
}));
}));
// `new TLSSocket` doesn't support the 'secureConnect' event on client side,
// and doesn't error if authentication failed. Caller must explicitly check
// for failure.
(new tls.TLSSocket(null, client)).connect(pair.server.server.address().port)
.on('connect', common.mustCall(function() {
this.end('hello');
}))
.on('secure', common.mustCall(function() {
callback(this.ssl.verifyError());
}));
}));
}