Uploaded image for project: 'Chemistry (Retired)'
  1. Chemistry (Retired)
  2. CMIS-1118

Xml Parsing/DTD Exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • PortCMIS 0.3.0
    • None
    • portcmis
    • None

    Description

      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

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            dgro_asf_jira D Groß
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: