Skip to content

Commit

Permalink
prevents injection of malicious doc types
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 28, 2012
1 parent 26d68e4 commit 4ff9294
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Loader/XmlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ protected function loadFile($file)

libxml_use_internal_errors($internalErrors);

foreach ($dom->childNodes as $child) {
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
throw new \InvalidArgumentException('Document types are not allowed.');
}
}

$this->validate($dom);

return $dom;
Expand Down

0 comments on commit 4ff9294

Please # to comment.