Skip to content

chore: fix 30 of 31 security advisories (devDependencies only)#423

Open
iamdarshshah wants to merge 3 commits intomasterfrom
chore/fix-security-vulnerabilities
Open

chore: fix 30 of 31 security advisories (devDependencies only)#423
iamdarshshah wants to merge 3 commits intomasterfrom
chore/fix-security-vulnerabilities

Conversation

@iamdarshshah
Copy link
Copy Markdown
Collaborator

Summary

All 31 GitHub security advisories are in devDependencies — the published npm package has zero runtime dependencies and consumers are not affected.

This PR reduces audit findings from 213 paths (31 unique advisories) to 1 (1 low-severity advisory).

Changes

Upgrades

  • Storybook v7 → v10 — resolves the critical Handlebars JS injection advisory and clears most of the webpack5 dep tree issues (lodash, tar, old minimatch chains)
  • rollup v1 → v4 + migrated plugins (rollup-plugin-*@rollup/plugin-*) — resolves DOM clobbering and path traversal advisories
  • rimraf v3 → v5 — drops the old glob → minimatch chain

yarn resolutions (forced patched versions of unfixable transitive deps)

  • handlebars >=4.7.9 — critical in ts-jest
  • lodash >=4.17.23 — high/moderate in storybook builder
  • flatted >=3.4.2 — high in eslint + storybook
  • yaml >=2.8.3 — moderate in lint-staged
  • serialize-javascript >=7.0.5 — high/moderate in storybook webpack5
  • picomatch >=2.3.2 — high in jest

Housekeeping (fallout from Storybook v10 migration)

  • src/stories/stories.tsx: import updated to @storybook/react (v10 no longer re-exports types from the webpack5 package)
  • tsconfig.json: excluded src/stories (storybook v10 types require moduleResolution: bundler, incompatible with the lib's node setting)
  • tsconfig.storybook.json: new file extending main tsconfig with moduleResolution: bundler for stories/storybook config type-checking

Remaining advisory

@tootallnate/once@2.0.0 (low) via jest-environment-jsdom. The patched version (>=3.0.1) is a major bump that would risk breaking jsdom's HTTP agent. Acceptable to leave at low severity.

Test plan

  • yarn build — clean output, no errors
  • yarn test — 23/23 passing
  • yarn audit — 1 low remaining (down from 1 critical, 18 high, 9 moderate, 3 low)

- Upgrade Storybook v7 → v10 (resolves critical Handlebars injection,
  clears lodash/tar/minimatch chains from the webpack5 builder)
- Upgrade rollup v1 → v4 + migrate to @rollup/plugin-* (resolves DOM
  clobbering and path traversal advisories)
- Upgrade rimraf v3 → v5 (drops old glob → minimatch chain)
- Add yarn resolutions to force patched versions of: handlebars, lodash,
  flatted, yaml, serialize-javascript, picomatch
- Exclude src/stories from main tsconfig; add tsconfig.storybook.json
  with moduleResolution:bundler for Storybook v10 type compat

Audit: 213 paths (31 advisories) → 1 path (1 low advisory).
Published package is unaffected — zero runtime dependencies.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 11, 2026

Size Change: -14 B (-0.16%)

Total Size: 8.59 kB

📦 View Changed
Filename Size Change
dist/index.es.js 4.29 kB -6 B (-0.14%)
dist/index.js 4.3 kB -8 B (-0.19%)

compressed-size-action

src/stories was excluded from tsconfig.json (needed for the Storybook
v10 moduleResolution: node16 requirement) but ESLint still linted those
files — causing "file not found in project" parse errors.

Fix: add an overrides block in .eslintrc.js pointing stories files to
tsconfig.storybook.json, and add an explicit exclude in
tsconfig.storybook.json so it doesn't inherit the parent's exclusion
of src/stories.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.33%. Comparing base (e6d8fda) to head (8d7609e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #423   +/-   ##
=======================================
  Coverage   79.33%   79.33%           
=======================================
  Files           2        2           
  Lines         150      150           
  Branches       56       56           
=======================================
  Hits          119      119           
  Misses         24       24           
  Partials        7        7           
🚀 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.

Storybook v8+ removed Babel from the default webpack5 build — it must
be opted in via @storybook/addon-webpack5-compiler-babel. Without it,
webpack has no TypeScript transpiler and .ts/.tsx files fail to parse
(the Netlify CI failure).

Also bumps react/react-dom devDependencies to ^18.2.0 and @types/react*
to ^18 — Storybook v10 internally uses useSyncExternalStore and
useInsertionEffect which were added in React 18.

Note: peerDependencies stay at >=17 — consumers are unaffected.
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.

1 participant