🐛 fix(seed): validate wheel zip entries before extraction#3118
Merged
Conversation
08857ad to
0adc9c6
Compare
Guard the wheel extraction in the app-data seeder against zip slip. The wheel is an untrusted zip archive as soon as anyone can tamper with it on disk or along the download path, so refuse entries with absolute names or ``..`` components before calling ``extractall``.
0adc9c6 to
9b50cae
Compare
rahuldevikar
approved these changes
Apr 14, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security hardening. The app-data seeder extracts seed wheels with
zipfile.ZipFile.extractallwithout validating entry names first. Wheels are not a strongly trusted input — they live on disk, they can be replaced by anyone with write access to the app-data cache, and in the--downloadpath they come from pip's cache — so a tampered wheel with an entry named../evil.pyor an absolute path would land outside the image directory. 🔒The fix wraps extraction in a helper that refuses any entry whose name is absolute or resolves outside the target image directory, then delegates to
extractallfor the happy path. Absolute-path checks cover both POSIX and Windows forms so the same guard is effective on any platform.Nothing changes for well-formed wheels; only malformed archives are rejected, with a clear
RuntimeErrorthat names the offending entry.