You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2025/06/14 20:49:46 UTC

[Bug 69715] New: DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

            Bug ID: 69715
           Summary: DefaultTempFileCreationStrategy forgets the originally
                    set directory, if it doesn't exist
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: attila.kelemen85@gmail.com
  Target Milestone: ---

If DefaultTempFileCreationStrategy detects that the temporary directory (given
in its constructor) disappears (i.e., does not exist), then it will revert back
to whatever is in the `java.io.tmpdir` system property.

This can be dangerous, if someone adjusted the directory due to security
concern, because then someone might delete the temporary directory to force the
application back into the global temporary directory. That said, I would
consider this a mild risk, since it requires that someone to be able to delete
the directory in the first place (but can be a nasty surprise anyway).

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69715] DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
I've added some commits to be strict in the constructor. If you provide a
non-null file, it must refer to a directory that already exists. This should
stop the scenario where the code will fallback to the java.io.tmpdir.
I remain uninterested in the scenario that some 3rd party can later remove this
directory.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69715] DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
The changes I made are
https://github.com/apache/poi/commit/c5ca5ae0657250669349304d5a0ddf1f601656a3
and
https://github.com/apache/poi/commit/c5df00b0a785d47bea08c4e6d03e4d4c5696b0c3

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69715] DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
I repeat that POI is a low level lib. If orgs can't ensure that dirs are not
deleted, then they have severe internal problems that I don't care about it.
Orgs like this can plug in their own more complicated TempFileCreationStrategy
instances.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69715] DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

--- Comment #6 from Attila Kelemen <at...@gmail.com> ---
As promised in #823, I have created a PR which fixes this:
https://github.com/apache/poi/pull/824

As a side effect, the race conditions in the implementations are also fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69715] DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

--- Comment #3 from Attila Kelemen <at...@gmail.com> ---
It is not just malicious 3rd party though. A directory can be deleted by
accident, and then poi will mistakenly start writing to a directory where it
was not supposed to.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69715] DefaultTempFileCreationStrategy forgets the originally set directory, if it doesn't exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69715

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
It is not the concern of a low level lib like POI if orgs deploy apps using POI
and then don't bother to ensure that malicious actors can't delete the temp
directories.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org