Skip to content

[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

Merged
merged 1 commit into from
Mar 12, 2021

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Mar 10, 2021

Q A
Branch? 5.x for features
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #29084
License MIT
Doc PR -

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).

@herndlm herndlm force-pushed the disable-csp-if-dumper-was-used branch 3 times, most recently from ab14e7d to 74315f0 Compare March 10, 2021 20:14
@@ -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'),
Copy link
Member

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)

Copy link
Contributor Author

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.

@herndlm
Copy link
Contributor Author

herndlm commented Mar 11, 2021

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

@fabpot fabpot force-pushed the disable-csp-if-dumper-was-used branch from 448ad6f to 5dc2637 Compare March 12, 2021 06:08
@fabpot
Copy link
Member

fabpot commented Mar 12, 2021

Thank you @monojp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WebProfilerBundle] Inject "unsafe-eval" into the CSP if the VarDumper is used
4 participants