(no title)
jerf | 7 days ago
.setHTML("<h1>Hello</h1>", new Sanitizer({}))
will strip all elements out. That's not too difficult.Plus this is defense-in-depth. Backends will still need to sanitize usernames on some standard anyhow (there's not a lot of systems out there that should take arbitrary Unicode input as usernames), and backends SHOULD (in the RFC sense [1]) still HTML-escape anything they output that they don't want to be raw HTML.
evilpie|7 days ago
You might want something like:
This will replace <h1> elements with their children (i.e. text in this case), but disallow all other elements and attributes.benmmurphy|7 days ago