Repository navigation
fix(install): never hand mise "latest" for npm:/pipx: tools; mise use writes the project config only - #1139
Merged
Conversation
… to the project mise resolves "latest" for an npm: tool by running `npm view <pkg> dist-tags --json` with the first npm on PATH. When that npm is mise's own shim, the shim resolves the toolset again and runs `npm view` again, without bound (4,425 orphaned processes in under a minute on one machine). kit wrote such entries itself: `mise use <tool>@latest` with no --path, which from the home folder writes the global mise config. - installTools resolves "latest" for npm:/pipx:/pip: to the newest stable release public for the cooling period (triage-cooling's newestOlder), triages that exact version, and refuses when none can be resolved. miseInstall refuses "latest" for those backends too. - mise use gets --path <project>/mise.toml (or an existing .mise.toml); refused in ~. - kit check: "mise npm: tools at latest" supply-chain row; kit fix pins each entry to the installed version. File reads only, read-only aware. - Test runs point MISE_GLOBAL_CONFIG_FILE at an empty path (test.mjs, prepush). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Kit-Hook-Tree: 225dc78
…est suites Moves the kit fix migration for the mise fork loop into check-mise-latest.ts (migrateMiseLatest), so src/fix.ts stays under 600 lines, and splits two describe blocks the complexity gate measured as over 80 lines. Test-Growth: the tests are the proof for a fix that took a machine down three times; every install, resolution and pin path runs against a fake exec or a temp folder, so none can spawn mise or npm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Kit-Hook-Tree: c3e9863
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Kit-Hook-Tree: 1a426ae
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
…loop Kit-Hook-Tree: 4e3d44b # Conflicts: # docs/COMMANDS.md
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
…loop Kit-Hook-Tree: 51ab5a3 # Conflicts: # docs/COMMANDS.md
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
…loop Kit-Hook-Tree: 6694380 # Conflicts: # docs/COMMANDS.md
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
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.
Problem
kit could start an unbounded process fork loop through mise.
How it happens
"latest"(DEFAULT_SECURITY_SCANNERS).miseInstallranmise install <tool>@latestand thenmise use <tool>@latest.mise usehad no--globaland no--path. In that case mise writesmise.tomlin the current folder, "or global config if cwd is home directory" (mise help use, mise v2026.6.11). So a run from~wrote"npm:snyk" = "latest"and"npm:@socketsecurity/cli" = "latest"into~/.config/mise/config.toml.latestfor annpm:tool, mise v2026.6.11 runsnpm view <pkg> dist-tags --jsonwith the barenpm(src/backend/npm.rs,latest_stable_version). Whennpmon PATH is mise's own shim, the shim resolves the toolset again and runsnpm viewagain. Nothing stops the recursion.npm view snyk dist-tags --json/npm view @socketsecurity/cli dist-tags --jsonprocesses (ppid 1) within one minute, on a flaky network where nothing got cached.pkillcould not keep up, and only a reboot stopped it. This happened three times, once duringnpm test.mainreads the registry over HTTP and skips its own shims, so newer mise fixes this upstream. kit cannot rely on the user's mise version.pipx:has no such loop. mise reads PyPI over HTTP for it in v2026.6.11 and on main (src/backend/pipx.rs), so the detection row coversnpm:only.Fix
latestfornpm:/pipx:/pip:.src/mise-version.tsresolveslatestto the newest stable release that has been public for the cooling period ([supply_chain] min_release_age_days, default 14).newestOlder,registrySourceandlimitFrom, and it honours air-gap mirrors.installToolstriages that exact version (npm:x@1.2.3) and installs it.latest.miseInstallalso refuseslatestfor those backends, in case a caller passes it directly.aqua:, core runtimes) still passlatestthrough. kit has no cooling resolver for them, and mise resolves them from its registry or the GitHub API, not through a shim. This is a deliberate gap:lateststill reaches mise foraqua:tools.mise usewrites only the project config. It now runsmise use --path <project>/mise.toml(or an existing.mise.toml). kit refuses to run it in the home folder (compared by file identity), where any config would act as global.kit checksecurity row,mise npm: tools at latest(categorysupply-chain), reads the projectmise.toml/.mise.tomland the global config (MISE_GLOBAL_CONFIG_FILE,MISE_CONFIG_DIR, XDG,~/.config/mise/config.toml).npm:tool is atlatest(string, table or list form) and mise'snpmshim exists with the shims folder on PATH. It names the loop and the fix.npmfirst for that child. I measured this on the affected machine.kit fixpins each plain-string entry to the newest version installed under mise's data folder. Table and list forms, and tools that are not installed, are reported for a manual pin. Read-only mode refuses and writes nothing..kit.tomlmay keeplatestas policy. The comment onDEFAULT_SECURITY_SCANNERSand thekit installrow indocs/COMMANDS.mdnow say what it means.scripts/test.mjsand theprepush.mjstest step setMISE_GLOBAL_CONFIG_FILEto a path where no file exists.mise current/mise whichthatcheckToolsruns inside tests loaded the globalnpm:latest entries, which is the likely trigger duringnpm test.fix-flowhelper also isolatesMISE_GLOBAL_CONFIG_FILEandMISE_DATA_DIR.Non-hermetic tests found
mise install/mise use. EveryinstallTools/ensureScannersInstalled/ heal-recipe test injects fakes. ThecmdFix/setup/checkfixtures either have no scanner refs or havenode = "latest", whichcheckToolsreportsalready_ok.mise current/mise whichthroughcheckTools:cli-fix.test.ts,cli-check.test.tsandcli-setup.test.ts(node = "latest"fixtures). With the old global config, each of those calls could start the loop. Item 5 closes that..kit.tomldeclares trivy and trufflehog. Akit checkin the repo root would auto-install them for real if those exact pins were missing. No test does that today.What the tests prove
mise-version.test.ts: exact pins pass untouched with no network. npm and PyPIlatestresolve to the newest cooled stable version.min_release_age_daysis honoured. Unreadable registry, nothing cooled, and air-gap without a mirror all refuse, and none of them returnslatest. aqua and core tools pass through.install.test.ts: the resolved version is the one triaged and installed. A refusal reaches neither the gate nor mise. Against a fake exec,miseInstallpassesuse --path <project>/mise.toml, reuses.mise.toml, refuses in home, and refuseslatestfor npm/pipx.check-mise-latest.test.ts: global path resolution; string, table and list detection (pipx ignored); installed version read past mise's alias links; warn and pass cases, including a real npm ahead of the shim on PATH; the pin keeps comments and the other lines; uninstalled tools are not pinned; read-only refuses.fix-flow.test.ts:kit fixpins a projectmise.tomlend to end.pinMiseLateston a copy of the affected machine's pre-fix global config. The row warns, and the pin produced exactly the versions that were pinned by hand (1.1.102,1.1305.1).Unverified
--pathkeepsmise useoff the global config, and the recursion mechanism itself.npm.cmd/npm.exein the shims folder and has not been run on Windows.🤖 Generated with Claude Code