Skip to content

Commit

Permalink
For increased security, in the field xml editor do not resolve entiti…
Browse files Browse the repository at this point in the history
…es, and remove processing instructions.

See plone/Products.CMFPlone#3209
  • Loading branch information
mauritsvanrees committed Nov 16, 2020
1 parent 5585125 commit 261ea80
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 src/collective/easyform/browser/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,13 @@ def __call__(self):

source = self.request.form.get("source")
if source:
# 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)
# Is it valid XML?
try:
root = etree.fromstring(source)
root = etree.fromstring(source, parser=parser)
except etree.XMLSyntaxError as e:
return dumps(
{
Expand Down

0 comments on commit 261ea80

Please sign in to comment.