Skip to content

fix(frontend): override lodash-es and update vulnerable dependencies - #976

Merged
unhappychoice merged 2 commits into
unhappychoice:mainfrom
JMR-dev:fix-frontend-security-vulns
Sep 30, 2026
Merged

unhappychoice merged 2 commits into
unhappychoice:mainfrom
JMR-dev:fix-frontend-security-vulns

Conversation

@JMR-dev

@JMR-dev JMR-dev commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

npm audit in packages/frontend reported 21 findings (14 high, 6 moderate, 1 low). Seven advisories are in non-dev dependencies:

Advisory Severity Package Issue
GHSA-r5fr-rjxr-66jc high lodash-es 4.17.23 code injection via _.template imports keys
GHSA-f23m-r3pf-42rh moderate lodash-es 4.17.23 prototype pollution in _.unset and _.omit
GHSA-5p4m-2wfm-xmqj high js-yaml 3.15.0 (via gray-matter) quadratic CPU in !!omap resolution
GHSA-2883-xcg3-v3hh high js-yaml 3.15.0 (via gray-matter) maxTotalMergeKeys does not limit CPU for empty merge sources
GHSA-4fh9-h7wg-q85m moderate mdast-util-to-hast 13.2.0 unsanitized class attribute
GHSA-w5hq-g745-h8pq moderate uuid 11.1.0 (via mermaid) missing buffer bounds check in v3/v5/v6
GHSA-48c2-rrv3-qjmp moderate yaml 1.10.2 stack overflow on deeply nested collections

The rest are in build and test tooling.

lodash-es cannot be fixed by an update. mermaid 12.0.0, the latest release, pins chevrotain ~11.1.2, and chevrotain 11.1.2 pins lodash-es to exactly 4.17.23. npm's only suggested fix is npm audit fix --force, which downgrades mermaid to 11.17.2. The upstream fix is mermaid-js/mermaid#8273, which is still open.

What changed

One overrides entry and a lockfile refresh. No source changes.

  • packages/frontend/package.json: "lodash-es": "^4.18.1" added to overrides.
  • packages/frontend/package-lock.json: the override, npm audit fix, and three stale nested entries that audit fix left behind (webpack/node_modules/browserslist, its update-browserslist-db, and @humanfs/node 0.16.6). Those were re-resolved to the patched hoisted versions, which avoids bumping webpack and eslint themselves.
lodash-es               4.17.23 -> 4.18.1   (override)
uuid                    11.1.0  -> 14.0.2
js-yaml (gray-matter)   3.15.0  -> 3.15.2
mdast-util-to-hast      13.2.0  -> 13.2.1
yaml                    1.10.2  -> 1.10.3

npm audit:  21 -> 0

The other 17 version changes are dev-only (postcss, browserslist, nanoid, fast-uri, picomatch, minimatch, serialize-javascript, lodash and others). None crosses a major version.

Why this is safe:

  • lodash-es 4.18: 4.18.0 changes behavior only in _.template, _.unset and _.omit, and 4.18.1 fixes a build regression in 4.18.0 (release notes). Its two consumers here, chevrotain and dagre-d3-es, call none of those three functions.
  • uuid 14 is the one major bump. mermaid 12 declares ^11.1.0 || ^12 || ^13 || ^14.0.0, so a fresh install already resolves 14. Nothing in src/ imports uuid directly.

How it was verified

The Jest suite mocks mermaid (test/__mocks__/mermaid.tsx), so it exercises neither lodash-es nor uuid. The built app was therefore rendered in headless Chrome, on this branch and on main.

  • Mermaid rendering: example_documents/features/mermaid.md, served by node dist/index.js and loaded over the Chrome DevTools protocol, renders all 8 diagrams (flowchart, sequence, class, state, gantt, pie, gitGraph, journey) with no mermaid error output. pie and gitGraph go through mermaid's langium/chevrotain parser, the code that uses lodash-es. main also renders 8/8.
  • Console: the same 4 console errors on both branches, none from mermaid. They are a live-reload WebSocket error and three React DOM-prop warnings (defaultCollapseIcon, defaultExpandIcon and a non-boolean button attribute).
  • Build: npm run build:frontend passes after npm ci from the new lockfile, with 37 webpack warnings, the same count as on main.
  • Tests and lint: in packages/frontend, npm test 321/321 and npm run lint 124/124, the same as main.
  • Audit: npm audit reports 0.

Reviewer note

The lodash-es override should be removed once mermaid ships a newer chevrotain (mermaid-js/mermaid#8273). Until then, it holds lodash-es at 4.18.x for every package in the frontend tree, not just chevrotain.

Summary by CodeRabbit

  • Chores
    • Updated internal package version resolution for a supporting utility library.
    • No user-facing features or behavior changes are included in this update.

lodash-es 4.17.23 has a high-severity advisory for code injection
through _.template imports keys (GHSA-r5fr-rjxr-66jc) and a moderate
one for prototype pollution in _.unset and _.omit
(GHSA-f23m-r3pf-42rh). It reaches the frontend bundle through mermaid
12.0.0, which pins chevrotain ~11.1.2, and chevrotain 11.1.2 pins
lodash-es to exactly 4.17.23, so no normal update can move it.

npm audit's suggested fix is to downgrade mermaid to 11.17.2. Mermaid
12.0.0 is the latest release, so an override is the smaller change.
4.18.0 changes behavior only in _.template, _.unset and _.omit, and
4.18.1 fixes a build regression in 4.18.0. Neither chevrotain nor
dagre-d3-es, the other lodash-es consumer, calls those three.

Drop this override once mermaid ships a newer chevrotain
(mermaid-js/mermaid#8273).
After the lodash-es override, npm audit still reported 16 findings in
the frontend lockfile. All have patched releases inside the ranges
their dependents already declare, so package.json is untouched.

In the non-dev dependency tree: gray-matter's js-yaml 3.15.2,
mdast-util-to-hast 13.2.1, yaml 1.10.3 (via cosmiconfig) and uuid
14.0.2. uuid is the one major bump: it
comes in through mermaid 12, whose range is
^11.1.0 || ^12 || ^13 || ^14.0.0, so npm resolves 14 on any fresh
install as well. The rest are build and test tooling, such as
postcss, browserslist, nanoid, fast-uri, picomatch, minimatch and
serialize-javascript.

npm audit fix left three stale nested entries behind
(webpack/node_modules/browserslist, its update-browserslist-db, and
@humanfs/node 0.16.6). They were removed from the lockfile and
re-resolved to the patched hoisted versions rather than bumping
webpack and eslint themselves.

npm audit now reports 0 for packages/frontend.
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 54fa0fb7-dd06-4cc8-a22c-40f703d0dd63

📥 Commits

Reviewing files that changed from the base of the PR and between 283b39f and 18f8c72.

⛔ Files ignored due to path filters (1)
  • packages/frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • packages/frontend/package.json

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The frontend package overrides configuration adds lodash-es at version ^4.18.1.

Changes

Frontend dependency configuration

Layer / File(s) Summary
Add lodash-es override
packages/frontend/package.json
The package overrides configuration adds lodash-es at version ^4.18.1.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 18f8c

The dependency updates show no established compatibility failure in the reachable frontend path, so no actionable merge risk remains.

Architecture Summary

Architecture risk: 🔵 Low · up to 18f8c

The change affects 1 system.

Changed systems: packages/frontend

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/frontend (ui) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/frontend/package.json: The existing eslint-plugin-react override block is closed, and an override for lodash-es at version ^4.18.1 is added.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: adding a lodash-es override and updating vulnerable dependencies in the frontend.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/frontend/package.json

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for mdts-unhappychoice ready!

Name Link
🔨 Latest commit 18f8c72
🔍 Latest deploy log https://app.netlify.com/projects/mdts-unhappychoice/deploys/6aba99657494c80009b1db47
😎 Deploy Preview https://deploy-preview-976--mdts-unhappychoice.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.33%. Comparing base (283b39f) to head (18f8c72).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #976   +/-   ##
=======================================
  Coverage   99.33%   99.33%           
=======================================
  Files          71       71           
  Lines        1663     1663           
  Branches      397      408   +11     
=======================================
  Hits         1652     1652           
  Misses         10       10           
  Partials        1        1           
Flag Coverage Δ
frontend 99.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@unhappychoice unhappychoice left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Verified locally: clean npm ci, tests, lint and builds pass.

@unhappychoice
unhappychoice merged commit dc64549 into unhappychoice:main Sep 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants