forked from haskell/directory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TOCTOU issue with recursive removal on POSIX systems
removeDirectoryRecursive and removePathForcibly are supposed to never traverse symbolic links, which would avoid unintended deletion of files outside the specified directory tree. The previous implementation did not "lock onto" the directory while enumerating its entries, allowing concurrent processes to replace the directory with a symlink right before or during the enumeration and tricking the deleter into traversing the symlink. This commit mitigates the issue on POSIX systems by acquiring file descriptors to every directory it traverses.
- Loading branch information
1 parent
b9b2cda
commit a7b1dcf
Showing
7 changed files
with
187 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.