Rule Definition
Using deprecated .Net API could lead to security compliancy issues.
Remediation
Use XmlReader instead
Violation Code Sample
public class XMLHandler : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
XmlTextReader reader = new XmlTextReader(ctx.Request.QueryString["document"]);
...
}
}
Fixed Code Sample
public class XMLHandler : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
// GOOD: use XmlReader
XmlReader reader = XmlReader.create(ctx.Request.QueryString["document"]);
...
}
}
Reference
https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmltextreader?view=netframework-4.7.2
Related Technologies
Technical Criterion
CWE-477 - Use of Obsolete Function
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.