How to disable External Entity Resolution in xerces C++ DOMLSParser

918 views Asked by At

We are using Xerces C++ DOMLSParser. I want to disable External Entities but could not find anything for DOMLSParser.

How to disable Loading External Entities to prevent XXE attacks?

1

There are 1 answers

0
Arne Luenser On
xercesc::DOMImplementation* impl = xercesc::DOMImplementationRegistry::getDOMImplementation (u"LS");
xercesc::DOMLSParser* parser = impl->createLSParser(xercesc::DOMImplementationLS::MODE_SYNCHRONOUS, nullptr);
xercesc::DOMConfiguration* conf = parser->getDomConfig();
conf->setParameter(xercesc::XMLUni::fgDOMEntities, false);

Documentation: https://xerces.apache.org/xerces-c/program-dom-3.html (search for fgDOMEntities)