Skip to content

Commit 448ad6f

Browse files
committed
fixup! [WebProfilerBundle] Disable CSP if dumper was used
1 parent ceef334 commit 448ad6f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ public function onKernelResponse(ResponseEvent $event)
9292
return;
9393
}
9494

95+
$nonces = [];
96+
if ($this->cspHandler) {
97+
if ($this->dumpDataCollector && $this->dumpDataCollector->getDumpsCount() > 0) {
98+
$this->cspHandler->disableCsp();
99+
}
100+
101+
$nonces = $this->cspHandler->updateResponseHeaders($request, $response);
102+
}
103+
95104
// do not capture redirects or modify XML HTTP Requests
96105
if ($request->isXmlHttpRequest()) {
97106
return;
@@ -118,23 +127,14 @@ public function onKernelResponse(ResponseEvent $event)
118127
return;
119128
}
120129

121-
$this->injectToolbar($response, $request);
130+
$this->injectToolbar($response, $request, $nonces);
122131
}
123132

124133
/**
125134
* Injects the web debug toolbar into the given Response.
126135
*/
127-
protected function injectToolbar(Response $response, Request $request)
136+
protected function injectToolbar(Response $response, Request $request, array $nonces)
128137
{
129-
$nonces = [];
130-
if ($this->cspHandler) {
131-
if ($this->dumpDataCollector && $this->dumpDataCollector->getDumpsCount() > 0) {
132-
$this->cspHandler->disableCsp();
133-
}
134-
135-
$nonces = $this->cspHandler->updateResponseHeaders($request, $response);
136-
}
137-
138138
$content = $response->getContent();
139139
$pos = strripos($content, '</body>');
140140

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy