-
-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support whitelist for xml document types #183
Support whitelist for xml document types #183
Conversation
@schmittjoh should I pull your automatic review ? |
Ho, and I forgot to update two old tests too... |
@michelsalib most of the automatic changes are right. I'm not sure about the one modifying the call to |
Thanks @stof, I will update tomorrow |
@@ -67,7 +68,13 @@ public function prepare($data) | |||
$dom->loadXML($data); | |||
foreach ($dom->childNodes as $child) { | |||
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { | |||
throw new \InvalidArgumentException('Document types are not allowed.'); | |||
$internalSubset = str_replace(PHP_EOL, '', $child->internalSubset); | |||
if (!in_array($internalSubset, $this->documentWhitelist)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add true
as third arg here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure !
@schmittjoh I wanted to have your feedback about the configuration part that I added. Especially about namings. |
<visitors> | ||
<xml> | ||
<document_whitelist> | ||
<!DOCTYPE authorized SYSTEM "http://some_url"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely, actually I never used xml configuration in such a way, do you know how it should look like?
@schmittjoh Done ! |
Support whitelist for xml document types
Thanks, merged! |
You are very welcome ;) |
As discussed here (5a9b7e6), here is a proposal for a whitelist support concerning xml deserialization with document types.
I updated the doc to give an example: