This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "Content Security Policy Cheat Sheet"
(initial page) |
m |
||
| Line 8: | Line 8: | ||
= Topic 1 = | = Topic 1 = | ||
| − | + | ||
| + | 80% solution policy: | ||
| + | ==== | ||
| + | |||
| + | default-src 'self'; font-src data: 'self'; img-src data: https: | ||
| + | 'self'; media-src *; object-src 'none'; script-src 'self' | ||
| + | 'unsafe-inline'; style-src 'self' 'unsafe-inline'; report-uri ??? | ||
| + | |||
| + | This allows inline javascript and styles while ensuring flash and | ||
| + | mixed content can't happen. | ||
| + | |||
| + | [todo] adding eval | ||
| + | [todo] adding a CDN, for example | ||
| + | [todo] Add instructions for google analytics/translation | ||
| + | |||
| + | Configurations | ||
| + | ==== | ||
| + | |||
| + | [todo] add context around these examples and where they would go in a | ||
| + | config file. | ||
| + | |||
| + | Apache | ||
| + | ---- | ||
| + | |||
| + | Header set X-Content-Type-Options "nosniff" | ||
| + | Header set X-XSS-Protection "1; mode=block" | ||
| + | Header set X-Frame-Options "SAMEORIGIN" | ||
| + | Header set Strict-Transport-Security "max-age=631138519" | ||
| + | Header unset Content-Security-Policy | ||
| + | Header add Content-Security-Policy-Report-Only <whatever the policy | ||
| + | ends up being> | ||
| + | |||
| + | ==nginx== | ||
| + | |||
| + | add_header X-Content-Type-Options "nosniff"; | ||
| + | add_header X-XSS-Protection "1; mode=block"; | ||
| + | add_header X-Frame-Options "SAMEORIGIN"; | ||
| + | add_header Strict-Transport-Security "max-age=631138519"; | ||
| + | add_header Content-Security-Policy-Report-Only <whatever the policy | ||
| + | ends up being> | ||
== This is a subtopic. Its about topic 1 but not really so I made it a subtopic. == | == This is a subtopic. Its about topic 1 but not really so I made it a subtopic. == | ||
Revision as of 04:54, 30 January 2014
Introduction
Content Security Policy:
- Slices and dices
- Never wears out
- Money back guarantee
- Makes Jullien Fries!
Topic 1
80% solution policy:
==
default-src 'self'; font-src data: 'self'; img-src data: https: 'self'; media-src *; object-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; report-uri ???
This allows inline javascript and styles while ensuring flash and mixed content can't happen.
[todo] adding eval [todo] adding a CDN, for example [todo] Add instructions for google analytics/translation
Configurations
==
[todo] add context around these examples and where they would go in a config file.
Apache
Header set X-Content-Type-Options "nosniff" Header set X-XSS-Protection "1; mode=block" Header set X-Frame-Options "SAMEORIGIN" Header set Strict-Transport-Security "max-age=631138519" Header unset Content-Security-Policy Header add Content-Security-Policy-Report-Only <whatever the policy ends up being>
nginx
add_header X-Content-Type-Options "nosniff"; add_header X-XSS-Protection "1; mode=block"; add_header X-Frame-Options "SAMEORIGIN"; add_header Strict-Transport-Security "max-age=631138519"; add_header Content-Security-Policy-Report-Only <whatever the policy ends up being>
This is a subtopic. Its about topic 1 but not really so I made it a subtopic.
Another subtopic
Authors and Primary Editors
Neil Mattatall - neil[at]owasp.org
Other Cheatsheets
OWASP Cheat Sheets Project Homepage