Content-Security-Policy header
It is a good practice to return a Content-Security-Policy
header as it prevents different types of XSS attacks.
This is what we currently use on our Framadate server:
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'none'; style-src 'self' 'unsafe-inline' maxcdn.bootstrapcdn.com; font-src 'self' maxcdn.bootstrapcdn.com; img-src 'self'
Here is what it means:
- By default only allow resources from the same domain.
- Only allow scripts from the same domain or from inline scripts.
- Don't allow objects and embeds.
- Only allow styles from the same domain, from inline styles or from maxcdn.bootstrapcdn.com.
- Only allow fonts from the same domain or from maxcdn.bootstrapcdn.com.
- Only allow images from the same domain.
I thought you might want to implement this directly into Framadate.
It's also a good idea to define the following headers:
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
(We also use X-Frame-Options: DENY
but I guess some people might want to display polls in iframe like in https://framagit.org/framasoft/framadate/issues/159.)