|
|
|
|
|
by brainbag
186 days ago
|
|
With context, this article is more interesting than the title might imply. > The Sanitizer API is a proposed new browser API to bring a safe and easy-to-use capability to sanitize HTML into the web platform [and] is currently being incubated in the Sanitizer API WICG, with the goal of bringing this to the WHATWG. Which would replace the need for sanitizing user-entered content with libraries like DOMPurify by having it built into the browser's API. The proposed specification has additional information: https://github.com/WICG/sanitizer-api/ |
|
A big part of designing a security-related API is making it really easy and obvious to do the secure thing, and hide the insecure stuff behind a giant "here be dragons" sign. You want people to accidentally do the right thing, so you call your secure and insecure functions "setHTML" and "setUnsafeHTML" instead of "setSanitizedHTML" and "setHTML".