mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

This API allows dynamically configuring CA certificates that will be used by the Node.js TLS clients by default. Once called, the provided certificates will become the default CA certificate list returned by `tls.getCACertificates('default')` and used by TLS connections that don't specify their own CA certificates. This function only affects the current Node.js thread. PR-URL: https://github.com/nodejs/node/pull/58822 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
19 lines
589 B
JavaScript
19 lines
589 B
JavaScript
'use strict';
|
|
|
|
// This tests that tls.setDefaultCACertificates() properly overrides certificates
|
|
// added through NODE_EXTRA_CA_CERTS environment variable.
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) common.skip('missing crypto');
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
|
|
|
|
spawnSyncAndExitWithoutError(process.execPath, [
|
|
fixtures.path('tls-extra-ca-override.js'),
|
|
], {
|
|
env: {
|
|
...process.env,
|
|
NODE_EXTRA_CA_CERTS: fixtures.path('keys', 'fake-startcom-root-cert.pem')
|
|
}
|
|
});
|