No CSP means no restrictions. Any CSP is better than no CSP.
I like to read a CSP directive img-src ___
or frame-src ___
out loud as "images/frames are not allowed except from ___".
So this CSP:
Content-Security-Policy: img-src https://example.com
would be read out loud as "images are not allowed except for from https://example.com". What about frames? They are not specified, therefore they are allowed. Typically a page will set a CSP will set a very restrictive default-src
and then specifically override that to allow the external resources that it needs.
Content-Security-Policy: default-src 'self'; img-src https://example.com
which I read out loud as "Things are only allowed from self, except for images which are not allowed except for from https://example.com"
If a CSP directive (ex.: frame-src
) is not specified (and default-src
is also not specified) then no restrictions are applied.
That means that no CSP is equivalent to an empty CSP where everything is allowed (nothing is blocked).