I have a large, legacy codebase that I'd like to introduce the Content-Security-Policy
header on. It is not feasible in the short term to truly lock-down the site (for example, there are inline scripts all over the place that have no automated test coverage), but at least I can start by forbidding access to content sources that I know for sure aren't in use currently and then slowly ratchet it down over time.
Unfortunately, the list of sources that aren't being used is rather short. This was my first attempt at a Content-Security-Policy
value:
default-src * 'unsafe-eval' 'unsafe-inline'
That broke a number of things, such as images sourced using the data: scheme. Looking around, I see a number of things you might want to include, such as connect-src ws:
, that aren't explicitly called out in the docs.
What is the maximally permissive Content-Security-Policy
header value that basically lets the site do everything the browser is allowed to do by default? Asked another way: what header value can I introduce that definitely won't break anything on the site?
I'd feel more comfortable introducing the header into the legacy site if I could start with something that I know won't break anything, then subtract out the permissions that I know are safe to remove.