Skip to content

Commit 52be8fa

Browse files
JLLeitschuhTeamModernegnodet
authored
[MPLUGIN-453] Fix Temporary File Information Disclosure (#176)
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]> Bug-tracker: JLLeitschuh/security-research#18 Co-authored-by: Moderne <[email protected]> Co-authored-by: Guillaume Nodet <[email protected]>
1 parent ce49816 commit 52be8fa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.Reader;
2727
import java.net.URISyntaxException;
2828
import java.net.URL;
29+
import java.nio.file.Files;
2930
import java.nio.file.Paths;
3031
import java.util.ArrayList;
3132
import java.util.Collections;
@@ -140,7 +141,7 @@ private List<String> run(String pluginXml)
140141

141142
File pluginXmlFile = Paths.get(resource.toURI()).toFile();
142143

143-
File jarFile = File.createTempFile("AntMojoWrapperTest.", ".test.jar");
144+
File jarFile = Files.createTempFile("AntMojoWrapperTest.", ".test.jar").toFile();
144145
jarFile.deleteOnExit();
145146

146147
JarArchiver archiver = new JarArchiver();

0 commit comments

Comments
 (0)