When working around file system permission errors, files are removed after resolving their path again, this means that by replacing a directory of the tree with a symbolic link, an attacker can make the cleanup delete files outside of the temporary directory.
We did a full sweep of 3.10-3.14 security releases last week, and we'd already started building (and iirc already completed one) without the fix, and it didn't seem quite right to only have the fix in 3.12.
Activity
gh-157579: Fix race condition in the cleanup of `tempfile.TemporaryDi…
[3.12] gh-157579: Fix race condition in the cleanup of tempfile.Tempo…
[3.12] GH-157579: Revert GH-158489 (prematurely merged) (#158528)
hugovk commented on Sep 30, 2026
TODO:
[3.15] gh-157579: Fix race condition in the cleanup of `tempfile.Temp…
fix: temporarily safelist unreleased Python tempfile fix (#1022)
frenzymadness commented on Oct 6, 2026
What was the reason to revert the fix from 3.12? I see it was "merged prematurely" but is the fix somehow wrong?
hugovk commented on Oct 6, 2026
We did a full sweep of 3.10-3.14 security releases last week, and we'd already started building (and iirc already completed one) without the fix, and it didn't seem quite right to only have the fix in 3.12.
https://blog.python.org/2026/10/python-31022-31117/
The fix itself looks fine, It'll likely be included for the next releases.
[3.14] gh-157579: Fix race condition in the cleanup of `tempfile.Temp…