Azareal / Gosora

Gosora is an ultra-fast and secure forum software written in Go that balances usability with functionality.
https://gosora-project.com/
GNU General Public License v3.0
164 stars 16 forks source link

Content Security Policy Header #27

Open Azareal opened 6 years ago

Azareal commented 6 years ago

This header can be useful for running scripts which shouldn't, however there are a few spots where we run inline scripts, so we want to make sure we don't end up killing those along with the baddies.

We probably want to start by surveying every spot with inline scripts and going through there, perhaps we can keep them working with a nonce or something while still getting that anti-XSS goodness. There are plenty of resources on the web which go into it, but Troy Hunt as an interesting stance in: https://www.troyhunt.com/locking-down-your-website-scripts-with-csp-hashes-nonces-and-report-uri/

Azareal commented 6 years ago

I added a simple CSP header to automatically upgrade outgoing requests for images to HTTPS to avoid mixed content alerts.

I might add a configuration setting to disable that, if there turn out to be a lot of servers which only run HTTP. A proxy is also an option, although someone might abuse it to DDoS a server.

Azareal commented 5 years ago

I'm in the midst of upgrading the content security policy headers.

There are a few spots where I use inline scripts however, so they're currently exempt. I am working on converting them away from that though, so that I can set that policy everywhere.