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
30
30
{
31
31
if (trim ($ xml ) === '' ) {
32
32
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
+ );
33
37
} elseif (PHP_VERSION_ID < 80000 ) {
34
38
$ entityLoader = libxml_disable_entity_loader (true );
39
+ } else {
40
+ libxml_set_external_entity_loader (null );
35
41
}
36
42
37
43
$ internalErrors = libxml_use_internal_errors (true );
38
44
libxml_clear_errors ();
39
45
40
46
$ domDocument = self ::create ();
41
- $ options = LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NONET | LIBXML_PARSEHUGE ;
47
+ $ options = LIBXML_NONET | LIBXML_PARSEHUGE ;
48
+
42
49
if (defined ('LIBXML_COMPACT ' )) {
43
50
$ options |= LIBXML_COMPACT ;
44
51
}
You can’t perform that action at this time.
0 commit comments