Skip to content

Commit

Permalink
Merge pull request centic9#86 from BulkSecurityGeneratorProjectV2/fix…
Browse files Browse the repository at this point in the history
…/JLL/temporary_directory_hijacking_or_temporary_directory_information_disclosure

[SECURITY] Fix Temporary Directory Hijacking or Information Disclosure Vulnerability
  • Loading branch information
centic9 authored Aug 9, 2022
2 parents 9ecaddc + 80ee406 commit b8cb29b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/main/java/org/dstadler/jgit/porcelain/CleanUntrackedFiles.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Set;

import org.apache.commons.io.FileUtils;
Expand All @@ -27,7 +28,6 @@
import org.eclipse.jgit.lib.Repository;



/**
* Simple snippet which shows how to list all Tags
*
Expand All @@ -43,13 +43,7 @@ public static void main(String[] args) throws IOException, GitAPIException {
System.out.println("Repository at " + repository.getWorkTree());

File untrackedFile = File.createTempFile("untracked", ".txt", repository.getWorkTree());
File untrackedDir = File.createTempFile("untrackedDir", "", repository.getWorkTree());
if(!untrackedDir.delete()) {
throw new IOException("Could not delete file " + untrackedDir);
}
if(!untrackedDir.mkdirs()) {
throw new IOException("Could not create directory " + untrackedDir);
}
File untrackedDir = Files.createTempDirectory(repository.getWorkTree().toPath(), "untrackedDir").toFile();

System.out.println("Untracked exists: " + untrackedFile.exists() + " Dir: " + untrackedDir.exists() + "/" + untrackedDir.isDirectory());

Expand Down

0 comments on commit b8cb29b

Please sign in to comment.