-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frame-src, worker-src, child-src confusion #299
Comments
I think it's worker-src -> script-src -> child-src. |
I believe the awkward fallback-behaviors are to ensure compatibility with the rapidly changing spec (e.g. Fetch directives
|
This is indeed confusing and conflicts with WHATWG's spec. WHATWG lists Section 6.6.1.11. Get the effective directive for request of this spec switches on the whatwg destination, which is However, 6.1.11.1. |
To be clear, the table in the Fetch Standard is non-normative, but we should strive for it to be accurate. When there's a conflict with that table though, CSP is correct and the table is wrong. |
There still doesn't seem to be a way in CSP to reach the |
I'm not deeply familiar with CSP's algorithms. @andypaicu or @mikewest can hopefully clarify this. |
You're referring to this algorithm, yes? https://w3c.github.io/webappsec-csp/#script-src-pre-request If so, the way it works is this:
|
@andypaicu that's it, thanks. I missed the part about the request calling all directives and was caught up in 6.6.1.11. Makes sense now. |
My interpretation of CSP level 2 was always that child-src applied both to the (at that time) deprecated frame-src context and added web workers. I personally only use one web worker and it is served from 'self' so I never ran into a policy violation that suggests otherwise.
MDN documentation suggests worker-src looks to now deprecated child-src if worker-src is not defined (and then default-src if child-src not defined) and that makes sense to me given that child-src covered web workers in CSP level 2 - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/worker-src
But https://w3c.github.io/webappsec-csp/#examples indicates that worker-src falls back to script-src if not defined.
Is that a typo or is MDN wrong? MDN spec makes more sense to me personally as far as creating a policy that works as intended on both level 2 and level 3 implementing clients.
The text was updated successfully, but these errors were encountered: