Skip to content

Commit b57ee08

Browse files
committed
fix: Add comprehensive security headers to prevent phishing detection
- Added Strict-Transport-Security (HSTS) with preload to next.config.js and vercel.json - Implemented Content-Security-Policy (CSP) to restrict resource loading - Added X-Frame-Options, X-XSS-Protection, X-Content-Type-Options headers - Configured Referrer-Policy and Permissions-Policy - Should help resolve Chrome Safe Browsing phishing warning
1 parent 4162601 commit b57ee08

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

next.config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,57 @@ const nextConfig = {
55
compress: true,
66
generateEtags: false,
77

8+
// Security headers to prevent phishing and malware detection
9+
async headers() {
10+
return [
11+
{
12+
source: '/:path*',
13+
headers: [
14+
{
15+
key: 'Strict-Transport-Security',
16+
value: 'max-age=63072000; includeSubDomains; preload'
17+
},
18+
{
19+
key: 'X-Content-Type-Options',
20+
value: 'nosniff'
21+
},
22+
{
23+
key: 'X-Frame-Options',
24+
value: 'DENY'
25+
},
26+
{
27+
key: 'X-XSS-Protection',
28+
value: '1; mode=block'
29+
},
30+
{
31+
key: 'Referrer-Policy',
32+
value: 'strict-origin-when-cross-origin'
33+
},
34+
{
35+
key: 'Permissions-Policy',
36+
value: 'camera=(), microphone=(), geolocation=()'
37+
},
38+
{
39+
key: 'Content-Security-Policy',
40+
value: [
41+
"default-src 'self'",
42+
"script-src 'self' 'unsafe-eval' 'unsafe-inline' https://apis.google.com https://www.gstatic.com",
43+
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
44+
"font-src 'self' https://fonts.gstatic.com data:",
45+
"img-src 'self' data: https: blob:",
46+
"connect-src 'self' https://horizon-testnet.stellar.org https://horizon.stellar.org https://www.googleapis.com https://identitytoolkit.googleapis.com https://securetoken.googleapis.com wss://horizon-testnet.stellar.org wss://horizon.stellar.org",
47+
"frame-src 'self' https://*.youtube.com https://www.youtube.com",
48+
"base-uri 'self'",
49+
"form-action 'self'",
50+
"frame-ancestors 'none'",
51+
"upgrade-insecure-requests"
52+
].join('; ')
53+
}
54+
]
55+
}
56+
]
57+
},
58+
859
// ESLint configuration - ignore during builds to prevent warnings from failing CI
960
eslint: {
1061
// Ignore ESLint during builds - run linting separately in CI

vercel.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
{
1616
"source": "/(.*)",
1717
"headers": [
18+
{
19+
"key": "Strict-Transport-Security",
20+
"value": "max-age=63072000; includeSubDomains; preload"
21+
},
1822
{
1923
"key": "X-Content-Type-Options",
2024
"value": "nosniff"
@@ -26,6 +30,14 @@
2630
{
2731
"key": "X-XSS-Protection",
2832
"value": "1; mode=block"
33+
},
34+
{
35+
"key": "Referrer-Policy",
36+
"value": "strict-origin-when-cross-origin"
37+
},
38+
{
39+
"key": "Permissions-Policy",
40+
"value": "camera=(), microphone=(), geolocation=()"
2941
}
3042
]
3143
}

0 commit comments

Comments
 (0)