JSON input is allowed to name the Java class it is turned into

tx0/java:default-typing-enabledrecommendedwarningsecurity, cwe-502

What it finds

Jackson's default typing without a validator, switched on by enableDefaultTyping(), and @JsonTypeInfo(use = Id.CLASS) let the JSON name the class to create. A document can then name a class whose construction or setters do something harmful, a well-known way into many applications.

From the rule's source, default_typing_enabled.rs.

Example from the rule's tests
class Json {  void configure(com.fasterxml.jackson.databind.ObjectMapper mapper) {    mapper.enableDefaultTyping();tx0 reports: the JSON input decides which class is created  }}
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/java:default-typing-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/java:default-typing-enabled] reason="..."

tx0 explain tx0/java:default-typing-enabled shows the same in the terminal. Found a false positive? Report it.