-
Notifications
You must be signed in to change notification settings - Fork 74
fix(cspSsrNonce): more robust tag replacement #658
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
Conversation
|
@GalacticHypernova is attempting to deploy a commit to the Baroshem's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Sorry for the double mention, but could this be prioritized for a push? I tried to make a test for the fix (as you can see from the below commits) but I unfortunately failed. If you could assist with writing the test that would be appreciated (it's commented out in the ssr nonce test file) |
|
This appears to be even more performant than current variation (I'm assuming maybe the word boundary has something to do with that), but we can probably optimize it further. For exanple, we could perhaps quote entire attribute lines as opposed to individual attribute values, which might lead to a moderately smaller internal array, but it is low priority as the current approach is not a bottleneck, so this optimization could be safely pushed separately and should not be a blocker for merging this fix. |
|
I just pushed a PR to Nuxt Image to remove the insecure nonce prop, hopefully it is merged and allows us to simplify link handling 😅 |
Baroshem
left a comment
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.
Great work, thanks!
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Types of changes
Description
Closes #594
Closes #610
The previous regex implementation, upon further review, had quite a few edge cases. Custom elements, and tags within other elements' props, can cause false modifications, yielding unexpected behavior. This PR fixes the regexes to make them much more robust, fixing said pitfalls. It uses a 2 step approach to mask stringified elements and word-boundaried regex to fix custom elements
Checklist: