Skip to content

Commit

Permalink
Make CSP directives more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Jan 8, 2025
1 parent 3871411 commit b0ef8c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PUBLIC_SITE_DESCRIPTION=a free and open-source ecosystem to control various shoc
PUBLIC_SITE_DOMAIN=INVALID
PUBLIC_SITE_SHORT_DOMAIN=INVALID
PUBLIC_BACKEND_API_DOMAIN=INVALID
PUBLIC_GATEWAY_CSP_WILDCARD=INVALID
PUBLIC_GITHUB_PROJECT_URL=https://github.com/OpenShock
PUBLIC_DISCORD_INVITE_URL=https://discord.gg/OpenShock

Expand Down
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PUBLIC_SITE_DOMAIN=openshock.dev
PUBLIC_SITE_SHORT_DOMAIN=openshock.dev
PUBLIC_BACKEND_API_DOMAIN=api.openshock.dev
PUBLIC_GATEWAY_CSP_WILDCARD=*.openshock.dev

PUBLIC_TURNSTILE_DEV_BYPASS_VALUE=dev-bypass
3 changes: 2 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PUBLIC_SITE_DOMAIN=openshock.app
PUBLIC_SITE_SHORT_DOMAIN=openshock.app
PUBLIC_BACKEND_API_DOMAIN=api.openshock.app
PUBLIC_BACKEND_API_DOMAIN=api.openshock.app
PUBLIC_GATEWAY_CSP_WILDCARD=*.openshock.app
9 changes: 5 additions & 4 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ const config = {
'img-src': ['self', 'https://www.gravatar.com'],
'connect-src': [
'self',
'https://*.' + env.PUBLIC_SITE_DOMAIN,
'wss://*.' + env.PUBLIC_SITE_DOMAIN,
'https://' + env.PUBLIC_BACKEND_API_DOMAIN,
'wss://' + env.PUBLIC_BACKEND_API_DOMAIN,
'wss://' + env.PUBLIC_GATEWAY_CSP_WILDCARD,
'https://firmware.openshock.org',
'https://api.pwnedpasswords.com',
'https://api.pwnedpasswords.com/range/',
'https://cloudflareinsights.com',
],
'script-src': [
'self',
'https://challenges.cloudflare.com',
'https://challenges.cloudflare.com/turnstile/',
'https://static.cloudflareinsights.com',
],
},
Expand Down

0 comments on commit b0ef8c7

Please sign in to comment.