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 a nonce to the script/style elements #809

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

johan-smits
Copy link
Contributor

Fixes #288

By creating nonce script tags a html processor can extract it and include them in the CSP header.

@ctron
Copy link
Collaborator

ctron commented Jun 5, 2024

Thanks for the PR. Looks good!

Could I encourage you to:

That would be great!

As change looks simple enough, I think I could backport it, once it's merged.

 up the nonce value and include it into the header.
@johan-smits
Copy link
Contributor Author

@ctron just pushed an update. While the nonce is not only for script I also implemented it on the style tags. Please review the changes and let me know if there is feedback.

@johan-smits johan-smits changed the title Add a nonce to the script elements Add a nonce to the script/style elements Jun 5, 2024
@ctron ctron merged commit c160ed3 into trunk-rs:main Jun 5, 2024
57 checks passed
@ctron
Copy link
Collaborator

ctron commented Jun 5, 2024

Backported to 0.20.2: https://github.com/trunk-rs/trunk/releases/tag/v0.20.2 … maybe you can give it a quick test.

@johan-smits
Copy link
Contributor Author

@ctron for my use case it works. 👍

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.

Avoiding inline script tag in built index.html
2 participants