Version bump and CHANGELOG entry: withSecurityConfig (hide X-Powered-By),
opt-in CSP through buildSecurityHeaders({ csp }) with report-only/enforce and
reports, createCspReportRoute, buildAdminCspHeaders, opt-in nonces, new buildCsp
flags with extra/override, ipal-audit header check; nothing required on upgrade.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-27 21:53:22 +01:00
co-authored by Claude Opus 5.5
parent 86ff9e3df0
commit cdf80744ea
2 changed files with 55 additions and 1 deletions
+54
View File
@@ -8,6 +8,60 @@ versions at once, go through every "Requires project changes" section in order,
version you have. A new release = a new section at the top; we remove the oldest ones only
once there are more than 20.
## 1.14.1
Response-header hardening from the intecion.com audit: hide `X-Powered-By`, and a Content-Security-Policy the project
can roll out safely (report-only first, with reports). Everything is opt-in; nothing changes until the project uses it.
### New
- **`withSecurityConfig(nextConfig, { hidePoweredBy })`** — hides `X-Powered-By` (Next's `Next.js` and the
`Next.js, Payload` that `withPayload` adds) by setting `poweredByHeader: false` and dropping the header from
`headers()` rules. Works on either side of `withPayload`. Opt out: `hidePoweredBy: false`.
- **`buildSecurityHeaders({ csp })`** — off by default (`csp: false`). Pass `buildCsp` args to add the policy:
`mode: 'report-only'` (`Content-Security-Policy-Report-Only`) or `'enforce'`; with `reportUri` the policy gets
`report-uri` / `report-to` and the `Reporting-Endpoints` header is added (`reportGroup`, default
`csp-endpoint`). A hand-written policy in `additional` still wins.
- **`createCspReportRoute()`** — a POST route for violation reports (both the legacy `application/csp-report` and the
Reporting API format), logged as one `[csp]` line each (`onReport` to send them elsewhere, `maxBytes`); `parseCspReports` for your own handler.
- **`buildAdminCspHeaders` / `buildAdminCsp`** — a policy for `/admin/:path*` that fits Payload's admin, with the same
`mode` / `reportUri` / `extra` / `override`.
- **Nonces (opt-in)** — `createProxy(config, { csp })` creates a per-request nonce, puts the policy on the request (Next
adds the nonce to its own scripts) and the response, and exposes it as the `x-nonce` request header;
`<SiteProviders nonce>` passes it to the theme script and the analytics tags (`ThemeScript`, `Analytics`,
`ConsentScript` take `nonce`). `strictDynamic` (default on with a nonce). Nonces need dynamic rendering, so they are
only for sites that render per request; static and ISR sites keep the header-only CSP. `createCspNonce`,
`CSP_NONCE_HEADER`.
- **`buildCsp` flags** — `metaPixel`, `linkedIn`, `tiktok`, `clarity` next to `analytics`, `turnstile`, `youtube`,
`googleMaps`, `r2Url`; `dev` (adds `'unsafe-eval'`, default `NODE_ENV === 'development'`); `extra` adds sources
to any directive; `override` replaces a directive (`null` drops it). `buildCspHeaders`, `buildReportingEndpoints`,
`cspHeaderKey`, types `CspDirective`, `CspSources`, `CspViolation`.
- **ipal-audit** — checks the response headers: `X-Powered-By` anywhere → ERROR; no CSP on the site or `/admin` →
WARNING; report-only for weeks with clean reports → WARNING (switch to enforce).
### Changed
- `buildCsp` allowlists are slightly wider (nothing that was allowed is now blocked): `analytics` also allows the
Google Signals hosts (`https://*.g.doubleclick.net`, `https://www.google.com`) in `connect-src` and `img-src`;
`r2Url` is also added to `media-src`; in development `'unsafe-eval'` is added (`dev: false` to turn it off).
The order of the directives in the header changed (cosmetic).
- `buildSecurityHeaders({})` output is unchanged.
### Documentation
- security.md rewritten: X-Powered-By, CSP roll-out (report-only → enforce), report route, admin policy, nonces vs
static pages. AGENT.md, ipal-setup, ipal-reference, ipal-audit, ipal-upgrade.
### What projects must update
Nothing is required. Recommended, in this order (ipal-upgrade → 1.14.1, security.md):
1. **Hide `X-Powered-By`:** `export default withPayload(withSecurityConfig(nextConfig))`; remove a hand-written
`poweredByHeader: false`. **Check:** `curl -sI <site>/pl | grep -i x-powered-by` → nothing (also `/admin`).
2. **CSP report-only:** `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', r2Url:
process.env.R2_PUBLIC_URL, …flags for what the site loads } })`, the admin rule
`{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode: 'report-only', reportUri: '/api/csp-report' }) }`
and `src/app/api/csp-report/route.ts` → `export const POST = createCspReportRoute()`. Deploy and read the `[csp]`
lines in the Coolify logs.
3. **Enforce:** after a few days of clean reports, `mode: 'enforce'` in both places; redeploy and check the pages.
4. Projects that already call `buildCsp({ analytics })` or pass `r2Url`: the policy gets the wider allowlists above
after upgrading — review them if the policy is audited line by line.
## 1.14.0
An image lightbox, a cookie scanner with a browser pre-consent check, an admin panel in English and Polish, and
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@intecion/ipal-kit",
"version": "1.14.0",
"version": "1.14.1",
"description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
"license": "MIT",
"repository": {