fix(deps): close js-yaml DoS alert + document rembg non-reachability (#286)

* fix(deps): patch gray-matter onto js-yaml 4.2.0 (close js-yaml DoS alert)

js-yaml 3.14.2 (quadratic-complexity DoS in merge-key handling, GHSA
patched only in 4.2.0) was kept in the tree by a scoped pnpm override
"gray-matter>js-yaml": "^3.14.1" that exempted gray-matter from the
global js-yaml>=4.2.0 override. gray-matter is a build-time-only
transitive dep of the docs site (vitepress-plugin-llms,
@sugarat/theme-shared) and pinned 3.x because it calls the removed
yaml.safeLoad / yaml.safeDump APIs.

Remove the exemption so gray-matter resolves js-yaml 4.2.0, and add a
pnpm patch renaming safeLoad->load / safeDump->dump (the 4.x
equivalents; load is safe by default). js-yaml 3.x is now gone from the
lockfile.

Verified: gray-matter parse+stringify smoke test passes on 4.2.0; full
VitePress docs build green (177 pages, llms plugin parses all tool
frontmatter with no safeLoad/safeDump error).

* docs(ai): document rembg 2.0.69 pin and advisory non-reachability

The patched rembg 2.0.75 pulls a numpy 2.x closure (numpy>=2.3,
scipy>=1.16, scikit-image>=0.26) that is incompatible with the
numpy==1.26.4-locked AI stack (realesrgan 0.3.0 and codeformer-pip 0.0.4
break on numpy 2.x). Both open rembg advisories are unreachable in this
codebase: rembg is used purely as a library (never the `rembg s`
server), and new_session() only receives allowlisted model names
(remove_bg.py ALLOWED_MODELS), never user-controlled paths. Record this
rationale next to the pin; the Dependabot alerts are dismissed as
not_used.
This commit is contained in:
SnapOtter
2026-06-21 23:24:10 +08:00
committed by GitHub
parent c203267866
commit 5d5117acf7
5 changed files with 41 additions and 34 deletions
+3 -1
View File
@@ -110,12 +110,14 @@
"@babel/core": ">=7.29.6",
"@opentelemetry/core": ">=2.8.0",
"js-yaml": ">=4.2.0",
"gray-matter>js-yaml": "^3.14.1",
"qs": ">=6.15.2",
"uuid": ">=11.1.1",
"yaml": ">=2.8.3",
"dompurify": ">=3.4.11",
"nanoid@4": ">=5.0.9"
},
"patchedDependencies": {
"gray-matter@4.0.3": "patches/gray-matter@4.0.3.patch"
}
},
"dependencies": {
+7
View File
@@ -1,3 +1,10 @@
# rembg is pinned to 2.0.69. The patched 2.0.75 (GHSA: server SSRF/CORS +
# custom-model path traversal) pulls numpy>=2.3, scipy>=1.16 and
# scikit-image>=0.26 -- a numpy 2.x closure that is incompatible with this
# numpy==1.26.4-locked stack (realesrgan 0.3.0 and codeformer-pip 0.0.4 break
# on numpy 2.x). Both advisories are unreachable here: rembg is used purely as
# a library (we never run `rembg s`), and new_session() only ever receives
# allowlisted model names (remove_bg.py ALLOWED_MODELS), never user paths.
rembg==2.0.69
realesrgan==0.3.0
paddleocr==2.9.1
+7
View File
@@ -1,3 +1,10 @@
# rembg is pinned to 2.0.69. The patched 2.0.75 (GHSA: server SSRF/CORS +
# custom-model path traversal) pulls numpy>=2.3, scipy>=1.16 and
# scikit-image>=0.26 -- a numpy 2.x closure that is incompatible with this
# numpy==1.26.4-locked stack (realesrgan 0.3.0 and codeformer-pip 0.0.4 break
# on numpy 2.x). Both advisories are unreachable here: rembg is used purely as
# a library (we never run `rembg s`), and new_session() only ever receives
# allowlisted model names (remove_bg.py ALLOWED_MODELS), never user paths.
rembg[cpu]==2.0.69
realesrgan==0.3.0
paddleocr[doc-parser]>=3.4.0,<3.5.0
+15
View File
@@ -0,0 +1,15 @@
diff --git a/lib/engines.js b/lib/engines.js
index 38f993db06cf364191ac635a6590c2d29303297d..1dfec8d9527653ad9ccfaacfa59732246fdb1e32 100644
--- a/lib/engines.js
+++ b/lib/engines.js
@@ -13,8 +13,8 @@ const engines = exports = module.exports;
*/
engines.yaml = {
- parse: yaml.safeLoad.bind(yaml),
- stringify: yaml.safeDump.bind(yaml)
+ parse: yaml.load.bind(yaml),
+ stringify: yaml.dump.bind(yaml)
};
/**
+9 -33
View File
@@ -24,13 +24,17 @@ overrides:
'@babel/core': '>=7.29.6'
'@opentelemetry/core': '>=2.8.0'
js-yaml: '>=4.2.0'
gray-matter>js-yaml: ^3.14.1
qs: '>=6.15.2'
uuid: '>=11.1.1'
yaml: '>=2.8.3'
dompurify: '>=3.4.11'
nanoid@4: '>=5.0.9'
patchedDependencies:
gray-matter@4.0.3:
hash: vkz7jnrv727ytpnfp5cox2adfu
path: patches/gray-matter@4.0.3.patch
importers:
.:
@@ -3999,9 +4003,6 @@ packages:
arg@5.0.2:
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
argparse@1.0.10:
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
argparse@2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
@@ -4920,11 +4921,6 @@ packages:
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
engines: {node: '>=12'}
esprima@4.0.1:
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
engines: {node: '>=4'}
hasBin: true
estree-walker@2.0.2:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
@@ -5596,10 +5592,6 @@ packages:
js-tokens@9.0.1:
resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==}
js-yaml@3.14.2:
resolution: {integrity: sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==}
hasBin: true
js-yaml@4.2.0:
resolution: {integrity: sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==}
hasBin: true
@@ -7367,9 +7359,6 @@ packages:
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'}
sprintf-js@1.0.3:
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
ssh-remote-port-forward@1.0.4:
resolution: {integrity: sha512-x0LV1eVDwjf1gmG7TTnfqIzf+3VPRz7vrNIjX6oYLbeCrf/PeVY6hkT68Mg+q02qXxQhrLjB0jfgvhevoCRmLQ==}
@@ -11580,7 +11569,7 @@ snapshots:
'@sugarat/theme-shared@0.0.7':
dependencies:
cross-spawn: 7.0.6
gray-matter: 4.0.3
gray-matter: 4.0.3(patch_hash=vkz7jnrv727ytpnfp5cox2adfu)
'@swc/helpers@0.5.23':
dependencies:
@@ -12393,10 +12382,6 @@ snapshots:
arg@5.0.2: {}
argparse@1.0.10:
dependencies:
sprintf-js: 1.0.3
argparse@2.0.1: {}
argv-formatter@1.0.0: {}
@@ -13277,8 +13262,6 @@ snapshots:
escape-string-regexp@5.0.0: {}
esprima@4.0.1: {}
estree-walker@2.0.2: {}
estree-walker@3.0.3:
@@ -13674,9 +13657,9 @@ snapshots:
graceful-fs@4.2.11: {}
gray-matter@4.0.3:
gray-matter@4.0.3(patch_hash=vkz7jnrv727ytpnfp5cox2adfu):
dependencies:
js-yaml: 3.14.2
js-yaml: 4.2.0
kind-of: 6.0.3
section-matter: 1.0.0
strip-bom-string: 1.0.0
@@ -14063,11 +14046,6 @@ snapshots:
js-tokens@9.0.1: {}
js-yaml@3.14.2:
dependencies:
argparse: 1.0.10
esprima: 4.0.1
js-yaml@4.2.0:
dependencies:
argparse: 2.0.1
@@ -16061,8 +16039,6 @@ snapshots:
split2@4.2.0: {}
sprintf-js@1.0.3: {}
ssh-remote-port-forward@1.0.4:
dependencies:
'@types/ssh2': 0.5.52
@@ -16712,7 +16688,7 @@ snapshots:
vitepress-plugin-llms@1.13.1:
dependencies:
gray-matter: 4.0.3
gray-matter: 4.0.3(patch_hash=vkz7jnrv727ytpnfp5cox2adfu)
markdown-it: 14.2.0
markdown-title: 1.0.2
mdast-util-from-markdown: 2.0.3