chore(web/personas-open-source): remediate Dependabot vulns (#7327)#7386
Conversation
npm audit 17 -> 5 (3C/6H/8M -> 0C/3H/2M). ALL 3 CRITICALS cleared: - next 15.0.3 -> ^15.5.18 (in-Next-15 minor; clears the next CRIT — NOT the 14->16 major the other web apps needed) - form-data, protobufjs (non-breaking, lockfile) + flatted/minimatch/picomatch non-breaking transitive fixes. RESIDUAL (5 — documented, breaking-major-gated, same class as the web/app|admin|frontend next-16 decision): - eslint-config-next / @next/eslint-plugin-next / glob (HIGH) — fix is eslint-config-next@16 -> forces eslint 8->9 + plugin migration - next / postcss (MOD) — fix needs a further next major (16) Flagged for the same deliberate next-16 / eslint-9 migration. Validated: `next build` (Next 15.5.18) exit 0. (Pre-existing ERESOLVE peer conflict next@15<->@radix-ui handled with --legacy-peer-deps; not introduced by this change.)
Greptile SummaryThis PR remediates Dependabot security findings in
Confidence Score: 4/5Safe to merge — all critical CVEs are cleared, the build passes, and the remaining five vulnerabilities are deliberately deferred with documented justification. The
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[npm audit before\n17 vulns: 3C / 6H / 8M] --> B{Remediable without\nbreaking changes?}
B -- Yes --> C[Bump next 15.0.3 → 15.5.18\nform-data, protobufjs,\nflatted, minimatch, picomatch]
B -- No --> D[Deferred — requires\nnext major 16 +\neslint 8→9 migration]
C --> E[npm audit after\n5 vulns: 0C / 3H / 2M]
D --> F[eslint-config-next stays at 14.x\npostcss vulnerability remains]
E --> G[next build → exit 0\nvia --legacy-peer-deps]
|
Runtime test caught: next 15.0.3 -> 15.5.18 makes mixpanel-browser
2.56.0 (unchanged) throw an uncaught client TypeError
("Cannot read properties of undefined (reading 'load_prop')") on /
and /chat — reproducible, absent on the next 15.0.3 baseline (same
env). Per decision (option 2): keep the non-breaking critical +
transitive fixes (form-data, protobufjs, flatted, minimatch,
picomatch), revert next to 15.0.3.
net vs main: package-lock.json only (package.json unchanged).
npm audit 17 -> 5. Cleared: form-data, protobufjs (CRITICAL) + others.
RESIDUAL (flagged, deferred): the `next` CRITICAL stays — its fix
(next 15.5.18) introduces the mixpanel-browser regression above, which
needs a Next-15.5 + mixpanel-init code fix (out of scope for a deps
PR). Tracked separately.
Validated: `next build` exit 0; `next start` route walkthrough = 0
page errors / 0 5xx, identical to the unmodified next 15.0.3 baseline
(regression gone).
|
Follow-up: the deferred |
…ion (#7327) (#7399) Part of #7327. Lands the previously-deferred personas `next` security bump by **root-causing and fixing** the mixpanel regression that blocked #7386 (where option 2 reverted `next` to 15.0.3). ## Root cause (the #7386 blocker) `src/lib/mixpanel.ts` called `mixpanel.init()` at **module top-level**. App-Router `'use client'` pages are still **server-rendered on the initial request**, so this module executed during SSR (Node, no `window`/`localStorage`). Next 15.0.3 tolerated it; Next 15.5+ evaluates it strictly and it throws `Cannot read properties of undefined (reading 'load_prop')` on `/` and `/chat`. **Fix:** initialize lazily on first **client-side** use and no-op on the server. The exported `Mixpanel` API is unchanged, so `page.tsx` / `chat/page.tsx` need **zero edits**. (Verified: baseline server logs `Mixpanel loaded successfully` server-side at 15.0.3 — exactly the unsafe path now removed.) ## Security bumps (clears all 27 personas alerts) | package | from | to | notes | |---|---|---|---| | next | 15.0.3 | **15.5.18** | ~25 alerts incl. **2 critical + 8 high**. 15.5.18 (not .16) is first-patched for GHSA-26hh-7cqf-hhc6 "Incomplete Fix Follow-Up" | | eslint-config-next | ^14.2.6 | ^15.5.16 | Next-owned companion, coupled to the next line | | glob | (transitive) | 10.5.0 | high | | postcss | ^8 | ^8.5.10 + `overrides: { "postcss": "$postcss" }` | dedupes Next's **vendored** vulnerable `postcss@8.4.31` copy too | `mixpanel-browser` intentionally **unchanged** at 2.56.0 — the bug was our usage, not the library. **`npm audit` → 0 vulnerabilities.** ## Config cleanup (coupled) Removed `output: 'standalone'` + a dead `import next` from `next.config.mjs`. The Dockerfile deploys via `next start` and never uses `.next/standalone`, so `standalone` was dead config that emits a `"next start does not work with output: standalone"` warning (present even at 15.0.3). Aligns config with the real deploy path. `next-env.d.ts` regenerated by `next build` (version-coupled, kept in sync). ## Validation (rigorous, not assumed) - **`npm audit` → found 0 vulnerabilities** (all 27 alerts: next/postcss/glob). - **Build:** clean at 15.5.18; `/` and `/chat` prerender with **no `load_prop`**. - **Runtime regression-isolation:** built + `next start` for both this branch and **unmodified main (next 15.0.3)**, identical dummy env, Playwright walkthrough of `/`, `/chat`, `/login`, `/u/<user>`, `/u/<missing>`: | metric | baseline (15.0.3, unmodified) | this PR (15.5.18 + fix) | |---|---|---| | all 5 routes | 200 | 200 | | **page errors** | **0** | **0** | | 5xx | 0 | 0 | | console errors | 1 (`/chat` 404, env/dummy-data) | 1 (`/chat` 404 — *identical*) | Byte-for-byte identical error profile → **zero regressions**; the `load_prop` crash is gone. ## Alerts cleared **27** (web/personas-open-source/package-lock.json): ~25 next (2 critical + 8 high + med/low) + 1 postcss + 1 glob. Closes the deferred residual from #7386.
mixpanel.init() ran at module scope, so it executed during App-Router SSR (no window/localStorage). Next 15.0.3 tolerated it; Next 15.5+ surfaces it as 'Cannot read properties of undefined (reading load_prop)' on / and /chat (the regression that blocked BasedHardware#7386). Initialize lazily on first client-side use; no-op on the server. Public Mixpanel API unchanged - no consumer edits needed.
Part of #7327. Branched from fresh
main.Result (option 2 — non-breaking only)
npm audit: 17 → 5. 2 of 3 CRITICALs cleared non-breaking:form-data,protobufjs(+ flatted/minimatch/picomatch transitive). net diff vsmain:package-lock.jsononly (package.json unchanged).Deferred residual — the
nextCRITICAL (runtime-test finding)Initially this PR also bumped
next 15.0.3 → 15.5.18to clear thenextCRITICAL. Runtime testing caught a regression: with next 15.5.18,mixpanel-browser2.56.0 (version unchanged) throws an uncaught clientTypeError: Cannot read properties of undefined (reading 'load_prop')on/and/chat— reproducible, and absent on the next 15.0.3 baseline under identical env (npm build/npm auditdid not surface it; onlynext start+ a route walkthrough did).Per decision, the
nextbump was reverted (commitf94750edd). ThenextCRITICAL is a flagged, deferred residual — its only fix (next 15.5.18) introduces the mixpanel breakage, which needs a Next-15.5 + mixpanel-init code fix (out of scope for a deps PR). Tracked separately.Remaining 5 (1C
next+ 3H/1M) are all gated behind the same next-15.5/16 + eslint-config-next majors — consistent with the other web apps' deferred next-major decision.Validation
next build(next 15.0.3) → exit 0.next startroute walkthrough (/,/chat,/login,/u/[username]) → 0 page errors, 0 5xx — identical to the unmodified next 15.0.3 baseline (the mixpanel regression is gone with the next bump reverted).🤖 Generated with Claude Code