fix(extensions): harden URL download cache - #3869
Open
mnriem wants to merge 1 commit into
Open
Conversation
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8f71e02a-bc64-4593-b305-2554debe96f6
Contributor
There was a problem hiding this comment.
🟡 Not ready to approve
Installation still has a pathname-reopen race, and existing Windows URL-install tests will fail.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Hardens custom-URL extension downloads against cache path and symlink attacks.
Changes:
- Adds descriptor-relative, no-follow ZIP creation and cleanup.
- Enforces private file permissions and fails closed on unsupported platforms.
- Adds security and successful-install coverage.
File summaries
| File | Description |
|---|---|
src/specify_cli/extensions/_commands.py |
Implements secure cache handling. |
tests/test_extension_add_path_traversal.py |
Tests cache traversal and platform behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Medium
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| pass | ||
|
|
||
| # Install from downloaded ZIP | ||
| manifest = manager.install_from_zip(zip_path, speckit_version, priority=priority, force=force) |
Comment on lines
+500
to
+502
| "URL-based extension installs require POSIX-style dir_fd and " | ||
| "O_NOFOLLOW support, which is unavailable on this platform. " | ||
| "Use --dev with a local directory or install from a catalog instead." |
| def test_url_install_writes_and_cleans_up_secure_download( | ||
| project_dir: Path, monkeypatch: pytest.MonkeyPatch | ||
| ) -> None: | ||
| _require_secure_dir_fd() |
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
dir_fd+O_NOFOLLOWwith exclusive mode0600, failing closed when atomic primitives are unavailableTesting
.venv/bin/python -m pytest tests/test_extension_add_path_traversal.py tests/test_extensions.py::TestExtensionAddCLI -q(40 passed)test_empty_provides_and_no_hooks_keeps_its_own_messageAuthored autonomously on behalf of @mnriem by GitHub Copilot (model: GPT-5.6 Sol).