title: Http Security Headers categories: [cheatsheets]
6 Important HTTP Header for security.
defining sources where content is allowed to be loaded from.
Eg. content-security-policy: script-src: 'self'
More Info:
https://www.keycdn.com/support/content-security-policy/
Tells the Browser to use the browsers XSS Filter an all input:
x-xss-protection: 1; mode=block
Important header for content-type sniffing, a browser can "sniff" the content type of a loaded resource, eg a .png file could contain some javascript code, the browser detects the JS and executes the png file as script file.
this can be disabled by:
x-content-type: nosniff;
HSTS tells the browser to enforce a https connection on the next visit. so when a user enters a site, the browser knows to use the https protocol, this mitigates ssl stripping attacks.
strict-transport-security: max-age=31536000; includeSubDomains; preload
this is used to pin a specific public key (from the certifcat) to the webserver, this prevents other ca's from issuing a new certificate for your domain, eg. when a root CA is compromised.
public-key-pins: pin-sha256:"publickey_in_base64"
this header provides clickjacking protection, by not allowing iframes to load on this site.
x-frame-options: SAMEORIGIN