Hacker News new | ask | show | jobs
by Rohansi 68 days ago
How can you sanitize it in the backend? Do you just not allow sending messages with HTML tags in them?
2 comments

No. You have rules for explicitly allowed HTML, and escape anything that could be a tag that does not follow the rules.

This allows people to paste in rich content, but not things like <script> tags.

Pretty sure I saw someone shared that it was actually an <img> tag with onload set. Basically the same thing but just shows how unreasonable it is to expect Twitch to filter it for everyone. Also don't forget that people do livestream programming where there is a chance chat would include shared code snippets.
That, or no script tags, but that is quite hard as I understand.