I am trying to run Microsoft Rdp application from code.
I have the following pseudo-code and SonarQube
complains about Command Injection Vulnerability
String rdpFilePath = myObject.getRdpFilePath() // get path of .rdp settings file
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("mstsc", rdpFilePath).start();
SonarQube Issue explanation is following:
-Potential Command Injection-
The highlighted API is used to execute a system command.
If unfiltered input is passed to this API, it can lead to arbitrary command execution.
How can filter my input and how can i fix this security issue?