-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
feat(css): add CSP nonce to hono/css related style and script tags #3685
feat(css): add CSP nonce to hono/css related style and script tags #3685
Conversation
1609f5c
to
5f7e640
Compare
Hi @meck93, Thank you for making the pull request! I understand what you want to do and think your approach is very good. |
Hi @meck93 , sorry to keep you waiting. I've created a pull request, so please check it out. The test failure is fixed in the following commit. Also, Thank you. |
Thanks a lot for the feedback and the pull request. I like your approach using the |
Hi @meck93, Thank you. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3685 +/- ##
=======================================
Coverage 91.70% 91.70%
=======================================
Files 159 159
Lines 10145 10159 +14
Branches 2860 2871 +11
=======================================
+ Hits 9303 9316 +13
- Misses 840 842 +2
+ Partials 2 1 -1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you for the PR. I like this feature. This is a And can you create a PR to add the description of this |
@yusukebe Sure. Here you go: honojs/website#536 |
closes #3694
This PR extends upon the work of #2577 with the goal to bring the CSS nonce to the inline
style
andscript
tags created by the usage ofhono/css
. The goal is to be able to add<Style nonce={nonce} />
in order to comply with strict CSP rules.The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the codeTo Do
<script nonce="1234">document.querySelector('#hono-css').textContent+="..."</script>
being added to the snapshot which should end up there. One should test if this is only due to the test setup and the<script>
tag not being executed in the test environment.@usualoma could you provide me with some pointers on where to start further debugging these test failures? I see that you've implemented most code around CSP and CSS.