CSP for Rust Playground: lock down code execution
If you’re building a Rust Playground-style app, your threat model is ugly in all the fun ways. You’re taking user input, compiling or executing code, rendering output, maybe embedding an editor, maybe shipping WebAssembly, and probably sprinkling in some analytics or third-party UI bits because product people always want one more script. That’s exactly the kind of app where Content Security Policy earns its keep. A Rust Playground is not just “another website.” It’s a code execution surface with a browser front end. Even if your actual Rust execution happens in a locked-down backend container, your frontend is still exposed to XSS, supply-chain script injection, data exfiltration, and clickjacking. CSP helps reduce that blast radius. ...