SECURITY: Don't allow directly calling Xml::isWellFormed
authorcsteipp <csteipp@wikimedia.org>
Fri, 13 Mar 2015 23:52:18 +0000 (16:52 -0700)
committercsteipp <csteipp@wikimedia.org>
Wed, 1 Apr 2015 16:56:29 +0000 (09:56 -0700)
Changing Xml::isWellFormed to private. In WMF hosted repos, there are
no callers to isWellFormed directly.

Bug: T85848
Change-Id: I104427989b89c386de571b8e60642095331a1132

includes/Xml.php

index 78b8715..f0bd70b 100644 (file)
@@ -703,13 +703,15 @@ class Xml {
        /**
         * Check if a string is well-formed XML.
         * Must include the surrounding tag.
+        * This function is a DoS vector if an attacker can define
+        * entities in $text.
         *
         * @param string $text String to test.
         * @return bool
         *
         * @todo Error position reporting return
         */
-       public static function isWellFormed( $text ) {
+       private static function isWellFormed( $text ) {
                $parser = xml_parser_create( "UTF-8" );
 
                # case folding violates XML standard, turn it off