Skip to content

fix(security): upgrade next 14.2.30 -> 15.5.20, clearing 4 high-severity CVEs (Closes #596)#630

Open
SakethSumanBathini wants to merge 4 commits into
sreerevanth:mainfrom
SakethSumanBathini:fix/596-next-security-upgrade
Open

fix(security): upgrade next 14.2.30 -> 15.5.20, clearing 4 high-severity CVEs (Closes #596)#630
SakethSumanBathini wants to merge 4 commits into
sreerevanth:mainfrom
SakethSumanBathini:fix/596-next-security-upgrade

Conversation

@SakethSumanBathini

@SakethSumanBathini SakethSumanBathini commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Closes #596

My own issue's recommendation doesn't work

I said to patch within Next 14 rather than jump majors. I tested it. A 14.x bump fixes zero of the
advisories:

14.2.30 (current)   4 high + 1 moderate
14.2.35 (latest 14) 4 high + 1 moderate    ← identical

Next 14 is two majors behind and no longer receives these patches. Merging that would have closed a
security issue without fixing a single vulnerability, which is worse than leaving it open.

What the advisories actually are

Seven CVEs against next, not the one warning I described:

CVSS
Improper middleware redirect handling → SSRF 6.5
DoS with Server Components 7.5
DoS with Server Components — incomplete fix follow-up 7.5
HTTP request deserialization DoS (RSC) 7.5
DoS via Image Optimizer remotePatterns 5.9
Cache Key Confusion, Image Optimization API 6.2
Content Injection, Image Optimization 4.3

plus glob (command injection, 7.5) and postcss (XSS) transitively.

What this does

next 14.2.30 → 15.5.20, and eslint-config-next to match.

before : 5 vulnerabilities — 4 high, 1 moderate
after  : 2 vulnerabilities — 0 high, 2 moderate

All four HIGH cleared, including the SSRF. The two remaining are moderate: a next moderate and a
postcss XSS reached through next, which clears when next bumps its own dependency.

Why 15 and not 16

npm's fixAvailable points at next@16.2.10. I measured both — they're identical: 16 also leaves
0 high + 2 moderate. So 16 buys nothing on security, costs a second major, and would collapse the
deliberate two-Next-major separation documented in #602.

React is unchanged at 18.3.1. next@15 declares peerDependencies.react: ^18.2.0 || ^19.0.0, so
this does not drag in a React 19 migration.

Why the upgrade is low-risk here

Next 15's headline breaking changes — async params/searchParams, RSC caching defaults — target the
App Router. The dashboard is Pages Router only:

  • app/ directory: none
  • getServerSideProps / getStaticProps: 0 usages
  • next/font: 0 usages
  • next.config.js: reactStrictMode, output, transpilePackages — all still valid

One thing I deliberately left out of scope

next lint is removed in Next 15. The lint script now launches an interactive codemod.

I tried to fix it by adding an .eslintrc.json — and that broke the build, because next build then
started running ESLint and surfaced 7 pre-existing errors in pages/replay.tsx (unescaped ' and
"). The build has never linted, because no ESLint config is committed for it to find.

So the ESLint migration needs its own PR: a config file plus fixing those 7 errors. Dragging it in here
would mean a security fix stuck behind unrelated lint churn. CI doesn't run lint (npm ci
type-checkbuild), so nothing is red today. Happy to file it as a follow-up issue.

Verified — the actual CI gates, run on Linux

npm ci        PASS    (the lockfile is Linux-generated — see below)
npm run type-check  PASS
npm run build       PASS

The lockfile was regenerated on Linux, not Windows. Windows npm install omits optional platform
peers that Linux CI requires, and npm ci then hard-fails. Please don't run npm install on this
branch on Windows before merging.

next-env.d.ts is included because Next regenerates it on build and it's tracked.

Summary by CodeRabbit

  • Bug Fixes

    • Upgraded Next.js to 15.5.20 to address known security vulnerabilities and clear all high-severity advisories.
    • Updated the associated Next.js ESLint preset to match the upgrade.
  • Documentation

    • Added/updated migration notes detailing the upgrade, verification results, and Pages Router behavior, including any remaining moderate advisories and expected follow-up lint work.
    • Updated Next.js type reference guidance used by the build/type-check flow.

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

@SakethSumanBathini is attempting to deploy a commit to the sreerevanth's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 17b00da5-2265-47c2-accf-5eb0def9889a

📥 Commits

Reviewing files that changed from the base of the PR and between b9c8328 and 119e591.

📒 Files selected for processing (1)
  • frontend/NEXT_15_MIGRATION.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/NEXT_15_MIGRATION.md

📝 Walkthrough

Walkthrough

The frontend upgrades Next.js and eslint-config-next to 15.5.20, adds a generated routes type reference, and documents compatibility, verification, deferred lint work, and security advisory results.

Changes

Next.js 15 frontend migration

Layer / File(s) Summary
Next.js runtime and TypeScript integration
frontend/package.json, frontend/next-env.d.ts
Upgrades Next.js packages to 15.5.20 and adds the generated routes type reference.
Migration validation and security record
frontend/NEXT_15_MIGRATION.md
Documents Pages Router compatibility, passing type-check/build and route checks, deferred lint changes, and advisory results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit hops through versions bright,
From fourteen’s shade to fifteen’s light.
Types bloom softly, routes align,
Checks pass beneath the carrot sign.
High bugs burrow out of sight!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The linked issue asked for a patch within Next 14, but the PR upgrades to Next 15.5.20 instead. Rebase the fix onto the latest 14.x release and keep the dashboard on Next 14 unless a separate major-upgrade issue is approved.
Out of Scope Changes check ⚠️ Warning The PR introduces a major Next 15 migration and migration notes, which goes beyond the requested within-14 security patch. Limit this PR to the Next 14 patch upgrade only; move the Next 15 migration and related docs to a separate PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: upgrading Next.js from 14.2.30 to 15.5.20 for a security fix.
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

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.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🧪 PR Test Results

Check Result
Tests (pytest tests/) ✅ success
Lint (ruff check .) ✅ success
Coverage (agentwatch) 74.01%

Python 3.12 · commit 119e591

@sreerevanth sreerevanth 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.

This PR upgrades a major framework version (next 14 → 15). While the security motivation is valid, the diff only updates dependencies and the lockfile without demonstrating compatibility beyond successful builds.

Please:

Verify key frontend workflows (dashboard, replay, authentication, API interactions) against Next 15.
Add a short migration note documenting any required follow-up work (such as the ESLint migration mentioned in the PR description).
Confirm there are no runtime regressions introduced by the framework upgrade.

After functional validation is completed, this can be reconsidered for merge.

@SakethSumanBathini

Copy link
Copy Markdown
Contributor Author

Thanks for the review — all three points addressed. I've added frontend/NEXT_15_MIGRATION.md with the
detail; summary here.

Key frontend workflows verified against Next 15. I ran the production server (next start) on the
upgraded build and exercised the routes. Every one returns HTTP 200 and renders real content — no server
errors:

Route Result
/ (dashboard) 200
/replay 200
/costs 200
/security 200
/policies 200
/sessions/[id] (dynamic route) 200
/api/health (API route) 200

Server ready in ~0.4s. The pages/api/v1/[...path].ts proxy — the app's data path to the backend — uses
the standard NextApiRequest/NextApiResponse signature, which is unchanged in 15.

No runtime regressions. npm run type-check (tsc --noEmit) passes, npm run build compiles all 16
pages and prerenders them as static content, and the runtime checks above show no 500s. The reason the
upgrade is low-risk here is that Next 15's breaking changes target the App Router, and this frontend is
Pages Router only:

  • app/ directory: none
  • getServerSideProps / getStaticProps: 0 usages
  • next/font: 0 usages
  • next.config.js (reactStrictMode, output: 'standalone', transpilePackages): all still valid in 15

Migration note added, documenting the above plus the one follow-up: next lint is removed in Next
15, and wiring up an ESLint config surfaces 7 pre-existing react/no-unescaped-entities errors in
pages/replay.tsx that predate this PR (the build has never linted, since no config was committed). That
belongs in its own PR so a CVE fix isn't blocked behind unrelated lint churn — I'm happy to file it as a
follow-up issue and take it next.

On the checks: the failing one is Vercel (deploy authorization — needs a maintainer to approve, nothing
in the diff). The ruff lint check that shows red is Python-only and fails on a clean main too — this
PR touches only frontend/ files, so it's unrelated; the official AgentWatch CI / Python Lint & Type Check gate passes. Security payoff is unchanged: 4 high + 1 moderate → 0 high + 2 moderate, all four
HIGH advisories including the SSRF cleared.

@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/NEXT_15_MIGRATION.md`:
- Around line 52-55: Update the Next.js 15 migration note to state that next
lint is deprecated and still available, rather than removed. Preserve the
explanation about the lint script, .eslintrc.json, and pre-existing
pages/replay.tsx errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb729649-5fad-4af4-95e3-fa4893c06991

📥 Commits

Reviewing files that changed from the base of the PR and between d2980f6 and b9c8328.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • frontend/NEXT_15_MIGRATION.md
  • frontend/next-env.d.ts
  • frontend/package.json

Comment thread frontend/NEXT_15_MIGRATION.md Outdated
@SakethSumanBathini

Copy link
Copy Markdown
Contributor Author

Quick note on the two red checks, neither of which is from this PR (it only changes frontend/ + a
markdown note — zero Python files):

  • Python Tests / Run Python tests (3.11) — this looks like a stale required check. pyproject.toml
    has requires-python = ">=3.12,<3.13", so pip install -e . refuses to install on 3.11 and the job
    fails at the install step. 3.11 isn't in any workflow in .github/workflows/ (they all pin 3.12), so
    I think this is a branch-protection required-check pointing at a matrix entry that no longer exists —
    it's red on main too, not just here. Might be worth removing it from required checks or realigning the
    matrix. Happy to open a separate issue/PR for it if useful.

The official AgentWatch CI / * gates (Python Lint & Type Check, tests on 3.12) all pass.

@SHAURYASANYAL3 SHAURYASANYAL3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi! We'd love to get this merged, but it's currently blocked. Please address the following so we can proceed:

  • Review Feedback: Previous review feedback needs addressing.

Let us know once you've updated the PR!

@SHAURYASANYAL3

Copy link
Copy Markdown
Collaborator

Hi! We'd love to get this merged, but it's currently blocked. Please address the following so we can proceed:

  • Review Feedback: Previous review feedback needs addressing.

Let us know once you've updated the PR!

@SHAURYASANYAL3

Copy link
Copy Markdown
Collaborator

Action Required (Update)

🔹 Review Feedback: Please address previous review comments.

🔹 CI Failures (fail, fail, fail) - Please check Actions tab.

@SHAURYASANYAL3

Copy link
Copy Markdown
Collaborator

Hey! Just following up on the requested changes. Please ensure they are addressed within the next 48 hours. If there's no update by then, we'll go ahead and close this PR to keep the queue manageable.

@ecc-tools

ecc-tools Bot commented Jul 24, 2026

Copy link
Copy Markdown

Analyzing 200 commits...

@ecc-tools

ecc-tools Bot commented Jul 24, 2026

Copy link
Copy Markdown

Analysis Complete

Generated ECC bundle from 4 commits | Confidence: 55%

View Pull Request #667

Repository Profile
Attribute Value
Language Python
Framework Not detected
Commit Convention conventional
Test Directory separate
Changed Files (4)
Metric Value
Files changed 4
Additions 695
Deletions 492

Top hotspots

Path Status +/-
frontend/package-lock.json modified +616 / -489
frontend/NEXT_15_MIGRATION.md added +75 / -0
frontend/package.json modified +2 / -2
frontend/next-env.d.ts modified +2 / -1

Top directories

Directory Files Total changes
frontend 4 1187
Analysis Depth Readiness (evidence-backed, 36%)

ECC Tools uses this to decide whether recommendations should stay at commit-history/setup guidance or expand into CI, security, harness, reference-set, AI-routing, and team backlog work.

Area Status Evidence / Next Step
Commit history Partial 4 commits sampled
CI/CD signals Ready .github/workflows/bandit.yml
Security evidence Ready SECURITY-BASELINE.md
Harness configuration Missing Add Claude, Codex, OpenCode, Zed, dmux, MCP, plugin, or cross-harness config evidence for harness-agnostic recommendations.
Reference/eval evidence Missing Add fixtures, golden traces, reference sets, or evaluator benchmarks so deeper recommendations have regression evidence.
AI routing and cost controls Missing Add model-routing, budget, usage, or cost-control files before relying on AI-heavy automation recommendations.
Team handoff and project tracking Missing Add roadmap, runbook, project, Linear, or follow-up tracking docs so generated work can land in a team queue.
Reference Set Readiness (1/7, 14%)
Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Present SECURITY-BASELINE.md
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.
Likely Future Issues (1)
Severity Signal Why it may show up
MEDIUM User-facing UI changes may ship without browser coverage 4 user-facing UI paths changed; 0 browser or e2e coverage files changed
  • User-facing UI changes may ship without browser coverage: The PR changes components, pages, or other user-facing UI files without touching any obvious browser or end-to-end coverage.
Suggested Follow-up Work (1)
Type Suggested title Targets
PR test: add browser coverage for frontend/NEXT_15_MIGRATION.md + frontend/next-env.d.ts frontend/NEXT_15_MIGRATION.md, frontend/next-env.d.ts
  • test: add browser coverage for frontend/NEXT_15_MIGRATION.md + frontend/next-env.d.ts: Backfill browser coverage before another user-facing UI change lands on the touched surface.

Copy-ready bodies

test: add browser coverage for frontend/NEXT_15_MIGRATION.md + frontend/next-env.d.ts

## Summary
- Add browser or end-to-end coverage for the recently changed user-facing surface.

## Why
- Backfill browser coverage before another user-facing UI change lands on the touched surface.

## Touched paths
- `frontend/NEXT_15_MIGRATION.md`
- `frontend/next-env.d.ts`

## Validation
- Add or extend browser / e2e coverage for the changed component, page, or flow.
- Exercise the visible user journey that depends on the touched UI surface.
Review Activity (5 reviews, 3 inline comments, 0 unresolved threads)
Signal Count
Approvals 0
Change requests 2
Comment-only reviews 2
Dismissed reviews 0
Pending reviews 0
Review threads 1
Unresolved threads 0
Outdated threads 1
Latest review Changes requested
Latest submitted at 2026-07-23T07:46:26Z

Latest reviewer states

Reviewer State Submitted
@SHAURYASANYAL3 Changes requested 2026-07-23T07:46:26Z
@sreerevanth Changes requested 2026-07-16T17:34:40Z
@coderabbitai[bot] Commented 2026-07-16T18:09:18Z
@SakethSumanBathini Commented 2026-07-16T18:08:59Z
Review Follow-up Signals (3)
Severity Signal Evidence
HIGH Resolve requested changes before merge 2 change-request review(s) are still represented in the latest reviewer states
MEDIUM Re-check outdated review discussions 1 outdated review thread(s) may refer to older code
MEDIUM Get an explicit approval No approving review is recorded for this PR

Recommended next actions

  • Confirm each reviewer concern is addressed, then request or wait for a fresh review state.
  • Confirm the latest pushed code resolves stale review feedback before relying on old comments.
  • Ask for an approval after requested changes and unresolved discussions are addressed.
Detected Workflows (1)
Workflow Description
documentation-update-single-file Update or add documentation in a single markdown file, often to address reviews or clarify migration/feature details.
Generated Instincts (19)
Domain Count
git 4
code-style 9
testing 4
workflow 2

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/AgentWatch-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/AgentWatch/SKILL.md
  • .agents/skills/AgentWatch/SKILL.md
  • .agents/skills/AgentWatch/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/AgentWatch-instincts.yaml
  • .claude/commands/documentation-update-single-file.md

ECC Tools | Everything Claude Code

@SakethSumanBathini

Copy link
Copy Markdown
Contributor Author

CI is green. All 13 checks pass — including AgentWatch CI / Python Tests and PR Tests / Test & lint,
the two that were red. The bot report on 119e591 shows pytest tests/ ✅ and ruff check . ✅.

What was actually wrong. Both failing jobs run Python, and this PR changes only frontend/ plus a
markdown note. The cause was that this branch predated a fix on main: #567 (cfb113c, GDPR erasure)
broke the Python tests and ruff formatting, and #641 (6c42c06, "fix(ci): restore SqlAlchemyAuditStore +
ruff format + gdpr.py encoding") fixed them. I've merged main in, which picks up that fix, and both
jobs now pass.

Correcting myself on one point: I said earlier the ruff failure was red on main too. That was true when
I wrote it, but #641 has since fixed main, so the accurate statement is that this branch was carrying
the older broken state. Merging resolved it.

The one remaining red mark is Vercel's "authorization required to deploy", which needs a maintainer to
approve a fork PR and isn't something the diff can change.

@sreerevanth your three points were addressed in b9c8328, before either of the follow-ups above, in
frontend/NEXT_15_MIGRATION.md:

  1. Frontend workflows verified — ran next start on the upgraded build and exercised the routes:
    /, /replay, /costs, /security, /policies, /sessions/[id] and /api/health all return 200
    with real content.
  2. Migration note added — covering that verification, why the upgrade is low-risk here (Pages Router
    only: no app/, zero getServerSideProps/getStaticProps, zero next/font), and the single
    follow-up: next lint is deprecated in 15.5, and wiring up an ESLint config surfaces 7 pre-existing
    react/no-unescaped-entities errors in pages/replay.tsx that predate this PR. That needs its own
    PR so a CVE fix isn't gated behind unrelated lint churn — happy to file it and take it next.
  3. No runtime regressionstype-check passes, build compiles and prerenders all 16 pages, and
    the route checks above show no 500s.

@SHAURYASANYAL3 the CI failures your last comment cited are resolved.

Both change-request reviews now predate the work that addressed them, so they're blocking on their own
age rather than on anything outstanding — could one of you re-review? The upgrade clears 4 HIGH
advisories including an SSRF
(4 high + 1 moderate → 0 high + 2 moderate), so closing it would leave
those open on main.

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.

[SECURITY] frontend pins next@14.2.30, which npm flags with an advisory

3 participants