File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/test/java/org/owasp/html Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -800,6 +800,19 @@ public static final void testLinkRelsWhenRelPresent() {
800
800
));
801
801
}
802
802
803
+ @ Test
804
+ public static final void testRelLinksWhenRelisPartOfData () {
805
+ PolicyFactory pf = new HtmlPolicyBuilder ()
806
+ .allowElements ("a" )
807
+ .allowAttributes ("href" ).onElements ("a" )
808
+ .allowAttributes ("rel" ).onElements ("a" )
809
+ .allowAttributes ("target" ).onElements ("a" )
810
+ .allowStandardUrlProtocols ()
811
+ .toFactory ();
812
+ String toSanitize = "<a target=\" _blank\" rel=\" noopener noreferrer\" href=\" https://google.com\" >test</a>" ;
813
+ assertTrue ("Failure in testRelLinksWhenRelisPartOfData" , pf .sanitize (toSanitize ).equals (toSanitize ));
814
+ }
815
+
803
816
@ Test
804
817
public static final void testFailFastOnSpaceSeparatedStrings () {
805
818
boolean failed ;
You can’t perform that action at this time.
0 commit comments