JAVA-036 / Beginner
OS command injection (Runtime.exec string concatenation)
Why is this a problem?
; rm -rf / is executed.
How to fix it
java
// Argument array, no shell, input allowlist
if (!host.matches("^[A-Za-z0-9.-]{1,253}$")) throw new IllegalArgumentException();
new ProcessBuilder("ping", "-c", "1", host).start();