-
Notifications
You must be signed in to change notification settings - Fork 99
chore(deps): update dependency filelock to v3.20.1 [security] #1469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore(deps): update dependency filelock to v3.20.1 [security] #1469
Conversation
Summary of ChangesHello @renovate-bot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the "filelock" dependency to version "3.20.1", primarily to mitigate a critical security vulnerability, CVE-2025-68146. This flaw, a Time-of-Check-Time-of-Use (TOCTOU) race condition, could enable local attackers to corrupt or truncate arbitrary user files through symlink attacks on both Unix and Windows systems. The updated "filelock" version incorporates essential fixes to prevent this exploit, enhancing the overall security posture of projects relying on this library. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly updates the filelock dependency from version 3.19.1 to 3.20.1 in .devcontainer/requirements.txt. This is a critical security update to address CVE-2025-68146, a Time-of-Check-Time-of-Use (TOCTOU) vulnerability that could lead to file corruption or truncation through symlink attacks. The version and associated hashes have been updated correctly. The change is approved as it mitigates a significant security risk.
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
This PR contains the following updates:
==3.19.1->==3.20.1GitHub Vulnerability Alerts
CVE-2025-68146
Impact
A Time-of-Check-Time-of-Use (TOCTOU) race condition allows local attackers to corrupt or truncate arbitrary user files through symlink attacks. The vulnerability exists in both Unix and Windows lock file creation where filelock checks if a file exists before opening it with O_TRUNC. An attacker can create a symlink pointing to a victim file in the time gap between the check and open, causing os.open() to follow the symlink and truncate the target file.
Who is impacted:
All users of filelock on Unix, Linux, macOS, and Windows systems. The vulnerability cascades to dependent libraries:
Attack requires local filesystem access and ability to create symlinks (standard user permissions on Unix; Developer Mode on Windows 10+). Exploitation succeeds within 1-3 attempts when lock file paths are predictable.
Patches
Fixed in version 3.20.1.
Unix/Linux/macOS fix: Added O_NOFOLLOW flag to os.open() in UnixFileLock._acquire() to prevent symlink following.
Windows fix: Added GetFileAttributesW API check to detect reparse points (symlinks/junctions) before opening files in WindowsFileLock._acquire().
Users should upgrade to filelock 3.20.1 or later immediately.
Workarounds
If immediate upgrade is not possible:
Warning: These workarounds provide only partial mitigation. The race condition remains exploitable. Upgrading to version 3.20.1 is strongly recommended.
Technical Details: How the Exploit Works
The Vulnerable Code Pattern
Unix/Linux/macOS (
src/filelock/_unix.py:39-44):Windows (
src/filelock/_windows.py:19-28):The Race Window
The vulnerability exists in the gap between operations:
Unix variant:
Windows variant:
Step-by-Step Attack Flow
1. Attacker Setup:
2. Attacker Creates Race Condition:
3. Victim Application Runs:
4. What Happens Inside os.open():
On Unix systems, when
os.open()is called:Without
O_NOFOLLOWflag, the kernel follows the symlink and truncates the target file.Why the Attack Succeeds Reliably
Timing Characteristics:
Success factors:
Real-World Attack Scenarios
Scenario 1: virtualenv Exploitation
Scenario 2: PyTorch Cache Poisoning
Why Standard Defenses Don't Help
File permissions don't prevent this:
Directory permissions help but aren't always feasible:
File locking doesn't prevent this:
Exploitation Proof-of-Concept Results
From empirical testing with the provided PoCs:
Simple Direct Attack (
filelock_simple_poc.py):virtualenv Attack (
weaponized_virtualenv.py):PyTorch Attack (
weaponized_pytorch.py):Discovered and reported by: George Tsigourakos (@tsigouris007)
Release Notes
tox-dev/py-filelock (filelock)
v3.20.1Compare Source
What's Changed
Full Changelog: tox-dev/filelock@3.20.0...3.20.1
v3.20.0Compare Source
What's Changed
New Contributors
Full Changelog: tox-dev/filelock@3.19.1...3.20.0
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.