diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 73510ae24d6eed83439d0712726f95d0e6801698..49a41e974d2377187f328e96bb07afa155572f7d 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -1406,6 +1406,14 @@ class SimpleSAML_Metadata_SAMLParser { $entityDescriptor = $element->parentNode; assert('$entityDescriptor instanceof DOMElement'); + /* + * Make a copy of the entity descriptor, so that the validator can + * change the DOM tree in any way it wants. + */ + $doc = new DOMDocument(); + $entityDescriptor = $doc->importNode($entityDescriptor, TRUE); + $doc->appendChild($entityDescriptor); + /* Attempt to check the signature. */ try { $validator = new SimpleSAML_XML_Validator($entityDescriptor, 'ID');