Skip to content
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

SanitizeDocument does not sanitize the root html element #164

Closed
acostadelivra opened this issue May 31, 2019 · 1 comment
Closed

SanitizeDocument does not sanitize the root html element #164

acostadelivra opened this issue May 31, 2019 · 1 comment

Comments

@acostadelivra
Copy link

The HtmlSanitizer's SanitizeDocument function does not sanitize the root html element.

For example, sanitizing the trivial document:
<html onmousemove="alert(document.location)"><head></head><body></body></html>
does not strip the onmousemove attribute, which is not an allowed attribute.

It appears to me this is due to the use of QuerySelectorAll("*") in DoSanitize which only returns descendants and effectively skips the "context" element.

@mganss mganss closed this as completed in a258535 Jun 2, 2019
@mganss
Copy link
Owner

mganss commented Jun 2, 2019

Thanks for catching this! Fixed in 4.0.217 (and 5.0.218-beta).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants