Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Commit ab89a62

Browse files
vuln-fix: Temporary Directory Hijacking or Information Disclosure
This fixes either Temporary Directory Hijacking, or Temporary Directory Local Information Disclosure. Weakness: CWE-379: Creation of Temporary File in Directory with Insecure Permissions Severity: High CVSSS: 7.3 Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.UseFilesCreateTempDirectory) Reported-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> Bug-tracker: JLLeitschuh/security-research#10 Co-authored-by: Moderne <team@moderne.io>
1 parent 0b1a24c commit ab89a62

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/test/java/org/appverse/builder/web/rest/BuildRequestResourceIntTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.io.File;
4444
import java.io.FileWriter;
4545
import java.io.IOException;
46+
import java.nio.file.Files;
4647
import java.time.Instant;
4748
import java.time.ZoneId;
4849
import java.time.ZonedDateTime;
@@ -153,9 +154,7 @@ public void setup() {
153154
public void initTest() throws IOException {
154155

155156
//Setup distribution channel
156-
tempDistributionChannelRoot = File.createTempFile("temp", Long.toString(System.nanoTime()));
157-
tempDistributionChannelRoot.delete();
158-
tempDistributionChannelRoot.mkdir();
157+
tempDistributionChannelRoot = Files.createTempDirectory("temp" + Long.toString(System.nanoTime())).toFile();
159158

160159

161160
DistributionChannel distributionChannel = new DistributionChannel();

0 commit comments

Comments
 (0)