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

Antisamy truncates whole content when frame tag is used in the input and configured frame tag to be removed. #12

Closed
sunnypav opened this issue Jul 31, 2017 · 1 comment
Assignees

Comments

@sunnypav
Copy link

sunnypav commented Jul 31, 2017

When using antisamy with the attached file where the following tag rule is defined

and providing the input remove

should not be removed
giving the output as empty string instead of
should not be removed
.

sample code below:

Policy policy = Policy.getInstance("C:\\antisamy-basic.xml");
AntiSamy antisamy = new AntiSamy(policy);
CleanResults cleanResults = antisamy.scan("<frame>remove</frame><div>should not be removed</div>");
System.out.println(cleanResults.getCleanHTML());

We are using antisamy version 1.5.5
antisamy-basic.zip

@nahsra nahsra added the bug label Sep 25, 2017
@nahsra nahsra self-assigned this Sep 25, 2017
@nahsra
Copy link
Owner

nahsra commented Sep 25, 2017

This only occurs if there is no parent tag. For instance, if you wrapped a parent

around these, it would behave according to your expectations.

Unfortunately, achieving your expected behavior for this document fragment would require changing the upstream parser code. As part of the deserialization/parsing code, the scanner adds a parent element above the . Since is not allowed, it and its child nodes are removed.

Given that, and the fact that this in almost all scenarios not a degradation of legitimate input (who's really allowed to introduce frames?), I think we have to close this as WontFix.

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

3 participants