Skip to content

Commit

Permalink
Merge pull request #153 from Geta/disable-dtd-processing-for-xml-import
Browse files Browse the repository at this point in the history
Disable DTD processing for XML parser
  • Loading branch information
jevgenijsp authored Dec 9, 2024
2 parents a80cc6d + a2e7987 commit b113e3e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Geta.NotFoundHandler/Core/Redirects/RedirectsXmlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@ public RedirectsXmlParser(ILogger<RedirectsXmlParser> logger)
public CustomRedirectCollection LoadFromStream(Stream xmlContent)
{
_customRedirectsXmlFile = new XmlDocument();

if (xmlContent != null)
{
_customRedirectsXmlFile.Load(xmlContent);
var settings = new XmlReaderSettings
{
DtdProcessing = DtdProcessing.Prohibit,
XmlResolver = null
};

using var reader = XmlReader.Create(xmlContent, settings);
_customRedirectsXmlFile.Load(reader);
}
else
{
Expand Down

0 comments on commit b113e3e

Please sign in to comment.