-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOMPurify support. #102
Comments
@cscott is setting the <svg [outerHTML]="mySvgIcon"></svg> |
The setters for Probably not too hard to get that working, just a bit of tedious reading of the parsing spec to ensure contexts and templates are correct. |
These definitions are needed to ensure proper sanitization by DOMPurify (fgnass#102).
The "insert a foreign element" operation in the HTML parsing algorithm differs from the standard `Document#createElementNS()` operation: it explicitly sets the prefix to `null`, and creates a `localName` which may contain `:` characters. Duplicate this behavior so that prefixes aren't lost when an SVG element is inserted, since the HTML serialization algorithm otherwise suppresses prefixes on SVG elements. This is needed for DOMPurify (fgnass#102).
These definitions are needed to ensure proper sanitization by DOMPurify (fgnass#102).
The "insert a foreign element" operation in the HTML parsing algorithm differs from the standard `Document#createElementNS()` operation: it explicitly sets the prefix to `null`, and creates a `localName` which may contain `:` characters. Duplicate this behavior so that prefixes aren't lost when an SVG element is inserted, since the HTML serialization algorithm otherwise suppresses prefixes on SVG elements. This is needed for DOMPurify (fgnass#102).
domino 2.1.0 works with DOMPurify. I just need to submit my patch upstream to DOMPurify. |
@cscott did it move forward? I'm trying to implement a sanitizer for the PCS service (mobile-html endpoint). The first choice I had was the sanitize-html package, but its minified size is prohibitive for our bundled size limit. DOMPurify is lightweight, but I'm worried that it's not reliable with domino, although it works in my code. |
I'd like to talk some more about the desired use case and spec. MediaWiki has a very specific (and bespoke) sanitizer, and new attributes are added/removed from time to time (we just added one this week, for instance). Adding new incompatible sanitization mechanisms doesn't seem like necessarily the right way to proceed. |
The necessary DOMPurify patches to support domino are at https://github.com/cscott/DOMPurify/tree/domino-support |
The specific use case is to sanitize the input from TBH, I'm not sure if that's really necessary since I think it's a safeish content since it's coming from the mwapi. In that sense, I lack knowledge regarding mwapi/displaytitle sanitization. |
I'm stuck on this. Any progress in supporting DOMPurify? Client Side code works well, but server side (with domino) is sanitized to an empty string. From what i can track down, it is the DOMPurify sets the content via yet the document readyState is always |
https://www.npmjs.com/package/dompurify should work under domino.
It appears that
outerHTML#set
is one of the things needed.See: https://gerrit.wikimedia.org/r/363156
The text was updated successfully, but these errors were encountered: