File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
.extlib/simplesamlphp/vendor/simplesamlphp/saml2/src/SAML2 Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,22 @@ public static function fromString(string $xml) : DOMDocument
3030 {
3131 if (trim ($ xml ) === '' ) {
3232 throw InvalidArgumentException::invalidType ('non-empty string ' , $ xml );
33+ } elseif (preg_match ('/<(\s*)!(\s*)DOCTYPE/ ' , $ xml )) {
34+ throw new RuntimeException (
35+ 'Dangerous XML detected, DOCTYPE nodes are not allowed in the XML body '
36+ );
3337 } elseif (PHP_VERSION_ID < 80000 ) {
3438 $ entityLoader = libxml_disable_entity_loader (true );
39+ } else {
40+ libxml_set_external_entity_loader (null );
3541 }
3642
3743 $ internalErrors = libxml_use_internal_errors (true );
3844 libxml_clear_errors ();
3945
4046 $ domDocument = self ::create ();
41- $ options = LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NONET | LIBXML_PARSEHUGE ;
47+ $ options = LIBXML_NONET | LIBXML_PARSEHUGE ;
48+
4249 if (defined ('LIBXML_COMPACT ' )) {
4350 $ options |= LIBXML_COMPACT ;
4451 }
You can’t perform that action at this time.
0 commit comments