fix(update): use filter='data' on tarfile.extractall (CVE-2007-4559 / PEP 706)#2285
Open
ktwu01 wants to merge 1 commit into
Open
fix(update): use filter='data' on tarfile.extractall (CVE-2007-4559 / PEP 706)#2285ktwu01 wants to merge 1 commit into
ktwu01 wants to merge 1 commit into
Conversation
… PEP 706) The auto-updater extracted the downloaded release tarball without specifying a filter. Python 3.12 deprecated this; Python 3.14 (which .python-version pins) emits a DeprecationWarning, and a future release will raise. Adding filter='data' is the PEP 706-recommended default for trusted sources. It silences the deprecation, future-proofs the call, and provides defense-in-depth path-traversal protection consistent with the explicit zip-slip checks already present at: - src/kimi_cli/cli/plugin.py:73-77 - src/kimi_cli/vis/api/sessions.py:648-657 Refs MoonshotAI#2273.
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.
Resolves part of #2273 (the tarfile defense-in-depth piece).
Change
One-line addition of
filter="data"to the auto-updater'starfile.extractallcall:Why
extractall()without an explicitfilter=argument; Python 3.14 (which.python-versionpins) emits aDeprecationWarning, and a future release will raise.filter="data"is the PEP 706-recommended default for trusted sources. It silences the deprecation, future-proofs the call, and provides defense-in-depth path-traversal protection (CVE-2007-4559 family).src/kimi_cli/cli/plugin.py:73-77andsrc/kimi_cli/vis/api/sessions.py:648-657— the auto-updater was the lone outlier.Scope
Strictly the 1-line
filteraddition. The larger SHA-256 / signature manifest piece of #2273 is intentionally not in this PR — that needs maintainer alignment on manifest format and is followed up separately in the issue.Verification
src/kimi_cli/ui/shell/update.py:304_do_update), not user-facing tar extraction.tmpdiror set absolute paths.🤖 Generated with Claude Code