Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

chore(security): upgrade next 16.2.0→16.2.11, fix ws DoS vulnerability - #94

Draft
caimanoliveira wants to merge 10 commits into
mainfrom
claude/kind-keller-yvbcz0
Draft

chore(security): upgrade next 16.2.0→16.2.11, fix ws DoS vulnerability#94
caimanoliveira wants to merge 10 commits into
mainfrom
claude/kind-keller-yvbcz0

Conversation

@caimanoliveira

Copy link
Copy Markdown
Owner

Summary

  • Upgrades next from 16.2.0 to 16.2.11 (latest patch), addressing numerous CVEs: DoS via Server Components/Cache/Image API/Server Actions, XSS, cache poisoning, middleware/proxy bypass, and SSRF.
  • Applies npm audit fix to resolve two ws vulnerabilities (uninitialized memory disclosure GHSA-58qx-3vcg-4xpx, memory exhaustion DoS GHSA-96hv-2xvq-fx4p).
  • Build confirmed green on Next.js 16.2.11 — 22 routes, zero TypeScript errors.

Known remaining vulnerabilities

Three high-severity alerts for postcss and sharp remain. Both are transitive dependencies locked inside next itself — npm's only proposed fix is a destructive downgrade to v9.3.3, which would be a complete breaking change. These are upstream issues that require a fix from the Next.js team.

Test plan

  • npm run build passes with zero errors on Next.js 16.2.11
  • TypeScript check passes
  • All 22 routes generated correctly (static + dynamic)
  • Smoke-test key portal routes in staging before merging

Generated by Claude Code

Upgrades Next.js to the latest 16.2.x patch to address known CVEs
(DoS, XSS, cache poisoning, middleware bypass, SSRF). Also applies
npm audit fix for the ws memory-disclosure/DoS vulnerability
(GHSA-58qx-3vcg-4xpx, GHSA-96hv-2xvq-fx4p).

Remaining 3 high-severity alerts (postcss + sharp) are transitive
deps locked inside next itself; npm's only proposed fix is a breaking
downgrade to v9 — intentionally skipped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mentoria-crm Ready Ready Preview, Comment Jul 24, 2026 8:31am
splinter Ready Ready Preview, Comment Jul 24, 2026 8:31am
splinter-yhcm Ready Ready Preview, Comment Jul 24, 2026 8:31am

…m next

- Fix pre-commit CI: actions/setup-python@v1 + Python 3.9 no longer
  available on GitHub runners (dropped; only 3.10+ exists). Bumps to
  actions/checkout@v4, actions/setup-python@v5, python-version 3.12.
- Upgrade mentoria-crm next 16.2.0→16.2.11 and eslint-config-next to
  match, same security CVEs as the root package fixed in the prior commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
The pre-commit workflow now runs on Python 3.12, but the black hook
still specified language_version: python3.9, causing pre-commit to
fail when it couldn't find a python3.9 interpreter on the runner.

Also untracks node_modules/.package-lock.json which was accidentally
committed when node_modules/ was nearly empty.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
…ild time

createClient crashes when NEXT_PUBLIC_SUPABASE_URL is undefined, which
happens in Vercel PR preview builds where the env var is only configured
for the Production environment. Fall back to placeholder values so the
build completes; actual API calls will fail gracefully at runtime if the
real credentials aren't injected.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
…failure

Next.js detected both the repo-root package-lock.json and mentoria-crm's
own lockfile and selected the repo root as workspace root. On Vercel only
the mentoria-crm subdirectory gets node_modules installed, so prerendering
failed when Next.js tried to resolve modules from the non-existent root
node_modules. Setting turbopack.root to __dirname tells Next.js to use
mentoria-crm as the workspace root.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
Next.js 16 dropped Node.js 18 support (requires >=20.9.0 LTS).
Vercel was likely defaulting to Node.js 18, causing the build to
fail immediately. Adding .nvmrc and engines field so Vercel picks
Node.js 20.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
…at root

__dirname is undefined in ESM module context (tsconfig has "module":"esnext"),
causing path.resolve(__dirname) to throw when Next.js 16 loads next.config.ts.
Switch to process.cwd() which is always available.

Also add .nvmrc at repo root so Vercel picks up Node.js 20 regardless of
which directory it uses for version file lookup in monorepo builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
turbopack.root was speculatively added to work around workspace root
detection. The original crash (supabaseUrl is required during prerender)
is already fixed by the placeholder fallback in supabase.ts.
On Vercel, Turbopack correctly detects mentoria-crm/ as the workspace
root from the lockfile, so the explicit root setting is not needed and
was causing the build to fail at ~2 minutes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
process.cwd() may return the repo root on Vercel's build pipeline
instead of the mentoria-crm/ subdirectory, causing Turbopack to use
the wrong workspace root and fail to resolve node_modules.

import.meta.url always points to next.config.ts itself, so
fileURLToPath(new URL('.', import.meta.url)) gives the correct
absolute path for mentoria-crm/ regardless of Vercel's cwd behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
…e root issue

Turbopack's workspace root detection fails on Vercel because it finds the
repo-root package-lock.json and resolves modules against the wrong directory.
Adding a vercel-build script that passes --webpack bypasses this entirely;
webpack uses standard Node.js resolution starting from the nearest node_modules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zn3JV76NWHmfgFRJEzprt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants