-
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
Does strict-dynamic
allow dynamically adding inline scripts?
#426
Comments
The intent is definitely for This could possibly be a bug in the spec text, unless @mikewest says otherwise :) |
The intent is, as @arturjanc suggests, to allow this snippet to cause script execution. I'm pretty sure we've locked that in with tests (and implementations), but I can totally believe I screwed up the specification. I expect I intended to add something like step 1.4 of https://w3c.github.io/webappsec-csp/#script-pre-request to the https://w3c.github.io/webappsec-csp/#match-element-to-source-list algorithm. You're correct that the spec, as written, doesn't do what I expect it to do. |
@mikewest Since I can't refer to the spec on this point: is the intent also to allow dynamically inserted inline styles? (Created with |
No, |
For example, if I have
on a page with a CSP of
script-src 'strict-dynamic' 'nonce-asdf'
, does it log0
or not?As best I can tell, the CSP spec says no. In particular,
src
attribute, so step 15 of HTML's prepare a script governs, which callsscript-src
, which in step 4 callsnonce-source
expression, becauseelement
does not have anonce
attribute,hash-source
expression, because there are none, and therefore(Does element match source list for type and source? makes no mention of
strict-dynamic
except to turn offunsafe-inline
.)But Firefox and Chrome both allow it. (Safari does not support
strict-dynamic
at all.)The section on the usage of
strict-dynamic
is not helpful; it says that "Script requests which are triggered by non-"parser-inserted" script elements are allowed", which implies it only applies to external scripts, but also says "scripts created at runtime will be allowed to execute", which implies it would apply to inline ones as well.The text was updated successfully, but these errors were encountered: