-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
fixedAn {bug|improvement} that has been {fixed|implemented}An {bug|improvement} that has been {fixed|implemented}
Milestone
Description
I have been using the Cleaner since v1.16.1 to sanitize SVG by removing script.
After upgrading from v1.19.1 to v1.20.1, the behavior has changed and the text of the script is no longer removed.
A simplified example would be:
String dirtyString = "<svg><script>alert(\"test\")</script></svg>";
Document dirty = Parser.parse(dirtyString, "");
Safelist safelist = new Safelist().addTags("svg");
Cleaner cleaner = new Cleaner(safelist);
Document clean = cleaner.clean(dirty);
Document.OutputSettings outputSettings = new Document.OutputSettings().syntax(Document.OutputSettings.Syntax.xml);
String cleanString = clean.outputSettings(outputSettings).body().html();
With all versions from v1.16.1 through v1.19.1, this results in <svg></svg>
with all the script removed.
But with v1.20.1, it now results in <svg>alert("test")</svg>
.
Metadata
Metadata
Assignees
Labels
fixedAn {bug|improvement} that has been {fixed|implemented}An {bug|improvement} that has been {fixed|implemented}