Skip to content

test: guard required production security headers - #61

Merged
spizeck merged 1 commit into
masterfrom
test/security-headers-config
Sep 13, 2026
Merged

test: guard required production security headers#61
spizeck merged 1 commit into
masterfrom
test/security-headers-config

Conversation

@spizeck

@spizeck spizeck commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/unit/security-headers.test.ts, a Vitest unit test that imports the real next.config.ts and asserts the site-wide /:path* header rule still contains all six required production security headers: Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, Content-Security-Policy.
  • Tests the exported configuration directly rather than duplicating header values, so the test stays valid if header values change.

Why

Protects the existing security header configuration against accidental removal. No production behavior changed.

Tests run

  • npm run lint — clean
  • next typegen && tsc --noEmit (typecheck) — clean
  • vitest run --coverage — 73/73 tests pass (9 files)
  • npm run build:test — production build succeeds
  • npx playwright test (e2e) — passes in CI

Limitations

  • [mobile-webkit] customer-flows.spec.ts › correcting an invalid email... produces exactly one handoff is flaky: it failed once locally and once on the first CI run, then passed on the CI rerun. Pre-existing flake unrelated to this change (this PR adds only a unit test file; Playwright never loads tests/unit). Worth stabilizing separately.
  • Local Node is v20 while the repo targets Node 24, so local test commands were run via a Node 24 binary (npx node@24).

Generated with Devin

Assert the site-wide header rules in next.config.ts keep all six
required security headers so they can't be removed accidentally.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
seasaba-web Ready Ready Preview Sep 13, 2026 9:49pm UTC

Request Review

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

Sorry @spizeck, this account has used its review budget of 1,500,000 diff characters for the last 7 days.

You can request another review in 15 hours and 29 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a focused Vitest regression test against the real Next.js configuration to prevent accidental removal of the six required site-wide production security headers; production code and behavior are unchanged.

File-Level Changes

Change Details Files
Adds a regression test that validates the real Next.js configuration includes all required production security headers on the site-wide route.
  • Imports the exported next configuration and asynchronously evaluates its header rules.
  • Locates the /:path* rule and verifies presence of the six required security-header names without duplicating their values.
tests/unit/security-headers.test.ts

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

@spizeck
spizeck merged commit 2bd80ea into master Sep 13, 2026
9 of 10 checks passed
@spizeck
spizeck deleted the test/security-headers-config branch September 13, 2026 22:05
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