-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fixes shadow hydration escaping #3793
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
fixes shadow hydration escaping #3793
Conversation
🦋 Changeset detectedLatest commit: 0da6c8f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for kit-demo canceled. 🔨 Explore the source changes: 0da6c8f 🔍 Inspect the deploy log: https://app.netlify.com/sites/kit-demo/deploys/6203ee9b50a2ee0008998ab6 |
I also tried using devalue package but it's the same, html becomes malformed. This way is vulnerable to XSS probably so not the best way, but just a suggestion. |
Actually I found out that Next.js is using the same(similar) strategy with regex like this PR: I'll improve this a little but this isn't that bad. |
we have a utility for that kit/packages/kit/src/utils/escape.js Line 19 in 59badb5
|
and it would be great to have a test in https://github.com/sveltejs/kit/tree/master/packages/kit/test/apps/basics/src/routes/xss so that we can catch regressions. |
Thanks, I actually adopted the code from Next.js in the latest commit, but I'll implement that code now you suggested because DRY. |
@PH4NTOMiki i pushed a fix for the invalid double-qoute escape and added a test. hope you don't mind. this is kind of urgent 😬 |
Yeah, of course, thank you |
Co-authored-by: Ben McCann <[email protected]>
Looks like you'll need to run |
Co-authored-by: Ben McCann <[email protected]>
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.
I had a couple suggestions for the jsdocs, but otherwise lgtm
I would like to get another set of eyes from @Conduitry though since he was more involved in #2534. Or Rich since he added the original escape mechanism in #882
Co-authored-by: Ben McCann <[email protected]>
these docs describe where the escaped result can be safely used, not how the return value looks like. see
it's actually a string prop on a larger json thats added to a script block elsewhere later. Not fond of this complexity but it is what it is. I'd like to merge this first and we can improve the docs in a followup PR. |
Something in this PR seems to have broken https://kit.svelte.dev/docs |
@dominikg what do you think? |
Or should I try to PR that again? |
@benmccann also, is there any change that that Vite update could be causing anything? maybe together with this, or alone? |
It works if I revert this line:
|
Isn't that the current/latest line? |
Yes, and it's broken |
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
fixes #3773
there are many better ways to solve this, if anyone has a suggestion.
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0