Context
Two open Dependabot alerts on lodash-es, both reaching us transitively:
| # |
severity |
range |
patched |
summary |
| 97 |
high |
>= 4.0.0, <= 4.17.23 |
4.18.0 |
code injection via _.template imports key names |
| 98 |
medium |
<= 4.17.23 |
4.18.0 |
prototype pollution via array path bypass in _.unset and _.omit |
Nothing in neomjs/neo imports lodash. The path is entirely upstream:
mermaid@12.0.0 (devDependency)
├─┬ chevrotain@11.1.2
│ ├── lodash-es@4.17.23 ← vulnerable
│ ├─┬ @chevrotain/cst-dts-gen@11.1.2
│ │ └── lodash-es@4.17.23 ← vulnerable
│ └─┬ @chevrotain/gast@11.1.2
│ └── lodash-es@4.17.23 ← vulnerable
└─┬ dagre-d3-es@7.0.14
└── lodash-es@4.18.1 ← already patched
Live latest-open sweep 2026-09-16T19:2xZ: no open ticket on either alert. A2A sweep of the latest 30 messages: no claim on dependency security.
The Problem — "devDependency" understates it
mermaid is a devDependency, which normally ends the conversation. It does not here: the bundle it produces is a published artifact.
npm run bundle-mermaid → buildScripts/build/mermaid.mjs → dist/mermaid.mjs
.npmignore:81 carries !/dist/mermaid.mjs — an explicit negation, so that file is published
src/component/wrapper/Mermaid.mjs and src/main/addon/Mermaid.mjs load it at runtime
So the chevrotain code that imports lodash-es is compiled into an artifact every consumer of neo.mjs receives. The honest framing is not "we do not use lodash" but "we ship a bundle that contains lodash code".
The Architectural Reality — and why this is not urgent
Measured rather than assumed, in both the tree and the shipped artifact:
1. Chevrotain does not import either vulnerable function. Its 27 lodash-es import sites pull 40 names:
assign clone compact defaults difference drop dropRight every filter find first flatMap flatten forEach groupBy has identity includes indexOf isArray isEmpty isFunction isObject isRegExp isString isUndefined keys last map noop pickBy reduce reject some uniq values …
template, unset and omit are absent. It uses pickBy, not omit. The single template hit in chevrotain's source is the word inside a comment about template strings.
2. The shipped bundle contains neither. Against the built dist/mermaid.mjs (3.4 MB):
function template 0
function unset 0
function omit 0
baseUnset 0
esbuild tree-shakes what nothing imports, so the vulnerable sinks are not in the artifact at all.
So neither advisory is exploitable through this path today — not in node_modules, not in what consumers receive.
That is a reason to patch calmly, not a reason to dismiss. The tree-shake is an accident of chevrotain's current import list. A single patch-level chevrotain release that starts using omit would put a prototype-pollution sink into a published bundle, and by then the alert would already be closed as "not applicable" if we dismissed it.
Upstream has moved, but we cannot follow. chevrotain@13.2.0 dropped lodash-es entirely — its dependency set is @chevrotain/* only. But mermaid@latest is still 12.0.0 and pins chevrotain: ~11.1.2, so the fix is unreachable by upgrading anything we declare.
The Fix
An overrides entry, which is already this repository's idiom for exactly this shape:
"overrides": {
"gray-matter": {"js-yaml": "^3.15.2"},
"monaco-editor": {"dompurify": "^3.4.13"}
}Add "lodash-es": "^4.18.0" at top level rather than scoped under chevrotain. Scoped would need three entries — chevrotain, @chevrotain/cst-dts-gen, @chevrotain/gast — because a nested override only governs that package's own dependency. Top level covers all three and is a no-op for dagre-d3-es, which already resolves 4.18.1.
4.17.23 → 4.18.x is same-major, and one consumer in this very tree already runs 4.18.1.
Acceptance Criteria
Out of Scope
- Upgrading
mermaid — 12.0.0 is latest and pins the vulnerable range itself.
- Vendoring or patching chevrotain.
- The other
overrides entries.
- Rebuilding and committing
dist/mermaid.mjs — it is gitignored (.gitignore:68) and built at publish time.
Avoided Traps
- ⛔ Do not dismiss the alerts as "devDependency, not shipped".
.npmignore:81 publishes the bundle; the code does reach consumers.
- ⛔ Do not dismiss them as "not exploitable" either. True today, and true only because chevrotain happens not to import those two functions. The measurement belongs in the PR body as the reason it is not urgent, never as the reason to close it unpatched.
- ⛔ Do not scope the override under
chevrotain alone. Two of the three vulnerable copies sit under @chevrotain/cst-dts-gen and @chevrotain/gast, which a chevrotain-scoped entry does not reach.
- ⛔ Do not let the lock diff sprawl.
npm install under a new override can re-resolve more than intended; AC-4 is the check, and a wide diff means stop and narrow rather than ship it.
Related
Dependabot alerts #97, #98 · .npmignore:81 (publishes the bundle) · buildScripts/build/mermaid.mjs
Origin Session ID: 5bf0b816-b919-40fc-9c18-fee751fd1635
Retrieval Hint: "lodash-es transitive chevrotain mermaid bundle shipped npmignore negation override tree-shaken template unset omit"
Context
Two open Dependabot alerts on
lodash-es, both reaching us transitively:>= 4.0.0, <= 4.17.234.18.0_.templateimports key names<= 4.17.234.18.0_.unsetand_.omitNothing in
neomjs/neoimports lodash. The path is entirely upstream:Live latest-open sweep 2026-09-16T19:2xZ: no open ticket on either alert. A2A sweep of the latest 30 messages: no claim on dependency security.
The Problem — "devDependency" understates it
mermaidis a devDependency, which normally ends the conversation. It does not here: the bundle it produces is a published artifact.npm run bundle-mermaid→buildScripts/build/mermaid.mjs→dist/mermaid.mjs.npmignore:81carries!/dist/mermaid.mjs— an explicit negation, so that file is publishedsrc/component/wrapper/Mermaid.mjsandsrc/main/addon/Mermaid.mjsload it at runtimeSo the chevrotain code that imports
lodash-esis compiled into an artifact every consumer ofneo.mjsreceives. The honest framing is not "we do not use lodash" but "we ship a bundle that contains lodash code".The Architectural Reality — and why this is not urgent
Measured rather than assumed, in both the tree and the shipped artifact:
1. Chevrotain does not import either vulnerable function. Its 27
lodash-esimport sites pull 40 names:template,unsetandomitare absent. It usespickBy, notomit. The singletemplatehit in chevrotain's source is the word inside a comment about template strings.2. The shipped bundle contains neither. Against the built
dist/mermaid.mjs(3.4 MB):esbuild tree-shakes what nothing imports, so the vulnerable sinks are not in the artifact at all.
So neither advisory is exploitable through this path today — not in
node_modules, not in what consumers receive.That is a reason to patch calmly, not a reason to dismiss. The tree-shake is an accident of chevrotain's current import list. A single patch-level chevrotain release that starts using
omitwould put a prototype-pollution sink into a published bundle, and by then the alert would already be closed as "not applicable" if we dismissed it.Upstream has moved, but we cannot follow.
chevrotain@13.2.0droppedlodash-esentirely — its dependency set is@chevrotain/*only. Butmermaid@latestis still12.0.0and pinschevrotain: ~11.1.2, so the fix is unreachable by upgrading anything we declare.The Fix
An
overridesentry, which is already this repository's idiom for exactly this shape:"overrides": { "gray-matter": {"js-yaml": "^3.15.2"}, "monaco-editor": {"dompurify": "^3.4.13"} }Add
"lodash-es": "^4.18.0"at top level rather than scoped underchevrotain. Scoped would need three entries —chevrotain,@chevrotain/cst-dts-gen,@chevrotain/gast— because a nested override only governs that package's own dependency. Top level covers all three and is a no-op fordagre-d3-es, which already resolves4.18.1.4.17.23 → 4.18.x is same-major, and one consumer in this very tree already runs 4.18.1.
Acceptance Criteria
npm ls lodash-es --allreports no version<= 4.17.23; the three chevrotain copies resolve^4.18.0.npm run bundle-mermaidstill produces a workingdist/mermaid.mjs, verified by the specs that render it —e2e/portal/LearnMermaidRender.spec.mjsandunit/component/MermaidTheme.spec.mjs.package-lock.jsondiff touches onlylodash-esresolutions. An override that quietly re-resolves unrelated packages is a different change.revalidationTrigger: the override is retired whenmermaidmoves tochevrotain@13, which needs no lodash at all. Recorded as a comment beside the entry, so removing it is a decision rather than an archaeology exercise.Out of Scope
mermaid—12.0.0is latest and pins the vulnerable range itself.overridesentries.dist/mermaid.mjs— it is gitignored (.gitignore:68) and built at publish time.Avoided Traps
.npmignore:81publishes the bundle; the code does reach consumers.chevrotainalone. Two of the three vulnerable copies sit under@chevrotain/cst-dts-genand@chevrotain/gast, which achevrotain-scoped entry does not reach.npm installunder a new override can re-resolve more than intended; AC-4 is the check, and a wide diff means stop and narrow rather than ship it.Related
Dependabot alerts #97, #98 ·
.npmignore:81(publishes the bundle) ·buildScripts/build/mermaid.mjsOrigin Session ID: 5bf0b816-b919-40fc-9c18-fee751fd1635
Retrieval Hint: "lodash-es transitive chevrotain mermaid bundle shipped npmignore negation override tree-shaken template unset omit"