Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): add baseline security response headers (#13370)

Nicholas Tindled1554eee221c
diff --git a/autogpt_platform/frontend/next.config.mjs b/autogpt_platform/frontend/next.config.mjs
index 9bb5983801..12f7e7091f 100644
--- a/autogpt_platform/frontend/next.config.mjs
+++ b/autogpt_platform/frontend/next.config.mjs
@@ -6,6 +6,8 @@ const enableSourceMaps = process.env.NEXT_PUBLIC_SOURCEMAPS !== "false";
/** @type {import('next').NextConfig} */
const nextConfig = {
+ // Suppress the "X-Powered-By: Next.js" header (framework fingerprinting).
+ poweredByHeader: false,
productionBrowserSourceMaps: enableSourceMaps,
// Externalize OpenTelemetry packages to fix Turbopack HMR issues
serverExternalPackages: [
@@ -84,6 +86,21 @@ const nextConfig = {
// Vercel has its own deployment mechanism and doesn't need standalone mode
...(process.env.VERCEL ? {} : { output: "standalone" }),
transpilePackages: ["geist"],
+ // Baseline security response headers applied to every route. Defined here
+ // (rather than in the Sentry options) so they apply on all build paths.
+ async headers() {
+ return [
+ {
+ source: "/:path*",
+ headers: [
+ { key: "X-Content-Type-Options", value: "nosniff" },
+ { key: "X-Frame-Options", value: "SAMEORIGIN" },
+ // Enables Sentry browser JS self-profiling.
+ { key: "Document-Policy", value: "js-profiling" },
+ ],
+ },
+ ];
+ },
};
// Only run the Sentry webpack plugin when we can actually upload source maps
@@ -149,18 +166,4 @@ export default skipSentryPlugin
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
-
- async headers() {
- return [
- {
- source: "/:path*",
- headers: [
- {
- key: "Document-Policy",
- value: "js-profiling",
- },
- ],
- },
- ];
- },
});