Skip to content

fix(frontend): resolve high-severity npm audit vulns reddening Security Scanning (#1510) - #1511

Merged
cristim merged 2 commits into
mainfrom
fix/frontend-npm-audit-1510
Jul 27, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/frontend-npm-audit-1510

Conversation

@cristim

@cristim cristim commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Summary

npm audit --audit-level=high in the frontend was exiting 1 with 30 high-severity advisories, reddening the Security Scanning job (and therefore CI Success) repo-wide on every open PR, including ones that don't touch the frontend.

  • postcss <=8.5.17 (GHSA-r28c-9q8g-f849, path traversal in source-map auto-loading): resolved via plain npm audit fix (semver-compatible lockfile bump, no code change).
  • brace-expansion <=5.0.7 / minimatch 2.0.0-10.0.2 (GHSA-mh99-v99m-4gvg, DoS via unbounded expansion): pulled in transitively by eslint, jest/@jest/reporters, ts-jest/babel-plugin-istanbul, and serve/serve-handler, all pinning an old minimatch internally. serve and eslint are already at their latest available majors, and serve-handler hard-pins minimatch@3.1.5 with no newer release published, so bumping any of those packages directly would not have fixed it. Resolved with a targeted overrides entry in frontend/package.json forcing minimatch to ^10.2.5 and brace-expansion to ^5.0.8 across the whole dependency tree.

npm audit fix --force was tried first per the standard remediation path, but it actually downgraded jest to ^25.0.0 and serve to ^6.5.8 to satisfy its own resolver heuristics (npm's force-fix picks minimal-diff versions, not necessarily the safest/latest ones). That result was reverted and not shipped; the overrides approach was used instead, which resolves the same advisories without touching eslint/jest major versions at all, so no eslint flat-config migration or jest 30 breaking-change handling was needed.

Verification

  • rm -rf node_modules && npm ci from the committed lockfile, then npm audit --audit-level=high -> found 0 vulnerabilities, exit 0.
  • npm run build -> webpack compiles clean (1 pre-existing bundle-size warning, unrelated).
  • npm run lint -> 0 errors, 125 pre-existing warnings (@typescript-eslint/no-explicit-any).
  • npm run typecheck -> clean.
  • npm test -> 86/86 suites, 2729 passed, 1 pre-existing skip (same as baseline; note the sandbox's de_DE locale flips $1,200-style assertions to $1.200 independent of this change - confirmed pre-existing on git stash, unrelated, tests pass with LC_ALL=en_US.UTF-8).

Only frontend/package.json and frontend/package-lock.json changed.

Test plan

  • npm ci && npm audit --audit-level=high exits 0
  • npm run build succeeds
  • npm run lint / npm run typecheck clean
  • npm test green (86 suites, 2729 passed)
  • CI Security Scanning job goes green on this PR

Closes #1510

Summary by CodeRabbit

  • Chores
    • Updated dependency version resolutions to improve compatibility and consistency.

npm audit --audit-level=high was exiting 1 with 30 high-severity
advisories, reddening the Security Scanning job (and CI Success)
repo-wide on every open PR.

- postcss <=8.5.17 (GHSA-r28c-9q8g-f849, path traversal in source-map
  auto-loading): resolved via plain `npm audit fix` (semver-compatible
  lockfile bump, no code change needed).
- brace-expansion <=5.0.7 / minimatch 2.0.0-10.0.2 (GHSA-mh99-v99m-4gvg,
  DoS via unbounded expansion): this chain is pulled in transitively by
  eslint, jest/@jest/reporters, ts-jest/babel-plugin-istanbul, and
  serve/serve-handler, all of which pin an old minimatch internally.
  serve and eslint are already at their latest majors, and serve-handler
  hard-pins minimatch@3.1.5 with no newer release available, so this
  could not be resolved by bumping any of those packages directly.
  Resolved with a targeted npm "overrides" entry forcing minimatch to
  ^10.2.5 and brace-expansion to ^5.0.8 across the whole tree, instead
  of a blanket `npm audit fix --force` (which was tried first and
  actually downgraded jest to ^25.0.0 and serve to ^6.5.8 to satisfy its
  own resolver heuristics - reverted, not shipped).

No eslint/jest major bump was needed, so no config migration (eslint
flat config, jest 30 breaking changes) was required.

Verified: npm ci from the committed lockfile, npm audit --audit-level=high
exits 0 (0 vulnerabilities), frontend build/lint/typecheck/test all green
(86 suites, 2729 passed, 1 pre-existing skip).
@cristim cristim added triaged Item has been triaged priority/p1 Next up; this sprint severity/high Significant harm urgency/this-sprint Within the current sprint impact/all-users Affects every user effort/m Days type/security Security finding labels Jul 26, 2026
@cristim

cristim commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 31b6a84d-c243-4dac-b480-5c01da59f8c5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a frontend npm override that resolves brace-expansion to ^5.0.8 without changing other package metadata or tooling configuration.

Changes

Frontend dependency override

Layer / File(s) Summary
Override brace-expansion version
frontend/package.json
Adds a top-level overrides entry for brace-expansion at ^5.0.8.

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

Possibly related issues

  • LeanerCloud/CUDly#1487 — Both modify frontend dependency resolution through package.json overrides, targeting different transitive packages.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive Cannot fully verify the audit remediation because package-lock.json, where the lockfile fix would live, was excluded by path filters. Provide reviewable package-lock.json changes or remove the exclusion so the postcss and serve/minimatch fixes can be verified.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the frontend npm-audit vulnerability fix and Security Scanning remediation.
Out of Scope Changes check ✅ Passed The only visible change is a brace-expansion override, which aligns with the vulnerability remediation scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/frontend-npm-audit-1510

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

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/package.json`:
- Around line 54-55: Remove the global minimatch entry from the overrides block
in frontend/package.json and scope the override only to the vulnerable
dependency chain, or first upgrade all listed minimatch@^3 consumers so they
safely support the newer version. Preserve compatible dependency resolution for
glob@7.2.3, eslint, `@humanwhocodes/config-array`, test-exclude, and
serve-handler.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 63f7b6c8-c58d-4637-93a8-b884fe916078

📥 Commits

Reviewing files that changed from the base of the PR and between d9eb097 and eb5cb2e.

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

Comment thread frontend/package.json Outdated
@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 1 unresolved review comment.

Files modified:

  • frontend/package-lock.json
  • frontend/package.json

Commit: cbcab4b7471bfbc1edb7751a91f6748aaba375de

The changes have been pushed to the fix/frontend-npm-audit-1510 branch.

Time taken: 16m 17s

…to-fix)

This replaces coderabbitai bot commit cbcab4b, which introduced
unreachable private-registry (10.0.0.28) URLs into package-lock.json
and an incompatible test-exclude@8/glob@13 dependency bump. That combo
caused npm ci to hang for roughly 5 minutes in CI trying to reach the
unreachable registry, canceling Build frontend, Build Docker, E2E,
Playwright, and pre-commit checks.

Instead of forcing a global minimatch@^10 override, this scopes the
fix to brace-expansion only, the actual transitive dependency behind
GHSA-mh99-v99m-4gvg. That advisory has no patched release on the 1.x
or 2.x lines, only 5.0.8+, so a single unscoped override is both
necessary and sufficient. Consumers like glob@7, eslint, jest,
test-exclude, and serve-handler keep their intended minimatch major
instead of being forced onto minimatch@10.

npm audit --audit-level=high reports 0 vulnerabilities and the full
build/lint/typecheck/test suite is green against the regenerated
lockfile.
@cristim
cristim force-pushed the fix/frontend-npm-audit-1510 branch from cbcab4b to 6b6e3ec Compare July 27, 2026 10:08
@cristim

cristim commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit ab682d9 into main Jul 27, 2026
21 checks passed
@cristim
cristim deleted the fix/frontend-npm-audit-1510 branch July 27, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/all-users Affects every user priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged type/security Security finding urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(frontend): 30 high-severity npm-audit vulns reddening Security Scanning repo-wide (postcss/serve/minimatch)

1 participant