Skip to content

Commit

Permalink
Merge pull request #211 from supabase/chore/csp
Browse files Browse the repository at this point in the history
chore: add csp header
  • Loading branch information
staaldraad authored Jan 6, 2025
2 parents 6d97b28 + 78cf07d commit c4e535f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions website/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
/** @type {import('next').NextConfig} */

const cspHeader = `
default-src 'self' ${process.env.NEXT_PUBLIC_SUPABASE_URL};
style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com/ https://fonts.google.com/;
img-src 'self' data: ${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/;
object-src 'none';
base-uri 'none';
frame-ancestors 'none';
`

const nextConfig = {
reactStrictMode: true,
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: cspHeader.replace(/\n/g, ''),
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
],
},
]
},
}

module.exports = nextConfig

0 comments on commit c4e535f

Please sign in to comment.