Skip to content

Commit ac2b66f

Browse files
vuln-fix: Temporary File Information Disclosure
This fixes temporary file information disclosure vulnerability due to the use of the vulnerable `File.createTempFile()` method. The vulnerability is fixed by using the `Files.createTempFile()` method which sets the correct posix permissions. Weakness: CWE-377: Insecure Temporary File Severity: Medium CVSSS: 5.5 Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.SecureTempFileCreation) Reported-by: Jonathan Leitschuh <[email protected]> Signed-off-by: Jonathan Leitschuh <[email protected]> Bug-tracker: JLLeitschuh/security-research#18 Co-authored-by: Moderne <[email protected]>
1 parent a88914c commit ac2b66f

File tree

1 file changed

+2
-1
lines changed
  • joyqueue-common/joyqueue-toolkit/src/test/java/org/joyqueue/toolkit/os

1 file changed

+2
-1
lines changed

joyqueue-common/joyqueue-toolkit/src/test/java/org/joyqueue/toolkit/os/SystemsTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.File;
2424
import java.io.IOException;
25+
import java.nio.file.Files;
2526

2627
/**
2728
* Created by hexiaofeng on 16-7-4.
@@ -32,7 +33,7 @@ public class SystemsTest {
3233
public void testGetCores() throws IOException {
3334
System.out.println(Systems.getCores());
3435
Systems.JDOS1CoresDetector.ETC_CONFIG_INFO = "";
35-
File file = File.createTempFile("config_info", "");
36+
File file = Files.createTempFile("config_info", "").toFile();
3637
Files.write(file,
3738
"{\"Config\": {\"Cpuset\": \"1,2\", \"Memory\": 4294967296}, \"host_ip\": \"10.8.65" + ".251\"}");
3839
String config = Systems.JDOS1CoresDetector.ETC_CONFIG_INFO;

0 commit comments

Comments
 (0)