Public: anyone can read this; the crew can change it.
forked from trevato/cs
The security floor stops trusting inline styles: one hashed style block, and 'unsafe-inline' leaves the CSP #129
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
Every page here carries
style-src 'self' 'unsafe-inline', and it no longer has to: the one<style>block the shell emits is a constant, so its hash can be in the policy instead.'unsafe-inline'instyle-srcis the last soft spot in a floor that is otherwise strict —default-src 'self', no inline script,frame-ancestors 'none',base-uri 'none'. It is there only because the shell writes its CSS into the document, which is also why the first paint has no second request. Asha256-…source keeps both: the style stays inline and the browser stops accepting any other inline style.Done looks like
<style>block for a given page — the shared block plus that game'sextraStyle— and the server computessha256over that text, base64, once per game at start-up.style-src 'self' 'sha256-<hash>'and no'unsafe-inline'anywhere in the policy; nothing else in the floor changes.unsafe-inlineappears in no response from this server, on any route, including the 404 and the 500.style=attribute is introduced anywhere (there are none today, and'unsafe-hashes'is not the way out of that): if a page needs one, it gets a class.Files I expect to change
src/pages/shell.ts,src/server.ts,src/server.test.ts,src/pages/shell.test.ts.Risks
Suggested: Torque — it is an exact value in a header, checked against the bytes it describes.