Prerequisites
Description
he Ecore parser creates an XmlReaderSettings with defaults and loads the document into an XmlDocument. DTD processing and external-entity resolution are not disabled, leaving the library open to XML External Entity (XXE) attacks and entity-expansion DoS when parsing untrusted .ecore files.
-
Affected files: ECoreNetto/ECoreParser.cs:84-91
-
Proposed solution: Configure the reader settings before creating the reader:
var settings = new XmlReaderSettings
{
DtdProcessing = DtdProcessing.Prohibit,
XmlResolver = null
};
Also set XmlResolver = null on the XmlDocument instance. Add a regression test that feeds a document with an external entity and asserts it does not resolve.
-
Acceptance criteria:
Prerequisites
Description
he Ecore parser creates an
XmlReaderSettingswith defaults and loads the document into anXmlDocument. DTD processing and external-entity resolution are not disabled, leaving the library open to XML External Entity (XXE) attacks and entity-expansion DoS when parsing untrusted.ecorefiles.Affected files:
ECoreNetto/ECoreParser.cs:84-91Proposed solution: Configure the reader settings before creating the reader:
Also set
XmlResolver = nullon theXmlDocumentinstance. Add a regression test that feeds a document with an external entity and asserts it does not resolve.Acceptance criteria:
DtdProcessingis set toProhibit(orIgnore) andXmlResolverisnullon both the reader settings and theXmlDocument.ecore,recipe,wizardEcore) still parse.