Skip to content

Commit

Permalink
Try to make CodeQL Happy
Browse files Browse the repository at this point in the history
  • Loading branch information
leerho committed Oct 25, 2023
1 parent 1d37c12 commit 17db479
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/apache/datasketches/common/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,12 @@ private static File createTempFile(final String shortFileName) {
final File file;
try {
file = File.createTempFile("temp_" + name, suffix);

Check warning

Code scanning / CodeQL

Local information disclosure in a temporary directory Medium

Local information disclosure vulnerability due to use of file readable by other local users.
if (!file.setReadable(false, true)) {
throw new IllegalStateException("Failed to set only owner 'Readable' on file");
}
if (!file.setWritable(false, true)) {
throw new IllegalStateException("Failed to set only owner 'Writable' on file");
}

} catch (final IOException e) { throw new RuntimeException(e); }
return file;
Expand Down

0 comments on commit 17db479

Please sign in to comment.