-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
As the default installation injects the code just before </body>,
the script and assets will be blocked by the browser if you enforce strong CSP headers for injection protection.
It would be nice workaround if by setting 'inject' to false, and rendering the debugbar manually in your master template, one could also add nonce or hash parameter:
$renderer = Debugbar::getJavascriptRenderer();
echo $renderer->renderHead(['nonce' => 'ogCHUYO6kVuNXlvGPcB8dcFIM7p');
..
echo $renderer->render(['nonce' => 'ogCHUYO6kVuNXlvGPcB8dcFIM7p');
so the result would be something like
<link nonce="ogCHUYO6kVuNXlvGPcB8dcFIM7p" .. />
..
<script type="text/javascript" nonce="ogCHUYO6kVuNXlvGPcB8dcFIM7p">
var phpdebugbar = new PhpDebugBar.DebugBar();
..
Doesn't seem to me that #569 is related, but correct me if I'm wrong