mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 00:35:51 +03:00
[GH-ISSUE #13] CSP: Safari does not load Script / connect to WebSocket due to CSP errors #12
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SunflowerFuchs on GitHub (Sep 19, 2022).
Original GitHub issue: https://github.com/axllent/mailpit/issues/13
Safari handles the CSP differently and refuses to run Scripts / connect to the WebSocket. Chrome

It throws the following errors for me:
Setup:
I'm running Mailpit via docker (latest image) and access it via the current Safari (Version 15.6.1 (17613.3.9.1.16)) on MacOS Monterey Version 12.5.1.
As a workaround i've downgraded back to 1.1.3, so it's at least not an immediate issue for me.
Related:
It seems as if the
connect-src 'self'issue is already known and has possibly been fixed in an upcoming version of safari:https://github.com/w3c/webappsec-csp/issues/7
@SunflowerFuchs commented on GitHub (Sep 19, 2022):
I've installed the Safari Technology Preview and tested it there, and there are no more errors there, everything works fine.
This means that this is issue possibly mostly relevant as documentation for others encountering this problem, and doesn't need any actual code changes.
@axllent commented on GitHub (Sep 19, 2022):
@SunflowerFuchs, firstly thank you for not only reporting the Safari compatibility issue, but also for finding and linking the known bug, plus of course testing with the technology preview version.
I think that the reasons for those HTTP headers are (or at least should be) obvious - to prevent the loading & execution of remote JavaScript stored in any email. This is a security precaution since emails are rendered in the browser vs: an email client which lacks many of the browser's capabilities.
I found that by adding
ws:andwss:to the list ofconnect-srcoptions in the HTTP header is a good work-around for the issue, and appears to resolve the issue here in my testing (I was able to replicate it in my virtual Mac). The new docker release should be ready in the next 10 minutes for testing. Please re-open if still an issue for you (with the current stable version of Sarafi), else please also comment back if it resolves it for you. Apologies, my git commit auto-closed the GitHub issue.@SunflowerFuchs commented on GitHub (Sep 19, 2022):
I've just pulled the latest image, i can confirm that everything works again. Thank you so much for the quick fix.
@axllent commented on GitHub (Sep 19, 2022):
Glad to hear it, and thanks again for testing & the bug report!