-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfilerBundle] Disable CSP if dumper was used #40441
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
Conversation
ab14e7d
to
74315f0
Compare
@@ -24,6 +24,7 @@ | |||
service('router')->ignoreOnInvalid(), | |||
abstract_arg('paths that should be excluded from the AJAX requests shown in the toolbar'), | |||
service('web_profiler.csp.handler'), | |||
service('data_collector.dump'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add ->ignoreOnInvalid()
to stay compatible with cases where VarDumper is not installed and configured by DebugBundle (and so the panel is not configured)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fast review stof, really appreciate it.
I saw that the WebProfilerBundle has symfony/http-kernel
as dependency and thought that service will be always there then. Adapted.
src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
Show resolved
Hide resolved
I noticed that although the CSP is disabled and the header removed it still shows up in the profiler response page for that request which is kind of a lie. But on the other hand it should be there and is only removed temporarily because of the dumper. I'm not sure if this is a problem and should be addressed |
448ad6f
to
5dc2637
Compare
Thank you @monojp. |
Disables a configured Content Security Policy if the dumper was used to avoid breaking the toolbar. This is a less invasive alternative to #29155 which fixes #29084 (there is a project with a test case linked there).