-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(jest): revert
CVE-2023-46809
to allow openpgp tests to pass (#…
- Loading branch information
Showing
2 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { spawnSync } from 'node:child_process'; | ||
import { argv, env, version } from 'node:process'; | ||
import semver from 'semver'; | ||
|
||
// needed for tests | ||
env.GIT_ALLOW_PROTOCOL = 'file'; | ||
// reduce logging | ||
env.LOG_LEVEL = 'fatal'; | ||
|
||
const args = ['--experimental-vm-modules']; | ||
|
||
/* | ||
* openpgp encryption is broken because it needs PKCS#1 v1.5 | ||
* - #27375 | ||
* - https://nodejs.org/en/blog/vulnerability/february-2024-security-releases#nodejs-is-vulnerable-to-the-marvin-attack-timing-variant-of-the-bleichenbacher-attack-against-pkcs1-v15-padding-cve-2023-46809---medium | ||
* | ||
* Sadly there is no way to suppress `SECURITY WARNING: Reverting CVE-2023-46809: Marvin attack on PKCS#1 padding` warining | ||
*/ | ||
if (semver.satisfies(version, '^18.19.1 || ^20.11.1 || >=21.6.2')) { | ||
args.push('--security-revert=CVE-2023-46809'); | ||
} | ||
|
||
args.push('node_modules/jest/bin/jest.js', '--logHeapUsage'); | ||
|
||
// add other args after `node tools/jest.mjs` | ||
args.push(...argv.slice(2)); | ||
|
||
spawnSync('node', args, { stdio: 'inherit', env }); |