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 global PM probes spawning bare names from the project (#421, #434, #438, #440) by mikolalysenko · Pull Request #442 · SocketDev/socket-patch Conversation
|
| Issue | Test | Red without the fix |
|---|---|---|
| #434 | npm_family_global_probes_find_the_installed_shims (npm/pnpm/bun) |
Windows only (shim not found). Passes on test (windows-latest) |
| #434 (yarn), #440 | yarn_global_probe_runs_outside_the_scanned_project |
Linux, verified locally: left: "/tmp/…/proj", right: "/tmp/…/home". On Windows it also fails, because the shim isn't found. Passes on windows-latest |
| #440 (hardening) | global_probe_ignores_a_tool_planted_on_a_relative_path_entry (Unix) |
Linux, verified locally: left: Ok("/planted/node_modules") |
| #440 (Windows fallback) | global_probe_never_runs_an_executable_planted_in_the_project (Windows) |
A copy of cmd.exe planted as npm.exe in the project with only . on PATH. The old fallback would run it and return its banner as the prefix. Not executed locally (no Windows host); first run is on windows-latest |
| #421 | global_gem_paths_come_from_the_installed_gem_shim |
Windows only (gem.cmd). Passes on windows-latest |
| #438 (1) | composer_home_comes_from_the_installed_composer_shim |
Windows only (composer.cmd). Passes on windows-latest |
| #438 (2) | composer_home_falls_back_to_xdg_config_home (Unix), composer_home_falls_back_to_appdata_on_windows (Windows) |
Linux, verified locally: left: []. The APPDATA test passes on windows-latest |
There are also unit tests: neutral_probe_dir_prefers_an_absolute_home_and_never_the_cwd, and resolve_app_alias_skips_relative_entries (a yarn.exe reachable only through ., an empty entry or a bare dir name is never chosen; one on an absolute entry is).
Commands run locally (Linux) on dce7d1a:
cargo clippy --workspace --all-features -- -D warnings: cleancargo test -p socket-patch-core --lib utils::process: 15 passcargo test -p socket-patch-core --test global_probe_spawn_e2e --test crawler_composer_e2e --test crawler_npm_e2e: 6, 33 and 82 passcargo test --workspace --all-features --no-fail-fast (earlier revision): everything passes except 12 permission-injection tests that fail only because this sandbox runs as uid 0. None touch the probe code; CI runs as non-root.ring needs a MinGW toolchain this sandbox lacks. test (windows-latest) is its first build.main isn't rustfmt-clean under the pinned 1.93.1 toolchain, and CI doesn't gate on it, so I didn't apply a workspace-wide cargo fmt.npm/, pypi/ and gem/ only dispatch the binary.yarn global dir doesn't exist before yarn 1.1.0, and there's no fallback #437: yarn 1.0.x has no yarn global dir, so it needs a default-folder fallback.vendor-dir cascade inside the global home.scan -g / get -g / vex -g find no global gems because gem env is spawned as bare gem, which never resolves to gem.cmd #421 notes that the hard-coded gem fallback list lacks RubyInstaller and XDG dirs. With gem env working on Windows, that list is no longer the discovery path there, so it's left as is.🤖 Generated with Claude Code
https://claude.ai/code/session_01KKwBoKTsqpGR3ZcCAcEyCA
Note
Medium Risk
Changes how external package-manager CLIs are resolved and spawned for global discovery; mistakes could mis-target global install trees or skip valid tools, but scope is limited to probe/discovery paths with extensive regression tests.
Overview
Global mode (-g) now discovers machine-wide npm, yarn, pnpm, bun, RubyGems, and Composer installs reliably instead of often returning an empty scan.
Process spawning resolves package-manager binaries via resolve_tool (PATHEXT on Windows for .cmd/.bat shims) and spawns the resolved path; on Windows, resolve_app_alias_with can pick up App Execution Aliases on absolute PATH entries only, without falling back to bare names that could run project-local executables.
Global prefix probes for npm, yarn, pnpm, bun, and composer global config home use a new GlobalProbeRunner that runs from a neutral directory (absolute home, else drive root), so Yarn Berry cannot answer yarn global dir via a project "global" script and relative PATH entries cannot hijack the probe.
Composer global home fallbacks now follow Composer’s own defaults: %APPDATA%\Composer on Windows and XDG/~/.config/composer elsewhere, via extracted composer_home_candidates.
Changelog and e2e/unit tests cover shims, neutral cwd, PATH hardening, and Composer fallback ordering.
Reviewed by Cursor Bugbot for commit dce7d1a. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Global mode asked npm, yarn, pnpm, bun, gem and composer where their global installs live by spawning the bare tool name. On Windows those tools are .cmd/.bat shims that a bare spawn never finds, so scan -g silently reported nothing to patch. The yarn probe also ran inside the scanned project, where Yarn Berry runs the project's own "global" script and its output picked the directory scanned as global. Probes now resolve the tool through PATHEXT (and never from a relative PATH entry), npm-family global probes run from the home directory, and Composer's home falls back to %APPDATA%\Composer and $XDG_CONFIG_HOME/composer like Composer does. Fixes #421, #434, #438, #440. Assisted-by: Claude Code:claude-opus-5-5
A Windows App Execution Alias (the Store python3.exe) is a reparse point the PATH lookup can't stat, though a bare spawn launches it. The Python probe shares this runner, so fall back to the bare name on Windows when the lookup finds nothing, rather than lose an interpreter that used to be found. Also satisfies clippy's redundant closure lint. 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] Two red checks on
If either fails again on re-run, I'll treat it as real and root-cause it. Generated by Claude Code |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Global Composer discovery now also tries Composer's own defaults, %APPDATA%\Composer and $XDG_CONFIG_HOME/composer. On a Windows runner APPDATA points at a real Composer home, which outranks the ~/.composer and ~/.config/composer candidates these tests stage. Unset both variables there, as the tests already do for HOME and PATH, so they keep exercising the HOME candidates. 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.
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.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
An earlier cargo fmt run over the whole workspace reformatted 125 files this change doesn't touch. Restore them to main so the diff holds only the global-probe fix. 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.
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.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[burn-down agent] Ready for review on
Note: Slack announcement could not be sent this run (no Slack send tool available in the agent session); next run will retry. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Union the CHANGELOG Fixed entries from both sides. Co-Authored-By: Claude <[email protected]>
|
bugbot run Generated by Claude Code |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KKwBoKTsqpGR3ZcCAcEyCA
The no-composer and empty-HOME tests still inherited APPDATA and XDG_CONFIG_HOME. Global discovery now probes %APPDATA%\Composer and $XDG_CONFIG_HOME/composer, so a machine with a real Composer home there made both tests see a vendor dir and fail. Unset both variables in these tests too, as the sibling HOME-fallback tests already do. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KKwBoKTsqpGR3ZcCAcEyCA
|
bugbot run Generated by Claude Code |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KKwBoKTsqpGR3ZcCAcEyCA
|
bugbot run Generated by Claude Code |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent check: ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
# Conflicts: # CHANGELOG.md
|
bugbot run Generated by Claude Code |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: ready for review again at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Reviewed [P1] Preserve absolute-PATH filtering in the Windows fallback — crates/socket-patch-core/src/utils/process.rs:207. When Consequently, on Windows with Validation: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
When the safe lookup found no tool, the Windows fallback for App Execution Aliases handed the bare name back to std. Its Windows search also walks relative PATH entries such as '.', resolved against the parent's cwd before the child's current_dir applies, so with '.' on PATH an npm.exe or yarn.exe planted in the scanned project ran during the global probe despite the neutral child cwd. Look for the alias as <name>.exe on absolute PATH entries only, using symlink_metadata since the reparse point can't be followed, and never spawn the bare name. A Windows e2e test plants a copy of cmd.exe as npm.exe in the project with only '.' on PATH and checks the global npm probe finds nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KKwBoKTsqpGR3ZcCAcEyCA
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KKwBoKTsqpGR3ZcCAcEyCA
|
Thanks, the [P1] is right. The old comment saying
I couldn't run or type-check the Windows test here: there's no Windows host, and cross-compiling Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't think this PR caused it:
No fix exists for it yet. I'll re-run the failed job once this CI run finishes (GitHub refuses a re-run while the run is still going). If it fails again, I'll treat it as a real nondeterminism in the crawler-vs-oracle walk and look into it. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Follow-up reviewed The Windows alias fallback now considers only absolute PATH entries and passes the selected absolute Validation: The final main-merge commit leaves the process implementation and probe tests identical to tested |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
bugbot run 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 dce7d1a. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[burn-down agent] Re-verified Ready for review at
Slack announcement not sent: the Slack connector in this session has no send-message tool. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Re-reviewed The Ubuntu test job now passes on this same head, as do the Windows and macOS test jobs. The Windows absolute-PATH security fix remains unchanged, and the branch merges cleanly with current Fresh local validation: 4 oracle tests, 15 process tests, and 6 global-probe integration tests pass on macOS, including the oracle test that previously failed in Ubuntu CI. The old failure cleared on a same-SHA CI rerun; the local replay also passed. |
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.
scan -g inside a Yarn Berry project runs the project's global package.json script and scans whatever directory it prints as a global install
On Windows, scan -g finds no Composer global packages in the default %APPDATA%\Composer home, so apply -g and vex -g silently do nothing
On Windows, scan -g / get -g / vex -g find no global npm packages because npm root -g is spawned as bare npm, which never resolves to npm.cmd
On Windows (RubyInstaller), scan -g / get -g / vex -g find no global gems because gem env is spawned as bare gem, which never resolves to gem.cmd
There was an error while loading. Please reload this page.