-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfiler] don't add inline javascript #15397
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
Comments
Does it really matter in case of the web toolbar which is meant to be used in development only? |
@jakzal this forces you to disable CSP headers during development, meaning that any CSP-incompatible code would only be detected in prod. |
I have some idea about how this could be done. |
For now, I am using this workaround (Symfony 2.7) - in Kernel Response event listener with lower priority than "WebDebugToolbarListener", I am adding a CSP "nonce" exception like this:
|
@vooj-tae see #18568 for the PR implementing support for CSP in the toolbar (this still requires disabling CSP for the profiler pages themselves, which is OK IMO and makes things much easier than what I thought about in September 2015 (no need to change external bundles hooking into the profiler to add new panels) |
…ecurity-Policy context without unsafe-inline (romainneutron) This PR was merged into the 3.2-dev branch. Discussion ---------- [3.2][WebProfilerBundle] Fix bundle usage in Content-Security-Policy context without unsafe-inline | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15397 | License | MIT | Doc PR | N/A Hello, this PR fixes the compatibility of the WebprofilerBundle in a context where Content-Security-Policy headers are could prevent `unsafe-inline` of `script-src` or `style-src` directives. This PR has been originally proposed in 2.8 in #18434 Commits ------- 571a1f2 [WebProfilerBundle] Fix bundle usage in Content-Security-Policy context without unsafe-inline
Inline JavaScript (and CSS) is a security and performance issue. Content-Security-Policy exists to tell browsers not to execute inline JavaScript.
The Web Profiler Toolbar however uses inline JavaScript. Why? It would also be possible to add a script tag to load the missing JavaScript.
Informations can be passed from the server to the JavaScript code easily without inline JavaScript:
and in your JavaScrip (angular here)t:
The text was updated successfully, but these errors were encountered: