Skip to content

Commit

Permalink
Prevent XXE in SPController
Browse files Browse the repository at this point in the history
By disabling the entity loader, we prevent possible XXE exploitations.
After disabling the loader, the previous state is reset.
  • Loading branch information
MKodde committed Jan 21, 2019
1 parent 87cdb45 commit dd11c2d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/SpBundle/Controller/SPController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ public function assertionConsumerServiceAction(Request $request)
*/
private function toFormattedXml($xml)
{
$previous = libxml_disable_entity_loader(true);
$domxml = new DOMDocument('1.0');
$domxml->preserveWhiteSpace = false;
$domxml->formatOutput = true;
$domxml->loadXML($xml);
libxml_disable_entity_loader($previous);

return $domxml->saveXML();
}
Expand Down

0 comments on commit dd11c2d

Please sign in to comment.