Skip to content

Proposal: relax csp to allow web workers#3751

Draft
mnutt wants to merge 1 commit intosandstorm-io:masterfrom
mnutt:allow-web-workers
Draft

Proposal: relax csp to allow web workers#3751
mnutt wants to merge 1 commit intosandstorm-io:masterfrom
mnutt:allow-web-workers

Conversation

@mnutt
Copy link
Contributor

@mnutt mnutt commented Mar 7, 2026

This is opened as a draft for discussion only.

Back in 2020 it came to light that allowing Service Workers would allow them to modify response headers and potentially allow external requests to leak. The fix was worker-src 'none'. Unfortunately this had the side effect of also disallowing Web Workers.

Web Workers can be really useful for a lot of applications that need to do anything moderately complex on the front end. In my case, I'm trying to get a LibreOffice app to work but it requires a web worker. I could disable CSP at the server level but that doesn't feel like the right solution.

Web Workers (to my knowledge) don't have the same potential security issues as Service Workers, but there is no way to target just Service Workers. (link) (link)

In the meantime, I think we should be able to protect against Service Workers by instead limiting all worker loads to 'self' and then rejecting the actual Service Worker http requests. I'm not 100% sure of this solution, but it seems to work from what I can tell?

@ocdtrekkie
Copy link
Collaborator

I'm not opposed conceptually but CSP is a realm I have truly minimal expertise.

@ocdtrekkie ocdtrekkie added enhancement Feature requests app-platform App/Sandstorm integration features labels Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app-platform App/Sandstorm integration features enhancement Feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants