Skip to content
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

Add nonce to <script> elements #1464

Merged
merged 1 commit into from
Sep 19, 2023

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
Copy link
Contributor Author

Yannik commented Sep 19, 2023

Combined with maximebf/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
13 checks passed
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