Improve CSP#303
Conversation
| <meta http-equiv="Content-Security-Policy" content=" | ||
| block-all-mixed-content; | ||
| child-src 'none'; | ||
| connect-src http: ws:; |
There was a problem hiding this comment.
The http here is not needed in prod, and should be overwritten in the onHeadersReceived in dev. However, somehow it doesn't work: https://stackoverflow.com/questions/51969512/define-csp-http-header-in-electron-app#answer-52243138
So we can:
- either add
httpin prod, which I believe doesn't introduce a large attack surface, and allow CRA hot reloading - or remove
httpin prod, but then CRA hot reloading breaks.
|
@yjkimjunior I would like you to try |
pmespresso
left a comment
There was a problem hiding this comment.
@amaurymartiny confirming this works on my machine as well.
Once we bundle the light client though, wouldn't we need unsafe-eval? Especially as it looks like the wasm-eval/wasm-unsafe-eval proposal for Chromium has been very slowly moving toward implementation....maybe.
anderejd/electron-wasm-rust-example#6
WebAssembly/content-security-policy#7
No, we bundle the light client inside Electron, and spawn it from the electron process, there's no wasm involved. The day we'll have a light client in wasm (which realistically won't happen in the next 6 months imo), we'll need to enable unsafe-eval |
* init * update with needed permissions * update with needed permissions * nbs * checklist cheatsheet * set web preferences * lint * feat(csp):use the csp from parity-js shell and fether * fix: set csp on headers received * fix lint * fix: font src csp, comment out webview event * Improve CSP (#303) * fix(csp): Make CSP work * fix: Remove unsafe-eval
I read some more stuff about CSP:
onHeadersReceiveddoesn't work in prod mode with file://. This means that we need to set a<meta>tag for CSP in index.html, which I did. Edit: Created an issue on Fether too, it's a big security risk there.unsafe-evaleverywhere, it's actually not needed by CRA. However, now we cannot run wasm code, so it'll default to the JS one. We should wait for thewasm-evalCSP (maybe in Electron 5?)After testing, these CSP work in both prod and dev