2026-01-06 12:35:01 +01:00
|
|
|
import type { NextConfig } from 'next'
|
|
|
|
|
|
feat: Audit remediation + Stripe webhook + test suites
- Apply 3 Prisma schema changes (Pending2FASession, hubApiKeyHash, SecurityVerificationCode attempts)
- Add Stripe webhook handler (checkout.session.completed -> User + Subscription + Order)
- Add stripe-service, api-key-service, rate-limit middleware
- Add security headers (CSP, HSTS, X-Frame-Options) in next.config.ts
- Harden auth routes, require ADMIN_API_KEY for orchestrator endpoints
- Add Docker auto-migration via startup.sh
- Add 7 unit test suites (api-key, dns, config-generator, automation-worker, permission, security-verification, auth-helpers)
- Fix Prisma 7 compatibility with adapter-pg mock for vitest
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:02:33 +01:00
|
|
|
const securityHeaders = [
|
|
|
|
|
{
|
|
|
|
|
key: 'X-DNS-Prefetch-Control',
|
|
|
|
|
value: 'on',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'Strict-Transport-Security',
|
|
|
|
|
value: 'max-age=63072000; includeSubDomains; preload',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'X-Content-Type-Options',
|
|
|
|
|
value: 'nosniff',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'X-Frame-Options',
|
|
|
|
|
value: 'SAMEORIGIN',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'X-XSS-Protection',
|
|
|
|
|
value: '1; mode=block',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'Referrer-Policy',
|
|
|
|
|
value: 'strict-origin-when-cross-origin',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'Permissions-Policy',
|
|
|
|
|
value: 'camera=(), microphone=(), geolocation=()',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'Content-Security-Policy',
|
|
|
|
|
value: [
|
|
|
|
|
"default-src 'self'",
|
|
|
|
|
"script-src 'self' 'unsafe-inline' 'unsafe-eval'",
|
|
|
|
|
"style-src 'self' 'unsafe-inline'",
|
|
|
|
|
"img-src 'self' data: blob: https://*.letsbe.solutions",
|
|
|
|
|
"font-src 'self' data:",
|
|
|
|
|
"connect-src 'self' https://*.letsbe.solutions",
|
|
|
|
|
"frame-ancestors 'self'",
|
|
|
|
|
"base-uri 'self'",
|
|
|
|
|
"form-action 'self'",
|
|
|
|
|
].join('; '),
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
2026-01-06 12:35:01 +01:00
|
|
|
const nextConfig: NextConfig = {
|
|
|
|
|
output: 'standalone',
|
2026-01-17 12:33:11 +01:00
|
|
|
// reactCompiler: true, // Requires babel-plugin-react-compiler - enable later
|
2026-01-06 12:35:01 +01:00
|
|
|
experimental: {
|
|
|
|
|
serverActions: {
|
|
|
|
|
bodySizeLimit: '2mb',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
images: {
|
|
|
|
|
remotePatterns: [
|
|
|
|
|
{
|
|
|
|
|
protocol: 'https',
|
|
|
|
|
hostname: '*.letsbe.solutions',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-01-17 12:33:11 +01:00
|
|
|
// Turbopack config (Next.js 16 default bundler)
|
|
|
|
|
turbopack: {},
|
|
|
|
|
// Handle native modules like ssh2 (for webpack fallback)
|
|
|
|
|
webpack: (config, { isServer }) => {
|
|
|
|
|
if (isServer) {
|
|
|
|
|
// Externalize ssh2 and its native dependencies
|
|
|
|
|
config.externals = config.externals || []
|
|
|
|
|
config.externals.push({
|
|
|
|
|
'ssh2': 'commonjs ssh2',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return config
|
|
|
|
|
},
|
|
|
|
|
// Externalize ssh2 for both Turbopack and Webpack
|
|
|
|
|
serverExternalPackages: ['ssh2'],
|
feat: Audit remediation + Stripe webhook + test suites
- Apply 3 Prisma schema changes (Pending2FASession, hubApiKeyHash, SecurityVerificationCode attempts)
- Add Stripe webhook handler (checkout.session.completed -> User + Subscription + Order)
- Add stripe-service, api-key-service, rate-limit middleware
- Add security headers (CSP, HSTS, X-Frame-Options) in next.config.ts
- Harden auth routes, require ADMIN_API_KEY for orchestrator endpoints
- Add Docker auto-migration via startup.sh
- Add 7 unit test suites (api-key, dns, config-generator, automation-worker, permission, security-verification, auth-helpers)
- Fix Prisma 7 compatibility with adapter-pg mock for vitest
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:02:33 +01:00
|
|
|
async headers() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
source: '/(.*)',
|
|
|
|
|
headers: securityHeaders,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
},
|
2026-01-06 12:35:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default nextConfig
|