An assembly is loaded from a file path, which runs whatever code is at that path

tx0/csharp:assembly-loaded-from-pathstrictwarningsecurity/configurationdepth fastsecurity, cwe-829

What it finds

Assembly.LoadFrom, LoadFile and UnsafeLoadFrom load and later run code from a file. If the path or the directory can be influenced by someone else, so can the code. Plugin hosts are the deliberate use and can suppress the finding.

From the rule's source, assembly_loaded_from_path.rs.

Example from the rule's tests
using System.Reflection; class Plugins{    Assembly Load(string path) => Assembly.LoadFrom(path);tx0 reports: Assembly.LoadFrom loads code from a file path}
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 strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:assembly-loaded-from-path" = "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:assembly-loaded-from-path] reason="..."

tx0 explain tx0/csharp:assembly-loaded-from-path shows the same in the terminal. Found a false positive? Report it.