Skip to content
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

Going forward with CSP #108

Open
rugk opened this issue Sep 26, 2016 · 7 comments
Open

Going forward with CSP #108

rugk opened this issue Sep 26, 2016 · 7 comments

Comments

@rugk
Copy link
Member

rugk commented Sep 26, 2016

Google has just released a CSP testing tool and some more detailed information about CSP.

They mention some interesting things:

  1. There is a new 'strict-dynamic' being created.
  2. unsafe-inline can always be used as a fallback for older browsers supporting only CSPv2. CSPv3-compliant browsers will ignore this if strict-dynamic, nonces or hashes are used.
  3. They do discourage the use of 'self' in script-src as it can be bypassed in certain cases.

In CSPv3 you can AFAIK also define subdirectories (privatebin.org/scripts), which could be another way to strengthen our policy. However in this case there might be compatibility issues.

So together with #82 this might be an issue we can address in the future when CSP has further developed itself 😃

@Framartin
Copy link

Agreed. Using nonce- or sha256- in script-src is a a lot better than 'self' to mitigate the exploitation of XSS, like #183. See Documentation.

@rugk
Copy link
Member Author

rugk commented Apr 16, 2021

Interesting, there is a new strict-dynamic thing in CSPv3 that – as far as I understand it – let's one script load any other scripts.
I'm still thinking of whether that could make it easier to use nounces or in our case, rather, hashes (we do recalculate SRI hashes anyway, so another place for these would also be possible).

@rugk
Copy link
Member Author

rugk commented Apr 16, 2021

And there is more crazy (experimental) stuff (again found via Googles CSP tool), but that seems to look like a better solution for unsafe-eval, which we only include, because of Chrom/ium's PDF reader, so I guess we can ignore that…

@elrido
Copy link
Contributor

elrido commented Apr 17, 2021

The unsafe-eval is required in Chrome and Safari for WASM loading. If not set, calling WebAssembly.instantiate will trigger an error in those browsers.

const module = await WebAssembly.compile(buff);
const ins = await WebAssembly.instantiate(module, { env });

@rugk
Copy link
Member Author

rugk commented Jun 19, 2021

Regarding unsafe-eval the Matrix Element client has the same issue and someone suggested this:

Using WebAssembly.instantiateStreaming would avoid this problem.

@rugk
Copy link
Member Author

rugk commented Jun 19, 2021

Also the docs for this say:

This is the most efficient, optimized way to load wasm code.

So would likely not be a bad idea to use this altogether…

@rugk
Copy link
Member Author

rugk commented Jun 19, 2021

Opened a new issue for that, so we can keep this “meta-issue” here and fix that WebAssembly loading: #814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants