Security hardening from 2026-07-01 audit
- Exclude supabase/ from Docker build context (leaked service_role key file) - /api/files: exact per-user namespace match + reject path traversal; storage resolveKey rejects ".."/"." segments (fixes cross-user file read) - Add ownsProperty/Unit/Tenant checks to tenants, maintenance (landlord path), and documents (JSON branch, now field-whitelisted) create handlers - Escape user data in follow-up + payment-link emails (reuse escapeHtml) - Neutralize CSV formula injection in toCsv + export routes - Tighter sign-in rate limit (10/min); env-gated email verification + sender - Per-request nonce CSP; drop script-src 'unsafe-inline' (styles unchanged) - Add input length bounds; validate follow-ups POST body Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
857b9a7811
commit
969d5d4c8a
+4
-18
@@ -1,22 +1,9 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
// Pragmatic baseline Content-Security-Policy for a Next.js app.
|
||||
// NOTE: Next 16 commonly needs 'unsafe-inline' for styles/scripts when no
|
||||
// nonce pipeline is configured. Tightening this to per-request nonces
|
||||
// (removing 'unsafe-inline') is a recommended follow-up.
|
||||
const contentSecurityPolicy = [
|
||||
"default-src 'self'",
|
||||
"img-src 'self' data: blob: https:",
|
||||
"style-src 'self' 'unsafe-inline'",
|
||||
"script-src 'self' 'unsafe-inline'",
|
||||
"font-src 'self' data:",
|
||||
"connect-src 'self' https://api.stripe.com https://api.openai.com https://api.resend.com",
|
||||
"frame-src https://js.stripe.com https://hooks.stripe.com",
|
||||
"frame-ancestors 'none'",
|
||||
"base-uri 'self'",
|
||||
"form-action 'self'",
|
||||
].join("; ");
|
||||
|
||||
// NOTE: The Content-Security-Policy is set per-request in `proxy.ts` (Next
|
||||
// middleware) so `script-src` can carry a per-request nonce instead of
|
||||
// 'unsafe-inline'. A static header here cannot carry a per-request nonce and
|
||||
// would conflict with the middleware, so it is intentionally omitted below.
|
||||
const nextConfig: NextConfig = {
|
||||
// Emit a self-contained server bundle at .next/standalone so the Docker
|
||||
// image (used by Coolify) ships only the files needed to run `node server.js`.
|
||||
@@ -38,7 +25,6 @@ const nextConfig: NextConfig = {
|
||||
value: "max-age=63072000; includeSubDomains; preload",
|
||||
},
|
||||
{ key: "X-DNS-Prefetch-Control", value: "off" },
|
||||
{ key: "Content-Security-Policy", value: contentSecurityPolicy },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user