-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Description
if user input sting is:
<body>aaa bbb<a href=\"javascript:alert(1)\">test1</a></body>
policy defined as this:
PolicyFactory LINKS_RAW = (new HtmlPolicyBuilder()).allowElements("a").allowStandardUrlProtocols().allowAttributes("href","target").onElements("a").toFactory()
when check the "a" tag attribute href, StandardUrlAttributePolicy will be used to the the href value, this method: apply(String elementName, String attributeName, String value) will be called, but since there is '#' in the value, so it skipped the protocol check, and finally return the input href value, so even the value which not contain any protocol in "HTTP, https, mailto" , will not be filtered.
is this a bug?
Metadata
Metadata
Assignees
Labels
No labels