security: harden gateway proxy, custom runtime proxy, and media routes (#95)

* security hardening pass 1 - otel removed

* hardening pass #2

* feat security hardening pass

* chore: trim unrelated docs from security hardening pr

* fix: address security hardening review findings

* address findings
This commit is contained in:
gsknnft
2026-04-03 18:02:06 -04:00
committed by GitHub
parent 083c146aac
commit 051d0ce469
14 changed files with 572 additions and 30 deletions
+58 -1
View File
@@ -1,5 +1,62 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {};
const securityHeaders = [
{
key: "Content-Security-Policy",
value: [
"default-src 'self'",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'self'",
"img-src 'self' data: blob: http: https:",
"font-src 'self' data: https:",
"style-src 'self' 'unsafe-inline' https:",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:",
"connect-src 'self' ws: wss: http: https:",
"media-src 'self' blob: data: http: https:",
"worker-src 'self' blob:",
"object-src 'none'",
"upgrade-insecure-requests",
].join("; "),
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(self), geolocation=(), browsing-topics=()",
},
{
key: "Cross-Origin-Resource-Policy",
value: "same-origin",
},
];
if (process.env.NODE_ENV === "production") {
securityHeaders.push({
key: "Strict-Transport-Security",
value: "max-age=31536000; includeSubDomains",
});
}
const nextConfig: NextConfig = {
async headers() {
return [
{
source: "/:path*",
headers: securityHeaders,
},
];
},
};
export default nextConfig;