Skip to content

Commit b72ec2b

Browse files
committed
Add suppression as we do command verifications
1 parent 2bd2c7b commit b72ec2b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/org/owasp/wrongsecrets/challenges/docker/binaryexecution/BinaryExecutionHelper.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ private String executeCommand(
133133
new BufferedReader(new InputStreamReader(pr.getInputStream(), StandardCharsets.UTF_8))) {
134134
String result = in.readLine();
135135
pr.waitFor();
136-
if (!execFile.delete()) {
137-
log.info("we were not able to cleanup {}", execFile.getPath());
138-
}
139-
140136
return result;
141137
}
142138
}
@@ -243,8 +239,18 @@ private File createTempExecutable(String fileName) throws IOException {
243239
return execFile;
244240
}
245241

242+
@SuppressFBWarnings(
243+
value = "COMMAND_INJECTION",
244+
justification = "We check for various injection methods and counter those")
246245
private static void xattrMacOSExecFile(File execFile) {
247246
try {
247+
if (!(execFile != null
248+
&& execFile.exists()
249+
&& !Strings.isNullOrEmpty(execFile.getPath())
250+
&& execFile.getPath().contains("wrongsecrets"))) {
251+
log.info("The execfile is not properly setup, returning");
252+
return;
253+
}
248254
ProcessBuilder ps =
249255
new ProcessBuilder("/usr/bin/xattr", "-d", "com.apple.quarantine", execFile.getPath());
250256
ps.redirectErrorStream(true);

0 commit comments

Comments
 (0)