-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add CSP header to all the pages (#445)
* feat: initial CSP * feat: add missing directives to load the content and scripts in the remaining pages * fix: add Hotjar script * docs: add comment describing the allowed lists * fix: enhance `connect-src` directive with another Hotjar domain
- Loading branch information
1 parent
35f20b4
commit 2d198f3
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { IS_PRODUCTION } from '@/config/constants' | ||
|
||
/** | ||
* Notes: | ||
* connect-src: Allows calls to Ashby's job board, Ecosystem DB API, Snapshot, Contentful and Hotjar. | ||
* script-src: Allows scripts from Hotjar, and Google Tag Manager. In development, 'unsafe-eval' is allowed for inline scripts to facilitate debugging. | ||
* img-src: Allows images from Contentful, Ecosystem DB for the project logos, Safe Claiming App for guardians images, and data URIs. | ||
* frame-src: Allows iframes from Mirror, Youtube and JWPlayer. | ||
*/ | ||
export const ContentSecurityPolicy = ` | ||
default-src 'self'; | ||
connect-src 'self' https://api.ashbyhq.com/posting-api/job-board/safe.global/ https://ecosystem-database.staging.5afe.dev/data.json https://hub.snapshot.org/graphql https://cdn.contentful.com/spaces/1i5gc724wjeu/ https://metrics.hotjar.io/ https://content.hotjar.io/ wss://ws.hotjar.com; | ||
script-src 'self' ${ | ||
IS_PRODUCTION ? '' : "'unsafe-eval'" | ||
} 'unsafe-inline' https://script.hotjar.com https://static.hotjar.com https://www.googletagmanager.com; | ||
style-src 'self' 'unsafe-inline'; | ||
font-src 'self'; | ||
object-src 'none'; | ||
base-uri 'none'; | ||
img-src 'self' http://images.ctfassets.net/ https://ecosystem-database.staging.5afe.dev/logos/ https://safe-claiming-app-data.safe.global/guardians/images/ data:; | ||
frame-src https://safe.mirror.xyz/ https://www.youtube-nocookie.com/ https://cdn.jwplayer.com/; | ||
` | ||
.replace(/\s{2,}/g, ' ') | ||
.trim() |