JavaScriptSerializer is given a SimpleTypeResolver, which lets the input choose types

tx0/csharp:unsafe-type-resolverdefaultwarningsecurity/deserializationdepth fastsecurity, cwe-502

What it finds

With a SimpleTypeResolver, JavaScriptSerializer creates the types named in the __type fields of the JSON it reads, so untrusted input decides which code runs while it is deserialized.

From the rule's source, unsafe_type_resolver.rs.

Example from the rule's tests
using System.Web.Script.Serialization; class Json{    object Read(string text)    {        var serializer = new JavaScriptSerializer(new SimpleTypeResolver());tx0 reports: SimpleTypeResolver lets the JSON choose the types that are created        return serializer.DeserializeObject(text);    }}
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 in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:unsafe-type-resolver" = "off"

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:unsafe-type-resolver] reason="..."

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