mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
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>
102 lines
3.0 KiB
JavaScript
102 lines
3.0 KiB
JavaScript
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const { untrustedLeafErrorCode } = require('../common/tls');
|
|
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
|
|
// Assert that the IP-as-servername deprecation warning does not occur.
|
|
process.on('warning', common.mustNotCall());
|
|
|
|
const options = {
|
|
key: fixtures.readKey('agent1-key.pem'),
|
|
cert: fixtures.readKey('agent1-cert.pem')
|
|
};
|
|
|
|
const body = 'hello world\n';
|
|
|
|
const serverCallback = common.mustCall(function(req, res) {
|
|
res.writeHead(200, { 'content-type': 'text/plain' });
|
|
res.end(body);
|
|
});
|
|
|
|
const invalid_options = [ 'foo', 42, true, [] ];
|
|
for (const option of invalid_options) {
|
|
assert.throws(() => {
|
|
new https.Server(option);
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
});
|
|
}
|
|
|
|
const server = https.createServer(options, serverCallback);
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
let tests = 0;
|
|
|
|
function done() {
|
|
if (--tests === 0)
|
|
server.close();
|
|
}
|
|
|
|
// Do a request ignoring the unauthorized server certs
|
|
const port = server.address().port;
|
|
|
|
const options = {
|
|
hostname: '127.0.0.1',
|
|
port: port,
|
|
path: '/',
|
|
method: 'GET',
|
|
rejectUnauthorized: false
|
|
};
|
|
tests++;
|
|
const req = https.request(options, common.mustCall((res) => {
|
|
let responseBody = '';
|
|
res.on('data', function(d) {
|
|
responseBody = responseBody + d;
|
|
});
|
|
|
|
res.on('end', common.mustCall(() => {
|
|
assert.strictEqual(responseBody, body);
|
|
done();
|
|
}));
|
|
}));
|
|
req.end();
|
|
|
|
// Do a request that errors due to the invalid server certs
|
|
options.rejectUnauthorized = true;
|
|
tests++;
|
|
const checkCertReq = https.request(options, common.mustNotCall()).end();
|
|
|
|
checkCertReq.on('error', common.mustCall((e) => {
|
|
assert.strictEqual(e.code, untrustedLeafErrorCode);
|
|
done();
|
|
}));
|
|
}));
|