Question
Issue while executing shell script using custom pega function
As part of our application, we are trying execute shell script using file listener activity with the help of java step, where we are using below java code. But is it giving an error as Java code injection pattern identified in the java source code. Vulnerable code detected. even we have tried to change java code as mentioned in How can I execute a shell script from Pega? | Support Center, but still it is giving same error. We have tried to replace java step with function. but is it giving runtime error. Also we have referred to https://docs-previous.pega.com/security/87/configuring-java-injection-check. But there is still the same issue. Please let us know how we can solve this issue
try { java.lang.Process process = Runtime.getRuntime().exec(ShellPath + " " + FileName + " " + Pega_WorkFileName);
ResultExitValue = process.waitFor();
if(ResultExitValue != 0) throw new java.io.IOException("Something went wrong.. " + ShellPath + " " + FileName + " " + Pega_WorkFileName);
} catch (java.io.IOException ioEx) { oLog.error("error executiong file ", ioEx); } catch (java.lang.InterruptedException inEx) { oLog.error("error executiong file ", inEx); }