Skip to content

Commit

Permalink
For increased security, in the modeleditor do not resolve entities, a…
Browse files Browse the repository at this point in the history
…nd remove processing instructions.

See plone/Products.CMFPlone#3209
  • Loading branch information
mauritsvanrees committed Nov 16, 2020
1 parent d22ccee commit b11b514
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/3209.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
For increased security, in the modeleditor do not resolve entities, and remove processing instructions.
[maurits]
6 changes: 5 additions & 1 deletion plone/app/dexterity/browser/modeleditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ def __call__(self):
source = self.request.form.get('source')
if source:
# Is it valid XML?
# Some safety measures.
# We do not want to load entities, especially file:/// entities.
# Also discard processing instructions.
parser = etree.XMLParser(resolve_entities=False, remove_pis=True)
try:
root = etree.fromstring(source)
root = etree.fromstring(source, parser=parser)
except etree.XMLSyntaxError as e:
return json.dumps({
'success': False,
Expand Down

0 comments on commit b11b514

Please sign in to comment.