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

PolicyFactory Sanitize method weird output #318

Open
GoogleCodeExporter opened this issue May 5, 2015 · 1 comment
Open

PolicyFactory Sanitize method weird output #318

GoogleCodeExporter opened this issue May 5, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. Create PolicyFactory with all added sanitizers 
(Formatting/Images/Links/Styles/Blocks)
2. Pass "<b><h1>text</h1></b>" to the PolicyFactory.sanitize(String html)
3. Result returned is "<b></b><b><h1>text</h1></b>"

What is the expected output? What do you see instead?

-Expected "<b><h1>text</h1></b>" 
-Received "<b></b><b><h1>text</h1></b>"

What version of the product are you using? On what operating system?

-Windows 7 64-bit
-Maven dependency:
 <dependency>
     <groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
     <artifactId>owasp-java-html-sanitizer</artifactId>
     <version>r209</version>
 </dependency>

Does this issue affect only a specified browser or set of browsers?

-This is browser unrelated, testing simply through JUnit tests

Please provide any additional information below.

I am currently using this method in a loop and exiting the loop when the string 
has been fully sanitized based on the idea that it will be sanitized when the 
previous sanitization result will equal the current sanitization result. 
Unfortunately, with this issue, on some inputs the sanitize method does not 
stop adding tags resulting in an infinite loop because the previous 
sanitization of the string will never equal the current sanitization of the 
string.

Original issue reported on code.google.com by [email protected] on 7 Feb 2014 at 7:39

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

No branches or pull requests

1 participant