Skip to content

Conversation

Yannik
Copy link
Contributor

@Yannik Yannik commented Sep 18, 2023

This PR adds the configured nonce to <script> elements (or nothing, it no nonce is set, since getNonceAttribute will then return an empty string).

This does not fix all of the csp issues (embedded fonts, third party assets), but it atleast makes laravel-debugbar usable with a configured content security policy.

To set the nonce, you can use Debugbar::getJavascriptRenderer()->setCspNonce($yourNonce);

@Yannik Yannik force-pushed the add-nonce-to-script-elements branch from b31f59e to 66ab403 Compare September 19, 2023 09:46
@Yannik
Copy link
Contributor Author

Yannik commented Sep 19, 2023

Combined with php-debugbar/php-debugbar#561 (which has been merged), this fixes all script-src csp issues! style-src 'unsafe-inline' is still required, since there are a few inline styles where I haven't found a good solution yet.

@barryvdh barryvdh merged commit 8a3bab7 into barryvdh:master Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants