diff --git a/src/main/java/org/apache/datasketches/common/Util.java b/src/main/java/org/apache/datasketches/common/Util.java index a1303297f..bda8fdf50 100644 --- a/src/main/java/org/apache/datasketches/common/Util.java +++ b/src/main/java/org/apache/datasketches/common/Util.java @@ -1014,6 +1014,12 @@ private static File createTempFile(final String shortFileName) { final File file; try { file = File.createTempFile("temp_" + name, suffix); + 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;