diff --git a/pom.xml b/pom.xml index f4681e31..695d892c 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ org.apache.logging.log4j log4j-core - 2.14.1 + 2.15.0 diff --git a/src/main/java/CommandInjection.java b/src/main/java/CommandInjection.java new file mode 100644 index 00000000..26162af8 --- /dev/null +++ b/src/main/java/CommandInjection.java @@ -0,0 +1,13 @@ +// https://documentation.blackduck.com/bundle/coverity-docs/page/checker-ref/checkers/NO/os_cmd_injection.html + +import java.io.*; +import javax.servlet.http.HttpServletRequest; + +public class CommandInjection { + public static Process runCmd(HttpServletRequest request) throws IOException { + String filename = request.getParameter("filename"); + ProcessBuilder builder = new ProcessBuilder("cat", filename); + Process process = builder.start(); + return(process); + } +}