Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentException: DTD is prohibited in this XML document #473

Closed
mikkelbu opened this issue Sep 24, 2018 · 4 comments
Closed

ArgumentException: DTD is prohibited in this XML document #473

mikkelbu opened this issue Sep 24, 2018 · 4 comments

Comments

@mikkelbu
Copy link
Member

@mnkjadhav commented on Thu Aug 10 2017

TestResult.zip

When run NUnit tests using nunit3-console.exe with transform option, I get below error

NUnit.Engine.NUnitEngineException: The path specified in --result junit-results. xml could not be written to ---> System.ArgumentException: Unable to load transform nunit3-junit.xslt ---> System.Xml.XmlException: 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.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Xsl.Xslt.XsltInput.ReadTextNodes()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltInput.FindStylesheetElement()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
--- End of inner exception stack trace ---
at NUnit.Engine.Services.XmlTransformResultWriter..ctor(Object[] args)
at NUnit.Engine.Services.ResultService.GetResultWriter(String format, Object[] args)
at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
--- End of inner exception stack trace ---
at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
at NUnit.ConsoleRunner.Program.Main(String[] args)


@hadanang commented on Tue Aug 28 2018

I also got this error:
NUnit.Engine.NUnitEngineException : Error encountered in resolving output specification: OutputPath: report.xml, Format: user, Transform: C:\NUnit.Console-3.8.0\nunit3-junit.xslt
----> System.ArgumentException : Unable to load transform C:\NUnit.Console-3.8.0\nunit3-junit.xslt
----> System.Xml.XmlException : 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.

--NUnitEngineException
at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
at NUnit.ConsoleRunner.Program.Main(String[] args)
--ArgumentException
at NUnit.Engine.Services.XmlTransformResultWriter..ctor(Object[] args)
at NUnit.Engine.Services.ResultService.GetResultWriter(String format, Object[] args)
at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
--XmlException
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Xsl.Xslt.XsltInput.ReadTextNodes()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltInput.FindStylesheetElement()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)


@jnm2 commented on Fri Aug 31 2018

@nunit/engine-team This looks like a console bug. Should we move it?


@ChrisMaddock commented on Fri Aug 31 2018

I agree - but don’t (yet) know enough the security implications to know what to do here.

Sorry - on my phone, or I’d move it now!


@jnm2 commented on Mon Sep 24 2018

@nunit/engine-team Does anyone have a tool that can move this issue?

@jnm2
Copy link
Collaborator

jnm2 commented Sep 24, 2018

Can we use DtdProcessing.Ignore?

@mikkelbu
Copy link
Member Author

Having read a little about DtdProcessing yesterday I'm fine with DtdProcessing.Ignore. I could also live with DtdProcessing.Parse as the users themself specify the transformation file.

Ps. The strange part is that nunit3-junit.xslt does not contain a DTD. The only way I could get a document with a DTD was to try to attempt to download the file like below, but that just downloads the homepage (and that contains a DTD). Sorry about the size, but GH tries to fill the entire width AFAICT.
image

@jnm2
Copy link
Collaborator

jnm2 commented Nov 23, 2018

Sorry about the size, but GH tries to fill the entire width AFAICT.

This has irritated me on many occasions. It actually doesn't fill the entire width if the number of pixels is less than the full width. What happens is that you're at something like 200% DPI and either no DPI info is encoded into the PNG or else the browser does not respect it.

@ChrisMaddock
Copy link
Member

Having read a little about DtdProcessing yesterday I'm fine with DtdProcessing.Ignore. I could also live with DtdProcessing.Parse as the users themself specify the transformation file.

@mikkelbu I know nothing about the specifics here, but trust your judgement. Want to PR this, and get this issue finished off? 😄

@mikkelbu mikkelbu self-assigned this Dec 26, 2018
mikkelbu added a commit to mikkelbu/nunit-console that referenced this issue Dec 26, 2018
mikkelbu added a commit to mikkelbu/nunit-console that referenced this issue Dec 26, 2018
ChrisMaddock pushed a commit that referenced this issue Dec 30, 2018
@ChrisMaddock ChrisMaddock added this to the 3.10 milestone Dec 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants