security: add CSP (prod) and Permissions-Policy headers
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,13 @@ export async function securityHeaders(
|
|||||||
reply.header('X-Content-Type-Options', 'nosniff');
|
reply.header('X-Content-Type-Options', 'nosniff');
|
||||||
reply.header('X-Frame-Options', 'DENY');
|
reply.header('X-Frame-Options', 'DENY');
|
||||||
reply.header('Referrer-Policy', 'strict-origin-when-cross-origin');
|
reply.header('Referrer-Policy', 'strict-origin-when-cross-origin');
|
||||||
|
reply.header('Permissions-Policy', 'camera=(), microphone=(), geolocation=()');
|
||||||
|
|
||||||
if (config.isProduction) {
|
if (config.isProduction) {
|
||||||
reply.header('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
|
reply.header('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
|
||||||
|
reply.header(
|
||||||
|
'Content-Security-Policy',
|
||||||
|
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user