GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — Fix vendored Hatch running a planted hatch (#613) by mikolalysenko · Pull Request #617 · SocketDev/socket-patch Conversation
|
| Issue | Regression test | Without fix | With fix |
|---|---|---|---|
| #613 | vendor::pypi_hatch::tests::planted_hatch_in_the_project_is_never_executed: planted hatch in the project, PATH = ., empty, and :/nonexistent. Asserts it never runs and the result is pypi_hatch_unsupported |
FAILED: planted hatch ran with PATH="." |
ok |
| #613 | vendor::pypi_hatch::tests::hatch_on_an_absolute_path_entry_passes_the_version_gate: a hatch on an absolute PATH dir is run and passes the >=1.2 gate |
ok (control) | ok |
Commands run locally:
cargo test -p socket-patch-core --lib vendor::pypi_hatch: 8 passed.cargo clippy --workspace --all-features -- -D warnings: clean.SOCKET_PATCH_HATCH_E2E_REQUIRED=1 SOCKET_PATCH_HATCH_E2E_VERSION=1.18.1 cargo test -p socket-patch-cli --all-features --test e2e_vex_build -- --ignored hatch::: 4 passed.1.0.0: 4 passed.cargo test --workspace --all-features --no-fail-fast: 9673 passed. 65 failed, all outside this change. They were caused by the sandbox: running as root (read-only chmod fixtures can't fail a write) and the disk filling up mid-run (self-update / notifier fixtures hit ENOSPC). CI is the authority for those.cargo fmt --all -- --check: the changed lines are fmt-clean. main itself is not rustfmt-clean repo-wide, and CI doesn't run fmt.hatch executable planted in the scanned project #613: an architecture test banning Command::new("<literal>") in production code outside utils/process.rs. Not included here, to keep this change focused.🤖 Generated with Claude Code
https://claude.ai/code/session_01BbXFWxz5BKEPH4xmF5VK7y
Note
Medium Risk
Changes subprocess invocation during PyPI Hatch vendoring in a scanned repo; behavior for legitimate Hatch on PATH should be unchanged, but spawn resolution rules are security-sensitive.
Overview
Fixes a security issue where vendored Hatch support could run a hatch binary committed inside the scanned project during the hatch --version capability probe.
The probe now follows the same pattern as other CLI spawns: resolve_tool_with picks hatch only on absolute PATH entries, and command_for runs that resolved path (with the same cwd, timeout, and version ≥1.2 gate). Missing hatch still surfaces pypi_hatch_unsupported. Logic is refactored into require_environment_context_support_with so tests can inject PATH. Unix regression tests cover planted hatch under ./empty PATH and a control case with hatch on an absolute bin dir.
Reviewed by Cursor Bugbot for commit e7466ea. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
Vendoring a Hatch project whose environments depend on the patched package checks `hatch --version` from inside the project. The probe spawned the bare name `hatch`, so with a relative PATH entry (`.` or an empty component) it ran a `hatch` file committed to the scanned repository: arbitrary code execution from a checkout. The probe now looks `hatch` up on absolute PATH entries only, through the same resolve_tool helper every other in-project spawn uses, and runs the resolved path. When no such `hatch` exists the run takes the existing "requires Hatch >=1.2 on PATH" refusal. Fixes #613 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] CI note:
I'll re-run the failed job once when the workflow's last job finishes. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e7466ea. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[burn-down agent] Labeled Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Reviewed The probe now uses the shared absolute-PATH resolver and spawns the resolved executable, preserving the existing version refusal, cwd, stdin and timeout behavior. 27 focused checks passed: 8 Hatch tests, 15 process-helper tests and 4 independent gate controls. Native Hatch 1.18.1 worked with relative PATH entries and planted checkout executables/Python modules; Hatch 1.0.0 retained its expected refusal. Exact-head CI: 476 successful checks, 7 skipped, none pending or failed; all workflows completed. Bugbot is clean, no review threads remain unresolved, and the branch merges cleanly with current Local validation ran on macOS; Linux/Windows are covered by the completed CI runs. Human approval is still required. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Vendored Hatch runs ahatch executable planted in the scanned project
There was an error while loading. Please reload this page.