fix: sanitize <script> in __FRSH_STATE state (#739)
This commit escapes `<` `>` and related characters in the serialized state that is encoded into the `<script id=__FRSH_STATE>` tag. This prevents XSS attack occuring through injection of a `</script>` string in island props.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import Test from "../islands/Test.tsx";
|
||||
|
||||
export default function EvilPage() {
|
||||
return (
|
||||
<div>
|
||||
<Test message={`</script><script>alert('test')</script>`} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ export default function Home() {
|
||||
<Counter id="counter2" start={10} />
|
||||
<KebabCaseFileNameTest id="kebab-case-file-counter" start={5} />
|
||||
<Test message="" />
|
||||
<Test message={`</script><script>alert('test')</script>`} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user