diff --git a/next.config.js b/next.config.js index 4f4712b..cc05d08 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,39 @@ +const nextSafe = require("next-safe"); + +module.exports = { + async headers() { + return [ + { + source: "/:path*", + headers: nextSafe({ + contentTypeOptions: "nosniff", + contentSecurityPolicy: { + "base-uri": "'none'", + "child-src": "'none'", + "connect-src": "'self'", + "default-src": "'self'", + "font-src": "'self'", + "frame-src": "'none'", + "img-src": "'self'", + "frame-ancestors": "'none'", + "manifest-src": "'self'", + "media-src": "'self'", + "object-src": "'none'", + "prefetch-src": "'self'", + "script-src": "'self'", + "style-src": "'self'", + "worker-src": "'self'", + "form-action": "'self'", + reportOnly: false, + }, + referrerPolicy: "same-origin", + xssProtection: "1; mode=block", + }), + }, + ]; + }, +}; + /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, diff --git a/package.json b/package.json index 7a549af..f709e1b 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,9 @@ "lint": "next lint" }, "dependencies": { - "next": "12.3.1", "aws-sdk": "^2.1228.0", + "next": "12.3.1", + "next-safe": "^3.2.1", "react": "18.2.0", "react-dom": "18.2.0", "react-fade-in": "^2.0.1", diff --git a/yarn.lock b/yarn.lock index 0dc5a8a..623ae8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -713,6 +713,11 @@ nanoid@^3.3.4: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== +next-safe@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/next-safe/-/next-safe-3.2.1.tgz#76bb6deb2b11a39318e5b962a6da4e57584bf77f" + integrity sha512-2BBbnendVIlbUjrvV/N6cotuba71i2IIczo0dqmpZu9oSl2PlN6hYML22fidcqXZILwghyXULIy4lxyAgPz+Xg== + next@12.3.1: version "12.3.1" resolved "https://registry.yarnpkg.com/next/-/next-12.3.1.tgz#127b825ad2207faf869b33393ec8c75fe61e50f1"