You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "D Groß (Jira)" <ji...@apache.org> on 2021/06/18 17:09:00 UTC

[jira] [Created] (CMIS-1118) Xml Parsing/DTD Exception

D Groß created CMIS-1118:
----------------------------

             Summary: Xml Parsing/DTD Exception
                 Key: CMIS-1118
                 URL: https://issues.apache.org/jira/browse/CMIS-1118
             Project: Chemistry
          Issue Type: Bug
          Components: portcmis
    Affects Versions: PortCMIS 0.3.0
            Reporter: D Groß


Hi,

I think the issue that I am experiencing is similar to a previously fixed DotCMIS issue that was submitted (https://issues.apache.org/jira/browse/CMIS-902).

 

I am running a .Net Core 3.1 project with PortCMIS and I am receiving a Xml parsing exception ("For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method") when I attempt to consume a CMIS endpoint via the AtomPub binding.

 

Stack Trace:

at PortCMIS.Binding.AtomPub.AbstractAtomPubService.Parse[T](Stream stream)
 at PortCMIS.Binding.AtomPub.AbstractAtomPubService.GetRepositoriesInternal(String repositoryId)
 at PortCMIS.Binding.AtomPub.RepositoryService.GetRepositoryInfo(String repositoryId, IExtensionsData extension)
 at PortCMIS.Binding.Impl.BindingRepositoryService.GetRepositoryInfo(String repositoryId, IExtensionsData extension)
 at PortCMIS.Client.Impl.Session.Connect()
 at PortCMIS.Client.Impl.SessionFactory.CreateSession(IDictionary`2 parameters, IObjectFactory objectFactory, IAuthenticationProvider authenticationProvider, ICache cache

 

Inner Exception Details:

For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method."} System.Exception \{System.Xml.XmlException}

StackTrace: 
 at System.Xml.XmlTextReaderImpl.Throw(Exception e)
 at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
 at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
 at System.Xml.XmlTextReaderImpl.Read()
 at PortCMIS.Binding.AtomPub.AtomPubParser.Parse()
 at PortCMIS.Binding.AtomPub.AbstractAtomPubService.Parse[T](Stream stream)

 

I think an easy fix to this problem would be to add  "DtdProcessing = DtdProcessing.Ignore" to the XmlUtils.CreateParser 's XmlReaderSettings initialization list.

SRC: [https://svn.apache.org/repos/asf/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs]

FROM:

XmlReaderSettings settings = new XmlReaderSettings()
 {
    MaxCharactersInDocument = 0,
    CloseInput = true
 };

 

TO:

XmlReaderSettings settings = new XmlReaderSettings()
 {
    MaxCharactersInDocument = 0,
    CloseInput = true,
    DtdProcessing = DtdProcessing.Ignore
 };

Thanks

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)