Repository navigation
fix: forward py7zip options with safe argv semantics - #26
Draft
aliasfoxkde wants to merge 5 commits into
Draft
aliasfoxkde wants to merge 5 commits into
aliasfoxkde wants to merge 5 commits into
Conversation
Add a strict mypy gate (strict = true, python_version 3.9) over the py7zip runtime package via [tool.mypy] in pyproject.toml, with a CI typecheck lane running mypy 1.x (mypy 2.x dropped the 3.9 target this project still supports). Annotate every public method of the legacy Py7zip wrapper and the dev scratch script under py7zip/tests/ so the whole distributed tree checks clean with no type: ignore, no stub overrides, and no excludes. Runtime behavior is preserved: annotations only, plus an explicit return None where functions previously fell off the end, a local result->completed rename to disambiguate the legacy subprocess result from the safe ArchiveResult, and assert binary_path is not None narrowing at the two legacy-only sites that read the str the legacy __init__ always assigns (unreachable via the public constructor). py7zip/tests/debugging.py ships in the wheel, so it is typed rather than excluded; its fix is an unreachable __file__ fallback. Validation: mypy 1.20.2 --strict (6 files, no issues); focused tests for touched paths (59 passed); full offline suite under unshare -rn (129 passed); isolated wheel build + twine check PASSED; git diff --check clean. Co-Authored-By: Claude <noreply@anthropic.com>
|
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review of PR #26 found the options-contract landing (3e070ba, audit decision D5 / OVH-16) missing from the Unreleased section of .github/CHANGELOG.md, the release-note location designated by AGENTS.md; the sibling mypy commit in this PR carries its own bullet. Validation: git diff --check clean; python -m pytest tests -p no:cacheprovider -> 135 passed. Co-Authored-By: Claude <noreply@anthropic.com>
The safe branch of Py7zip.wrapper() dispatched every operation to SafePy7zip.run(), bypassing the archive-member traversal guard that lives only in SafePy7zip.decompress(); the public safe decompress(), extract(), and wrapper() entry points could therefore extract a member outside the destination root. Route the safe branch through SafePy7zip.compress()/decompress() so decompression lists the archive and validates every member path before extraction, raising ArchiveTraversalError first. Option validation is extracted into safe.validate_options() and called before acquisition and listing, so the pinned contract holds: a non-empty options string raises TypeError before any 7-Zip process starts, "" forwards no arguments, and a sequence is forwarded element by element. Compression remains the plain "a" invocation with no listing. Legacy runtime behavior is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
Validation
TMPDIR=/nas/Temp).git diff --check: clean.Merge gate
Draft intentionally. Open PR #8 also changes
py7zip/py7zip.pyand usesoptions.split(). Reconcile that overlapping change and re-evaluate the combined source before marking ready; do not merge either branch based on this PR alone.