dillon1000/react
Commit
Browse files [Fizz] escape <style> textContent as css (#28870)
style text content has historically been escaped as HTML which is non-sensical and often leads users to using dangerouslySetInnerHTML as a matter of course. While rendering untrusted style rules is a security risk React doesn't really provide any special protection here and forcing users to use a completely unescaped API is if anything worse. So this PR updates the style escaping rules for Fizz to only escape the text content to ensure the tag scope cannot be closed early. This is accomplished by encoding "s" and "S" as hexadecimal unicode representation "\73 " and "\53 " respectively when found within a sequence like </style>. We have to be careful to support casing here just like with the script closing tag regex for bootstrap scripts.
Changed paths2 files
First-parent comparisonpackages/react-dom-bindings/src/server/ReactFizzConfigDOM.js ModifiedM packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…