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

Whitespace sanitization behavior changed #373

Closed
makepanic opened this issue Oct 21, 2019 · 7 comments
Closed

Whitespace sanitization behavior changed #373

makepanic opened this issue Oct 21, 2019 · 7 comments

Comments

@makepanic
Copy link

This issue proposes a bug which...

Background & Context

Hi,
thanks for developing this great package.
I'm in the progress of updating from 1.x.x to 2.x.x and noticed our tests failing.

It seems like 2.x.x introduced a changed behavior when sanitizing a whitespace character string.
Previously it returned the whitespace string but now it's an empty string.

I'm not sure if this is a bug or expected behavior. We're invoking the sanitize method like this: sanitize(text, { ALLOWED_TAGS: [] })

Bug

Input

- (whitespace character ASCII 32)

Given output

`` - (empty string: string.length === 0)

Expected output

- (whitespace character ASCII 32)

@peterblazejewicz
Copy link

@makepanic
what is the version you're using?
See: #372

@cure53
Copy link
Owner

cure53 commented Oct 21, 2019

I think I found the problem.

MSIE11 won't create a full document if body.outerHTML gets set to an empty string. That would cause the exception. With the fix, we addressed #372 successfully but indeed the root cause was something else.

@cure53
Copy link
Owner

cure53 commented Oct 21, 2019

Let's see what the other browsers say... :D

@cure53
Copy link
Owner

cure53 commented Oct 21, 2019

I think master is ready for a quick review, should be fixed imho.

@makepanic
Copy link
Author

makepanic commented Oct 21, 2019

Thanks for the quick reply.

what is the version you're using?

2.0.7 tested it only in chrome

@makepanic
Copy link
Author

Just tried cure53/DOMPurify#3a303715d73de342e25e8437cc59552334823092 in our tests and it seems to have fixed the whitespace regression 👍

@cure53
Copy link
Owner

cure53 commented Oct 22, 2019

Awesome :D

@cure53 cure53 closed this as completed Oct 22, 2019
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

3 participants