fix: evict js-yaml 3.x via front-matter patch + scoped resolutions (#22312)
## Summary Closes the last open Dependabot alert on `main` — [alert 1504](https://github.com/twentyhq/twenty/security/dependabot/1504) (GHSA-h67p-54hq-rp68 / CVE-2026-53550, js-yaml merge-key quadratic-complexity DoS; medium, dev scope). The 4.x js-yaml copies are already pinned to 4.2.0 (the seven `@mintlify/*` + `@verdaccio/config` resolutions). The remaining vulnerable copy was **js-yaml 3.14.2**, held by two `^3.13.1` consumers with no fixed upstream release: - `@istanbuljs/load-nyc-config@1.1.0` (jest coverage) - `front-matter@4.0.2` (mintlify docs tooling — EOL, latest is 4.0.2) ## Approach Both are forced to **js-yaml 4.2.0** via scoped resolutions, which evicts the 3.x copy entirely: ```jsonc "front-matter/js-yaml": "4.2.0", "@istanbuljs/load-nyc-config/js-yaml": "4.2.0", ``` - **load-nyc-config** already calls `yaml.load` (present + safe-by-default in 4.x), so its pin alone works. - **front-matter** crashed on js-yaml 4.x because its default loader called the removed `safeLoad`, so it's also **patched** (`.yarn/patches/front-matter-npm-4.0.2-e1cc0efa69.patch`): ```diff - var loader = allowUnsafe ? parser.load : parser.safeLoad + var loader = parser.load ``` On 4.x `load` is already safe-by-default and there's no full/unsafe schema, so the `allowUnsafe` ternary is dead. **Why the version move is a separate resolution, not folded into the patch:** a `yarn patch` only rewrites a package's *files* — it does **not** change the resolved dependency graph. Bumping js-yaml inside the patched `package.json` is ignored by resolution (verified: front-matter@patch still pulled 3.14.2 until the explicit pin was added). This is the repo's first *transitive* patch; like every other transitive override it lives in root `resolutions`. Documented in the `//resolutions` note. ## Verification - js-yaml 3.x **fully evicted** — the tree resolves js-yaml to **4.2.0 only** (no `^3.13.1` descriptor remains). - `yarn install --immutable` passes. - front-matter parses real docs front-matter correctly on 4.2.0 (unit smoke test). - **`mintlify validate` passes** — the docs toolchain builds with the patched front-matter.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
diff --git a/index.js b/index.js
|
||||
index d518f1df0974b361911ab5ed90857295ab834f0a..919937ce987cf89fb5718837970406d1cd5bfc4b 100644
|
||||
--- a/index.js
|
||||
+++ b/index.js
|
||||
@@ -59,7 +59,7 @@ function parse (string, allowUnsafe) {
|
||||
}
|
||||
}
|
||||
|
||||
- var loader = allowUnsafe ? parser.load : parser.safeLoad
|
||||
+ var loader = parser.load
|
||||
var yaml = match[match.length - 1].replace(/^\s+|\s+$/g, '')
|
||||
var attributes = loader(yaml) || {}
|
||||
var body = string.replace(match[0], '')
|
||||
+5
-2
File diff suppressed because one or more lines are too long
@@ -26301,7 +26301,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"argparse@npm:^1.0.7, argparse@npm:~1.0.9":
|
||||
"argparse@npm:~1.0.9":
|
||||
version: 1.0.10
|
||||
resolution: "argparse@npm:1.0.10"
|
||||
dependencies:
|
||||
@@ -32244,7 +32244,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esprima@npm:^4.0.0, esprima@npm:^4.0.1, esprima@npm:~4.0.0":
|
||||
"esprima@npm:^4.0.1, esprima@npm:~4.0.0":
|
||||
version: 4.0.1
|
||||
resolution: "esprima@npm:4.0.1"
|
||||
bin:
|
||||
@@ -33757,6 +33757,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"front-matter@patch:front-matter@npm%3A4.0.2#~/.yarn/patches/front-matter-npm-4.0.2-e1cc0efa69.patch":
|
||||
version: 4.0.2
|
||||
resolution: "front-matter@patch:front-matter@npm%3A4.0.2#~/.yarn/patches/front-matter-npm-4.0.2-e1cc0efa69.patch::version=4.0.2&hash=a71d01"
|
||||
dependencies:
|
||||
js-yaml: "npm:^3.13.1"
|
||||
checksum: 10c0/e4341229cd8afae77fa7466f458b5d869cc247e26c66560ee22830bf14202058c10e0de3709b0bd281495446af885a6ca9369bd1352d794672c278504b5363e5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fs-capacitor@npm:^8.0.0":
|
||||
version: 8.0.0
|
||||
resolution: "fs-capacitor@npm:8.0.0"
|
||||
@@ -38828,18 +38837,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"js-yaml@npm:^3.13.1":
|
||||
version: 3.14.2
|
||||
resolution: "js-yaml@npm:3.14.2"
|
||||
dependencies:
|
||||
argparse: "npm:^1.0.7"
|
||||
esprima: "npm:^4.0.0"
|
||||
bin:
|
||||
js-yaml: bin/js-yaml.js
|
||||
checksum: 10c0/3261f25912f5dd76605e5993d0a126c2b6c346311885d3c483706cd722efe34f697ea0331f654ce27c00a42b426e524518ec89d65ed02ea47df8ad26dcc8ce69
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jsbn@npm:~0.1.0":
|
||||
version: 0.1.1
|
||||
resolution: "jsbn@npm:0.1.1"
|
||||
|
||||
Reference in New Issue
Block a user