I need to call a custom script via command line, the scripts takes few arguments and is called on Linux machine. Current version is prone to all kinds of shell injection, how to sanitize arguments given by user? Arguments include login and path (Unix or Windows path) and user should be able to type in any possible path (the path refers to remote path on user server).
The code right now simply looks like this:
Process process = Runtime.getRuntime().exec("myscript " + login + " " + path);