Skip to content

fix: make next-sitemap a dev dependency - #208

Merged
uniqueg merged 3 commits into
devfrom
fix/audit-next-sitemap-dev
Nov 20, 2026
Merged

uniqueg merged 3 commits into
devfrom
fix/audit-next-sitemap-dev

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

The Audit job (npm audit --omit=dev --audit-level=high) fails on every PR on GHSA-fc5q-39xc-vjpf (high, ReDoS in picomatch, no patched version). The only production path to it was next-sitemap@4.2.3 -> fast-glob -> micromatch -> picomatch@2.3.2. next-sitemap only runs as the postbuild CLI and doesn't reach the site, so this PR moves it to devDependencies, as the other build-only tools (tailwindcss, postcss, autoprefixer) already are.

  • package.json, package-lock.json: next-sitemap moved to devDependencies. The lockfile was regenerated with npm 12.2.3 (the npm that ships with Node 26, as in CI), so the diff only marks the packages that are now dev-only.
  • src/test/dependencies.test.ts: checks that next-sitemap stays a dev dependency.
  • README.md: the Audit section says that build-only tools belong in devDependencies.

Vercel and the Dockerfile (npm ci in the deps stage) install devDependencies for the build, so the sitemap and robots.txt are still generated. The runner image copies only the standalone output, which never contained next-sitemap.

GitHub withdrew the advisory on 2026-11-18 at 15:38 UTC, but npm still reported it about an hour later. Once npm syncs, the advisory goes away on its own. This change also keeps the next advisory in this glob chain from blocking every PR.

Light lane: this only moves a dependency between dependencies and devDependencies and adds a test and a docs line; there's no logic. I reviewed the diff myself.

Verification

  • Test first: npx vitest run src/test/dependencies.test.ts failed before the move and passes after it.
  • npm audit --omit=dev --audit-level=high: found 0 vulnerabilities (before: 4 high, exit 1).
  • npm ls picomatch --omit=dev: empty.
  • npx prettier --check "src/**/*.{ts,tsx,json,css}", npx tsc --noEmit, npm run lint: pass.
  • npm run test:coverage: 10 files, 89 tests passed.
  • npm run build: passes; next-sitemap writes robots.txt, sitemap.xml and sitemap-0.xml.
  • CI (runs 44356975115, 44356940942): all checks pass, Audit and CI passed included.

Declined review findings

None (light lane).

Open questions

None.

Closes #207

🤖 Generated with Claude Code

Summary by Sourcery

Move next-sitemap to development dependencies so production audits exclude its build-only dependency chain while sitemap generation remains available during builds.

Bug Fixes:

  • Prevent production-only dependency audits from failing because of vulnerabilities in the build-only sitemap toolchain.

Enhancements:

  • Classify next-sitemap as a development dependency and add a regression test enforcing its placement.

Documentation:

  • Clarify that build-only tools belong in devDependencies and are excluded from production dependency audits.

Tests:

  • Add coverage verifying build-only dependencies are not listed as production dependencies.

next-sitemap only runs as the postbuild CLI and doesn't reach the
site, but as a production dependency it pulled fast-glob, micromatch
and picomatch into `npm audit --omit=dev`. GHSA-fc5q-39xc-vjpf
(picomatch, no patched version) thus failed the Audit job on every PR.

Move it to devDependencies, add a test that keeps it there, and say
so in the README's Audit section. Vercel and the Dockerfile install
devDependencies for the build, so the sitemap is still generated.

Closes #207

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
landing-page Ready Ready Preview Nov 20, 2026 5:41pm UTC

@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Move next-sitemap to development dependencies so production-only audits exclude its build-only dependency chain, and update the lockfile to record the move.

  • package-lock.json L23-8965 (24 small edits)
  • package.json L34 (removed lines), L65

Documentation

Explain in the Audit section that build-only tools such as next-sitemap belong in devDependencies.

  • README.md L126-128

Tests

Add a test ensuring next-sitemap remains in devDependencies and absent from production dependencies.

  • src/test/dependencies.test.ts L1-24

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.86%. Comparing base (ec140f7) to head (f01bc48).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #208   +/-   ##
=======================================
  Coverage   49.86%   49.86%           
=======================================
  Files          44       44           
  Lines        1105     1105           
  Branches      292      292           
=======================================
  Hits          551      551           
  Misses        479      479           
  Partials       75       75           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@uniqueg
uniqueg marked this pull request as ready for review November 18, 2026 17:30
@uniqueg
uniqueg requested a review from keshxvdayal as a code owner November 18, 2026 17:30
@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit f01bc48

#207 fix: keep next-sitemap out of production audit · 4 of 4 met

# Requirement Status Notes
1 Move next-sitemap from dependencies to devDependencies. ✅ Met The package manifest and lockfile place next-sitemap in devDependencies.
2 Make npm audit --omit=dev --audit-level=high pass and npm ls picomatch --omit=dev empty. ✅ Met The PR description reports both checks passing; the lockfile marks the next-sitemap dependency chain as development-only.
3 Keep the build generating sitemap.xml, sitemap-0.xml, and robots.txt, including in the Docker image build. ✅ Met The build runs next-sitemap as its postbuild script; the Docker build installs devDependencies and runs that build, then copies public into the runtime image. The PR description reports the generated files from the build.
4 Explain in the README where next-sitemap belongs and why, if the README covers the audit policy. ✅ Met The Audit section says build-only tools such as next-sitemap belong in devDependencies because they do not reach the site.

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Nov 18, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Fixed security issues:

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg uniqueg mentioned this pull request Nov 18, 2026
@sourcery-ai
sourcery-ai Bot dismissed their stale review November 20, 2026 17:42

Sourcery withdrew this approval because the latest commits introduced blocking findings.

@uniqueg
uniqueg merged commit f4cf5d0 into dev Nov 20, 2026
25 checks passed
@uniqueg
uniqueg deleted the fix/audit-next-sitemap-dev branch November 20, 2026 17:43

This branch was successfully deployed

1 active deployment
Preview – landing-page — f01bc488 Deployed Nov 20, 2026 by vercel[bot]
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.

fix: keep next-sitemap out of production audit

1 participant