Skip to content

Commit

Permalink
[MGPG-100] vuln-fix: Temporary File Information Disclosure
Browse files Browse the repository at this point in the history
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]>

Closes: #30
  • Loading branch information
JLLeitschuh authored and slachiewicz committed Aug 15, 2023
1 parent f7d21a7 commit 0bb6754
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -489,7 +490,7 @@ private File generatePomFile() throws MojoExecutionException {
Model model = generateModel();

try {
File tempFile = File.createTempFile("mvndeploy", ".pom");
File tempFile = Files.createTempFile("mvndeploy", ".pom").toFile();
tempFile.deleteOnExit();

try (Writer fw = WriterFactory.newXmlWriter(tempFile)) {
Expand Down

0 comments on commit 0bb6754

Please sign in to comment.