Skip to content

Commit d3f5145

Browse files
danbevtargos
authored andcommitted
test: use openssl_is_fips instead of hasFipsCrypto
Currently, when dynamically linking against a FIPS enabled OpenSSL library test-process-env-allowed-flags-are-documented will fail with the following error: assert.js:89 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: The following options are not documented as allowed in NODE_OPTIONS in /root/node/doc/api/cli.md: --enable-fips --force-fips at Object.<anonymous> (/test/parallel/test-process-env-allowed-flags-are-documented.js:82:8) at Module._compile (internal/modules/cjs/loader.js:779:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:790:10) at Module.load (internal/modules/cjs/loader.js:642:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:842:10) at internal/main/run_main_module.js:17:11 { generatedMessage: false, code: 'ERR_ASSERTION', actual: 2, expected: 0, operator: 'strictEqual' } This commit updates the test to use process.config.variables.openssl_is_fips instead of common.hasFipsCrypto as hasFipsCrypto only returns true if the OpenSSL library that is shipped with node was configured with FIPS enabled. PR-URL: #28507 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 1770bc8 commit d3f5145

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/parallel/test-process-env-allowed-flags-are-documented.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ const conditionalOpts = [
4646
return ['--openssl-config', '--tls-cipher-list', '--use-bundled-ca',
4747
'--use-openssl-ca' ].includes(opt);
4848
} },
49-
{ include: common.hasFipsCrypto,
49+
{
50+
// We are using openssl_is_fips from the configuration because it could be
51+
// the case that OpenSSL is FIPS compatible but fips has not been enabled
52+
// (starting node with --enable-fips). If we use common.hasFipsCrypto
53+
// that would only tells us if fips has been enabled, but in this case we
54+
// want to check options which will be available regardless of whether fips
55+
// is enabled at runtime or not.
56+
include: process.config.variables.openssl_is_fips,
5057
filter: (opt) => opt.includes('-fips') },
5158
{ include: common.hasIntl,
5259
filter: (opt) => opt === '--icu-data-dir' },

0 commit comments

Comments
 (0)