Content Security Policy Error when loading scripts hosted on IPFS #1008
Labels
area/chromium
Issues related to Chromium-based browsers
area/firefox
Issues related to Mozilla Firefox
effort/hours
Estimated to take one or several hours
kind/bug
A bug in existing code (including security flaws)
need/analysis
Needs further analysis before proceeding
P1
High: Likely tackled by core team if no one steps up
Describe the bug
When a website includes a script that's hosted on an DNSLink domain, and has a restrictive Content Security Policy, the scripts fail to load, and the website doesn't function properly.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Go to the website and all the assets load. There is no CSP error in the console.
Desktop (please complete the following information):
Chromium 91.0.4472.77 also has the same behavior.
Possible Solution
Modify CSP to gateway. I used the Mozilla Laboratory extension to modify the CSP on the website. My IPFS Gateway is at http://127.0.0.1:8080, so I added
http://127.0.0.1:8080/ipns/*.cactus.chat
to the script and style CSP directives (in a real solution font-src etc. should also be added). only/ipns/*.cactus.chat
here because that's what the script-src and style-src already specified. IPFS Companion should do this automatically.Another solution would be to stop intercepting URLs when scripts and stylesheets are being loaded over IPFS.
Note - I'm not associated with cactus.chat I just noticed this problem with companion, so I'm making this bug report.
Note 2 - related issues - #701 seems like the solution 2 that I said, but it seems to be closed and that behavior still doesn't happen? #624 's solution is to disable window.ipfs, but the toggle for that is locked and there seems to have been no progress on that?
The text was updated successfully, but these errors were encountered: