Replace Runtime.exec(String) with Runtime.exec(String[])

Proprietary

Rewrites Runtime.exec("cmd args " + arg) calls into the safer Runtime.exec(new String[]{...}) overload that bypasses shell interpretation. Fires only when the first argument is a string concatenation, the first operand is a string literal containing whitespace, and no literal contains shell metacharacters (|, <, >, &, ;, backtick, $, newline). Calls with no literal prefix, with single-token literals, or with shell metacharacters are left for human review.

org.openrewrite.java.security.FixCommandInjectionLiteral
mod run . --recipe=org.openrewrite.java.security.FixCommandInjectionLiteral

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.