An XML reader or document is given an XmlUrlResolver, which lets the input load external files and URLs

tx0/csharp:xml-resolver-enabledrecommendedwarningsecurity/injectiondepth fastsecurity, cwe-611

What it finds

With a resolver, external entities and DTDs in an XML document are fetched: a document can read local files into its content or make the server request internal URLs. Setting XmlResolver to null turns this off. The rule reports assignments of a new XmlUrlResolver or XmlSecureResolver to an XmlResolver property.

From the rule's source, xml_resolver_enabled.rs.

Example from the rule's tests
using System.Xml; class Reader{    void Load(string text)    {        var doc = new XmlDocument();        doc.XmlResolver = new XmlUrlResolver();tx0 reports: an XmlUrlResolver lets the document load external resources        doc.LoadXml(text);        var safe = new XmlDocument();        safe.XmlResolver = null;    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:xml-resolver-enabled" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:xml-resolver-enabled] reason="..."

tx0 explain tx0/csharp:xml-resolver-enabled shows the same in the terminal. Found a false positive? Report it.