A shell command is built from strings with values in them

tx0/kotlin:command-built-from-stringsrecommendedwarningsecurity/injectiondepth fastsecurity, cwe-78

What it finds

Runtime.getRuntime().exec("convert $input out.png") or ProcessBuilder("sh", "-c", "rm $path") lets a value with spaces, quotes or ; change the command, so a crafted file name runs other programs. Passing the program and each argument separately, without a shell, keeps values as arguments.

From the rule's source, command_from_strings.rs.

Example from the rule's tests
fun convert(input: String) {    Runtime.getRuntime().exec("convert $input out.png")tx0 reports: the command is built from strings    Runtime.getRuntime().exec(arrayOf("convert", input, "out.png"))    ProcessBuilder("sh", "-c", "rm " + input).start()tx0 reports: the command is built from strings    ProcessBuilder("rm", input).start()}
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/kotlin:command-built-from-strings" = "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/kotlin:command-built-from-strings] reason="..."

tx0 explain tx0/kotlin:command-built-from-strings shows the same in the terminal. Found a false positive? Report it.