diff --git a/pom.xml b/pom.xml index a9ad8401..8bd71b30 100644 --- a/pom.xml +++ b/pom.xml @@ -72,9 +72,9 @@ - net.sourceforge.htmlunit + org.htmlunit neko-htmlunit - 2.70.0 + 3.1.0-SNAPSHOT org.apache.httpcomponents.client5 diff --git a/src/main/java/org/owasp/validator/html/scan/AntiSamyDOMScanner.java b/src/main/java/org/owasp/validator/html/scan/AntiSamyDOMScanner.java index 318f509b..5e1d924c 100644 --- a/src/main/java/org/owasp/validator/html/scan/AntiSamyDOMScanner.java +++ b/src/main/java/org/owasp/validator/html/scan/AntiSamyDOMScanner.java @@ -32,8 +32,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.sourceforge.htmlunit.cyberneko.parsers.DOMFragmentParser; -import net.sourceforge.htmlunit.xerces.dom.DocumentImpl; +import org.htmlunit.cyberneko.parsers.DOMFragmentParser; +import org.htmlunit.cyberneko.xerces.dom.DocumentImpl; import org.apache.batik.css.parser.ParseException; import org.owasp.validator.css.CssScanner; import org.owasp.validator.html.CleanResults; @@ -223,13 +223,6 @@ static DOMFragmentParser getDomParser() parser.setFeature("http://cyberneko.org/html/features/scanner/style/strip-cdata-delims", false); parser.setFeature("http://cyberneko.org/html/features/scanner/cdata-sections", true); - - try { - parser.setFeature("http://cyberneko.org/html/features/enforce-strict-attribute-names", true); - } catch (SAXNotRecognizedException se) { - // this indicates that the patched nekohtml is not on the - // classpath - } return parser; } diff --git a/src/main/java/org/owasp/validator/html/scan/AntiSamySAXScanner.java b/src/main/java/org/owasp/validator/html/scan/AntiSamySAXScanner.java index 65cbe469..374f1e16 100644 --- a/src/main/java/org/owasp/validator/html/scan/AntiSamySAXScanner.java +++ b/src/main/java/org/owasp/validator/html/scan/AntiSamySAXScanner.java @@ -39,7 +39,7 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; -import net.sourceforge.htmlunit.cyberneko.parsers.SAXParser; +import org.htmlunit.cyberneko.parsers.SAXParser; import org.owasp.validator.html.CleanResults; import org.owasp.validator.html.Policy; import org.owasp.validator.html.ScanException; @@ -267,8 +267,6 @@ private static SAXParser getParser() { parser.setFeature("http://xml.org/sax/features/namespaces", false); parser.setFeature("http://cyberneko.org/html/features/balance-tags/document-fragment", true); parser.setFeature("http://cyberneko.org/html/features/scanner/cdata-sections", true); - parser.setFeature("http://apache.org/xml/features/scanner/notify-char-refs", true); - parser.setFeature("http://apache.org/xml/features/scanner/notify-builtin-refs", true); parser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower"); return parser; diff --git a/src/main/java/org/owasp/validator/html/scan/MagicSAXFilter.java b/src/main/java/org/owasp/validator/html/scan/MagicSAXFilter.java index 8966b46f..3fd9028c 100644 --- a/src/main/java/org/owasp/validator/html/scan/MagicSAXFilter.java +++ b/src/main/java/org/owasp/validator/html/scan/MagicSAXFilter.java @@ -26,16 +26,15 @@ import java.util.*; import java.util.regex.Pattern; -import net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter; -import net.sourceforge.htmlunit.xerces.util.AugmentationsImpl; -import net.sourceforge.htmlunit.xerces.util.XMLAttributesImpl; -import net.sourceforge.htmlunit.xerces.util.XMLStringBuffer; -import net.sourceforge.htmlunit.xerces.xni.Augmentations; -import net.sourceforge.htmlunit.xerces.xni.QName; -import net.sourceforge.htmlunit.xerces.xni.XMLAttributes; -import net.sourceforge.htmlunit.xerces.xni.XMLString; -import net.sourceforge.htmlunit.xerces.xni.XNIException; -import net.sourceforge.htmlunit.xerces.xni.parser.XMLDocumentFilter; +import org.htmlunit.cyberneko.filters.DefaultFilter; +import org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl; +import org.htmlunit.cyberneko.xerces.util.XMLStringBuffer; +import org.htmlunit.cyberneko.xerces.xni.Augmentations; +import org.htmlunit.cyberneko.xerces.xni.QName; +import org.htmlunit.cyberneko.xerces.xni.XMLAttributes; +import org.htmlunit.cyberneko.xerces.xni.XMLString; +import org.htmlunit.cyberneko.xerces.xni.XNIException; +import org.htmlunit.cyberneko.xerces.xni.parser.XMLDocumentFilter; import org.owasp.validator.css.CssScanner; import org.owasp.validator.html.CleanResults; import org.owasp.validator.html.InternalPolicy; @@ -191,9 +190,9 @@ public void endElement(QName element, Augmentations augs) throws XNIException { // "text/css"); // start the CSS element - super.startElement(element, cssAttributes, new AugmentationsImpl()); + super.startElement(element, cssAttributes, augs); // send the cleaned content - super.characters(new XMLStringBuffer(results.getCleanHTML()), new AugmentationsImpl()); + super.characters(new XMLStringBuffer(results.getCleanHTML()), augs); // end the CSS element super.endElement(element, augs); }