fix: sanitize id_prefix to prevent HTML comment injection in SSR output#17993
fix: sanitize id_prefix to prevent HTML comment injection in SSR output#17993mandreko wants to merge 2 commits intosveltejs:mainfrom
Conversation
Strip `<` and `>` from id_prefix before embedding it in hydration markers to prevent malicious prefixes from breaking out of HTML comments and injecting arbitrary HTML into server-rendered output.
|
|
While it's technically correct that you could do HTML injection here, it's basically impossible to exploit. To do so you would have to provide a dynamic |
Summary
<and>characters fromid_prefixbefore embedding it in hydration markersid-prefix-html-comment-sanitization) to cover this scenarioTest plan
pnpm testid-prefix-html-comment-sanitizationpassesid_prefixlike-->injected<--does not break SSR hydration markers