feat(web): add content security policy (CSP)#25389
Closed
meesfrensel wants to merge 1 commit intomainfrom
Closed
Conversation
Contributor
|
Deploying preview environment to https://pr-25389.preview.internal.immich.build/ |
meesfrensel
commented
Jan 20, 2026
| } | ||
| </style> | ||
| <script> | ||
| <script nonce="%sveltekit.nonce%"> |
Collaborator
Author
There was a problem hiding this comment.
The script might need to be externalized or hashed because the adapter-static prerenders the html.
Member
|
The svelte web server only responds to http requests in dev, not in production. In production the CSP headers need to be added by nodejs/nestjs/express. Did you test this with a production build or just the dev server? |
Collaborator
Author
|
Ah, I didn't realize that. Will test/check/update and report back later! |
Member
|
I'm like 99% sure this will require code changes on the nodejs side, so feel free to open a new PR if you get around to implementing that. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds CSP config to svelte config which in turn generates and adds the Content-Security-Policy header.
Fixes #23261
Closes #24633
Related discussion on how to setup CSP and other security measures on the proxy side: #13043
(not sure what to do about the docker build failure)
How Has This Been Tested?
Please describe to which degree, if any, an LLM was used in creating this pull request.
None