-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebAssembly conflict with restrictive CSP in Chrome #3
Comments
You found a nice trick for escaping from the CSP rules. :) I want to keep the API as simple as possible and I'm not convinced that it would be a feature, which is useful for most users. Also, I'm concerned that this way of circumventing CSP will be closed in the future. |
Some Browser extensions and internet providers injects code into websites, which sometimes massively manipulate the DOM and JavaScript objects. Beside that, it could be that data is also derived in this way. I'm writing a web application (https://hexed.it) which can be used to analyse and edit any file locally. These files could contain sensitive data. I don't send any of these data to the server and I want to protect my users as much as possible from ISPs or Browser extensions doing that. A very large part of these manipulations can be prevented by using a restrictive CSP.
I'm in the hope that |
Your hex editor is very cool. :) I heard about this practice of ISPs with HTTP websites, but I thought it isn't working anymore with HTTPS websites. As far as I know, you couldn't stop browser extensions from reading website contents. Even if you block outgoing requests on your site, the extensions can collect the data into their localStorage and send it to a remote server next time, when another webpage is loaded without CSP. Extensions can even disable the CSP completely: https://chrome.google.com/webstore/detail/disable-content-security/ieelmcmcagommplceebfedjlakkhpden?hl=en |
To increase security, I think the best way is to overwrite each API call you don't use: fetch(), XMLHttpRequest(), Worker(), eval(), DOM API etc. |
Especially for ISPs, I had this problem indeed only at a time where my page used HTTP.
That doesn't work, because the same trick I've used for the The CSP is the best way to prevent that connections to other servers can be established, and the restrictive
When an extension does that secretly, there should be a good chance, that such an extension get removed/disabled by the browser vendor. |
First, thanks for this great package! I'm using it in my web-application, where it works wonderful, even for very large files (> 10 GB).
Unfortunately, if a page has a restrictive Content-Security-Policy which does not allow
'unsafe-eval'
forscript-src
, theWebAssembly.compile
will fail with:For more information see:
WebAssembly/content-security-policy#7
https://github.com/WebAssembly/content-security-policy/blob/master/proposals/CSP.md
I found a simply workaround which grabs the
WebAssembly
object from a page with'unsafe-eval'
set, and overwrites the object from the "main window". This is possible using this JavaScript:So hash-wasm is using the
WebAssembly
object from the iframe with'unsafe-eval'
without to even know about this "hack".Since I don't like overwriting global objects, I think it would be a nice feature to be able to provide the
WebAssembly
object, which it should use, directly to hash-wasm.The text was updated successfully, but these errors were encountered: