Skip to content

Conversation

@hsuk04
Copy link

@hsuk04 hsuk04 commented Jun 9, 2025

Descriptions of the changes in this PR:

This PR modernizes the createTempDir method in IOUtils.java and eliminates a potential race condition/directory hijacking vulnerability by using a safer, atomic method Files.createTempDirectory() introduced in Java 7 (NIO).
This was also done here:
openkm/document-management-system@c069e4d
samtools/htsjdk@269ba3f

Motivation

The existing implementation of createTempDir in IOUtils.java uses an outdated pattern involving File.createTempFile() followed by delete() and mkdir(). This sequence is potentially vulnerable to a race condition (CWE-379) which can lead to temporary directory hijacking or information disclosure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant