Closed meck93 closed 5 days ago
Hi @meck93, Thank you for making the pull request! I understand what you want to do and think your approach is very good. I haven't had time to answer it, but I will be able to answer the test in the next few days, so please wait a bit.
Hi @meck93 , sorry to keep you waiting.
I've created a pull request, so please check it out. https://github.com/meck93/hono/pull/1
The test failure is fixed in the following commit. https://github.com/meck93/hono/pull/1/commits/2f06776d418a77c42b0d9e0956b9b0d97b35a7c4
Also, context
is an arbitrary object, but the internal specification does not allow its updating, so I have changed the code to use it as a key in a WeakMap.
Thank you.
Hi @meck93 , sorry to keep you waiting.
I've created a pull request, so please check it out. meck93#1
The test failure is fixed in the following commit. meck93@2f06776
Also,
context
is an arbitrary object, but the internal specification does not allow its updating, so I have changed the code to use it as a key in a WeakMap.Thank you.
Thanks a lot for the feedback and the pull request. I like your approach using the nonceMap
(really clean and easy to understand also if you're unfamiliar with the rest of the hono code). I've merged your PR ✅
Hi @meck93, Thank you. LGTM!
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 91.70%. Comparing base (
c8f6a86
) to head (45ce947
). Report is 7 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚨 Try these New Features:
@meck93
Thank you for the PR. I like this feature. This is a feat
commit, but the change is slight, so I'll include this in the next patch release.
And can you create a PR to add the description of this nonce
attribute to our website, though it will be short?
@yusukebe Sure. Here you go: https://github.com/honojs/website/pull/536 Let me know if you want something changed. Thanks!
closes #3694
This PR extends upon the work of https://github.com/honojs/hono/pull/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.