Repository navigation
Conversation
…SSUE-1001 to ISSUE-1008) New control packageManagersMustBeCompliant. Its first check reads every committed mise config and lockfile in the local checkout, without running mise, and reports: - ISSUE-1001: a config declares tools and its lockfile is not committed - ISSUE-1002: a config sets lockfile = false - ISSUE-1003: a tool request has no lock entry (fails closed on templates and format 0 lockfiles) - ISSUE-1004: a locked download has no checksum - ISSUE-1005: a locked download has no provenance (requireProvenance) - ISSUE-1006: a required platform is not locked (requiredPlatforms) - ISSUE-1007: the lockfile format is too old (minimumLockfileVersion) - ISSUE-1008: a tool is declared only in .tool-versions mise does not depend on the provider, so it is configured by a new top-level mise key in .plumber.yaml, next to gitlab and github. A missing block or enabled: false skips it. The control is added to every run by RunControls, after the provider's own controls. A remote run without a checkout reports it as not evaluated. The legacy --output JSON is left unchanged and does not carry these findings. Refs #254 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Lint (errcheck) flagged the unchecked f.Close in readFile, and CodeQL flagged len(m)+1 as a capacity hint in pinAbsentMiseChecks (go/allocation-size-overflow). The file is read-only, so its close error is ignored on purpose; the map needs no hint. 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>
Covers packageManagersStatLines through the GitHub and GitLab stats paths: configs read, tool requests summed over configs, findings, in that order, and zeros when there is no scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…des, stop on unreadable files) Part of #678. - The control is now mise-en-place. Codes are numbered in sequence and each has a subject (lockfile, presence), exported in the catalog. - ISSUE-1005: a locked download records a provenance kind outside lockfile.trustedProvenance (default: slsa, github-attestations, cosign, minisign). Missing provenance moves to ISSUE-1006, and the next codes move up one (1007 platforms, 1008 format, 1009 .tool-versions). - ISSUE-1010: with mise.required: true, a repository with no mise config outside exemptPaths is reported. - ISSUE-1018: under requireChecksums, a tool from a binary backend (aqua, github, gitlab, ubi, http) locked with no platform table, or a platform with neither url nor checksum. - ISSUE-1019: a mise local config (*.local.toml) that git tracks. - A mise file that cannot be read (bad TOML, over 2 MiB, symlink out of the repository, to a device or nowhere) stops the run with one error listing every such file, control characters escaped. Files every configuration exempts don't stop it, unless a checked config pairs with them. - The scan follows directory symlinks inside the repository, reads .tool-versions only when the lockfile check runs, maps asdf names (nodejs, golang), and applies an inherited lockfile = false the way mise does. - The scan honors --controls / --skip-controls and reads the files when any platform policy needs them; each policy's verdict marks mise-en-place not evaluated when its data was not read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a1a956c to
655ecb8
Compare
655ecb8 to
f0c7da9
Compare
Claude PR review — findings not anchorable to the diffNone on the latest revision. |
Part of #678. trustedProvenance: [] trusts no provenance kind, and an absent key trusts the default four. omitempty dropped the empty list when a config was written back to YAML (config slim does), so it read back as absent and trusted every kind. The field is now a pointer, so an empty list stays empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f0c7da9 to
54b5c2c
Compare
…he local-config git filter A provenance table with two kinds is read as both kinds, sorted and joined with a comma, which is the form the ISSUE-1005 rule splits. When two configs of one directory disagree on [settings] lockfile, false wins whichever is read first. scanPackageManagers drops a *.local.toml that git does not track. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54b5c2c to
e81b327
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the versions check of #254. A tool request in a mise config that matches mise.versions.forbiddenVersions (globs) is ISSUE-1011, high. The check reads the request as written in mise.toml: with `latest` the lockfile still pins a version, but `mise lock --bump` or `mise upgrade` moves it without any change to the config. - Fails closed: a request Plumber can't read (template, empty or unquoted version) is ISSUE-1011 too. - plumber:default turns it on with latest, lts, lts/*, lts-*, stable, nightly, beta, branch:*, path:*, system, sub-* and prefix:*. ref:* is left out because a ref pinned to a commit SHA can't move. - An invalid glob is rejected when the config loads. Before, glob.match failed silently and the rule matched nothing. - An unreadable config stops the run when only the versions check runs. That check alone reads no lockfile and no .tool-versions (mise.Options.Lockfiles), so an unreadable one does not stop it. - config slim pins an absent versions block off for a legacy source, as it does for lockfile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #678. A tool request Plumber can't read without running mise (a {{ }} template, an empty version, an unquoted one like `node = 24`) was a second ISSUE-1011 rule. It is now its own code, ISSUE-1012 (subject versions, high), and ISSUE-1011 only reports a request that matches forbiddenVersions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[tools.<name>.platforms.<platform>] gives the same platforms as the quoted "platforms.<platform>" form, sorted by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the sources check of #254, configured by mise.sources (authorizedSources, authorizedRegistries; globs checked at load). It is off in plumber:default. - ISSUE-1021: a tool comes from a backend outside authorizedSources. A key with a backend is its own source; a shorthand takes the backend of its lock entry. A tool whose backend no lock entry records fails closed, unless the entry is missing and the lockfile check already reports it. .tool-versions entries are judged too. - ISSUE-1022: a [settings] redirect (url_replacements, aqua registries, mirrors, build repos), a [plugins] URL or an [env] index variable points outside authorizedRegistries. - ISSUE-1023: a tool on an authorized backend overrides its download location (api_url, url, platforms.<p>.url, pypi indexes) with a URL outside authorizedRegistries. The collector now keeps committed *.local.toml files (judged by sources and versions, never by the lockfile check), and merges the platforms of lock entries that share specifiers: mise writes one entry per platform when a tool's options differ by platform, and Plumber used to keep the first one only, which gave a false ISSUE-1007. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…013 to ISSUE-1016) Part of #678, covers #668. - trustedTools replaces authorizedSources: matched against the tool's full mise name (its key, or the backend its lock entry records). ISSUE-1013 (was ISSUE-1021). - trustedRegistries is checked against every download url mise.lock records for a trusted tool, the URL `mise install --locked` fetches. Absent: not checked; [] trusts none. ISSUE-1014 (new). - trustedReplacement: [settings] url_replacements targets. mise requests the replacement first while the lockfile keeps the original URL. ISSUE-1015 (was ISSUE-1022). - trustedOptions: URL options of a trusted tool (api_url, url, platforms.<p>.url, pip indexes). ISSUE-1016 (was ISSUE-1023). - A tool that is not trusted gets ISSUE-1013 alone. - The scanner no longer reads [plugins] URLs, build repos, mirrors, aqua.registries or [env] index variables, and the sources check no longer judges .tool-versions (ISSUE-1009 covers it). - MISE_URL_REPLACEMENTS set in the CI file goes with #675. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kout A root mise.local.toml with [monorepo] lockfile = true does not pair subprojects with the root lockfile. The versions check judges a committed local config. The sources check alone reads lockfiles, so a broken mise.lock stops the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pipx_args and uvx_args are command lines, so a flag like --include-deps was reported as an untrusted source (ISSUE-1016) and a real index URL could not match trustedOptions. Every URL in them is now judged on its own, whatever flag carries it, since pip accepts attached short values and long-option prefixes. install_env also reads UV_DEFAULT_INDEX, UV_EXTRA_INDEX_URL, UV_INDEX and npm scoped registries. The mirror settings comment no longer says ISSUE-1014 covers go, npm, cargo or pip tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e81b327 to
fb0c26d
Compare
|
#681 replaces this path. Remote runs read the mise files there, and |
There was a problem hiding this comment.
🔴 Test coverage
Medium: invalid-glob validation and its tests cover versions/sources glob fields but not mise.lockfile.requireProvenance or mise.exemptPackages, so a typo in those fields loads without error and silently weakens the check untested. (Medium)
validateGlobs exists precisely because the Rego rules call glob.match, which "fails on a bad pattern and then matches nothing, so a typo would silently change what the check passes" (see its doc comment at configuration/packagemanagers.go:229). It is applied to mise.versions.forbiddenVersions (line 160) and the four mise.sources.* lists (line 222), and configuration/packagemanagers_test.go (TestMiseConfigDecoding) asserts rejection for trustedTools, trustedRegistries, and forbiddenVersions.
Two other fields are documented as glob lists and consumed by glob.match in the Rego, but are never passed to validateGlobs and have no test exercising an invalid pattern:
mise.lockfile.requireProvenance—MiseLockfileCheckConfig.UnmarshalYAML(configuration/packagemanagers.go:116) only rejects unknown keys. The Rego rule for ISSUE-1006 (policies/mise_lockfile.rego:915) doesglob.match(pattern, null, tool.locked.backend)over these patterns.mise.exemptPackages—MiseConfig.UnmarshalYAMLlikewise does not validate it;_exemptinpolicies/mise_lockfile.rego:752doesglob.match(pattern, null, name)over it.
Concrete failure scenario: a config with mise:\n lockfile:\n requireProvenance: ["aqua:[infra"] loads with no error (no config test catches this). At evaluation, glob.match errors on the malformed pattern, so it is undefined and ISSUE-1006 never fires — a tool locked without provenance passes silently, the opposite of what the user configured. A typo in exemptPackages (e.g. ["aqua:[x"]) similarly fails to exempt the intended tool, producing spurious findings. Neither behavior is caught by any test.
Suggested tests / fix: route RequireProvenance through validateGlobs("mise.lockfile.requireProvenance", ...) in MiseLockfileCheckConfig.UnmarshalYAML and ExemptPackages through validateGlobs("mise.exemptPackages", ...) in MiseConfig.UnmarshalYAML, then add TestMiseConfigDecoding cases asserting that requireProvenance: ["aqua:[infra"] and exemptPackages: ["aqua:[x"] each return a config error (matching the existing invalid-glob cases for the other fields).
Control: .github/claude-prompts/test-coverage.md · resolve this conversation once addressed.
| // 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 mise sources check misses a lowercase npm_config_registry in a tool's install_env, letting a trusted npm tool redirect downloads to an untrusted registry without triggering ISSUE-1016. (Medium)
isIndexEnvVar decides whether an install_env key counts as a download-redirecting option (ISSUE-1016). The global index variables are matched case-sensitively via slices.Contains(indexEnvVars, k) (mise.go:764–780), where indexEnvVars contains "NPM_CONFIG_REGISTRY". Only the scoped npm branch is case-insensitive (strings.ToUpper(k) at mise.go:778).
npm's config loader matches the npm_config_ prefix case-insensitively and lowercases the remainder of the key, so npm_config_registry, Npm_Config_Registry, and NPM_CONFIG_REGISTRY are all honored by npm (and environment variable names on Linux are case-sensitive, so mise passes whatever casing the config wrote straight through to the install process). The same is true of npm's scoped form — which is exactly why the authors made that branch case-insensitive.
Concrete failure scenario: a repo trusts its npm tools (e.g. mise.sources.trustedTools: ["npm:*"]) and a committed mise.toml contains:
[tools]
"npm:some-pkg" = { version = "1.2.3", install_env = { npm_config_registry = "https://evil.example/" } }tableSourceOptions (mise.go:832–838) calls isIndexEnvVar("npm_config_registry"), which returns false: the key is not byte-equal to NPM_CONFIG_REGISTRY, and the scoped branch requires @ + :REGISTRY. The key is therefore dropped from SourceOptions, so the ISSUE-1016 rule in policies/mise_sources.rego (lines 169–184) never sees it. mise install runs npm with npm_config_registry=https://evil.example/, pulling the package from an attacker-controlled registry, and the sources check passes clean — a silent bypass of the control whose purpose is to catch download redirection. Using the uppercase NPM_CONFIG_REGISTRY is detected, so the lowercase form is a pure evasion.
Suggested fix: match the global index variables case-insensitively for the npm vars (or normalize k the way npm does before comparison), consistent with the existing scoped-registry handling. Add a test fixture with a lowercase npm_config_registry (and mixed-case) in install_env to packagemanager/mise/mise_test.go / policies/mise_sources_test.go, which currently only exercise the uppercase PIP_INDEX_URL/UV_EXTRA_INDEX_URL and scoped NPM_CONFIG_@acme:registry forms.
Control: .github/claude-prompts/new-control-check.md · resolve this conversation once addressed.
What type of PR is this?
feat
What this PR does / why we need it:
The sources check of
mise-en-place: where mise fetches tools from, held to lists kept outside the repository.trustedToolspatternmise.lockmatches notrustedRegistriespattern[settings] url_replacementstarget matches notrustedReplacementpatterntrustedOptionspatternOff in
plumber:default. Patterns are globs, matched case-insensitively and validated when the config loads.trustedToolsis matched against the tool's full mise name: its key (aqua:jqlang/jq), or for a shorthand (terraform) the backend its lock entry records. A shorthand with no lock entry fails closed; when the lockfile check runs it already reports the missing entry (ISSUE-1001/1003), so ISSUE-1013 stays quiet.mise.lockrecords theurlmise install --lockeddownloads, so a change tomise.lockalone could point a trusted tool at any host. LeavetrustedRegistriesout and the URLs aren't checked;[]trusts none.url_replacementstarget first, whilemise.lockkeeps the original URL, so ISSUE-1014 can't see it. Absent or[]trusts none.api_url,url,platforms.<os-arch>.urland the pip index options (registry_url,indexes,pipx_args,uvx_args,install_env). Absent or[]trusts none..tool-versionsisn't judged here (ISSUE-1009). A committed*.local.tomlis judged like any config.aqua.registries,[env]index variables) are gone: the locked URL covers where a download actually comes from (mise: rework the #254 stack before merge (control name, codes, trusted* keys, lockfile URL) #678).It also fixes the lock matcher from #665: when a tool's options differ by platform,
mise lockwrites one entry per platform with the same specifiers, and Plumber kept only the first, which gave a false ISSUE-1007. It now merges them.Which issue(s) this PR is related to:
Part of #254 and #678 (PR 3 of 4). Based on #666 and retargeted as the earlier PRs merge.
Closes #668
Special notes for your reviewer:
MISE_URL_REPLACEMENTSset in the CI file is not read yet; it goes with mise lockfile: MISE_LOCKFILE=0 in the CI file turns locking off and is never checked #675, which reads mise variables from the pipeline.trustedRegistriesis a pointer in Go so that[]survives a YAML round trip (an empty slice would be dropped byomitemptyand read back as absent).make lintshows the 7reflect.Ptrnotes from feat(control): mise-en-place control: lockfile, versions, sources and tasks checks, local and remote (ISSUE-1001 to ISSUE-1019) #665, in files this PR doesn't touch.Does this PR introduce a user-facing change?
How was this tested?
make testpasses: the scanner (options in every form,url_replacements, merged lock entries), config decoding (the new keys, bad globs, the oldauthorizedSourceskey rejected), the Rego cases (policies/mise_sources_test.go: each code, absent vs emptytrustedRegistries, one finding per lock entry when configs share a lockfile, the hand-offs with ISSUE-1001/1003, local configs,.tool-versionsleft alone), and the catalog and fingerprint goldens.plumber analyzeon the example repo atfeature/678-by-subject, without the tasks block this build rejects.sources/issue-1014is a realmise lockwith its linux URL moved to another host:sources/, and a false ISSUE-1007 onsources/issue-1016sources/issue-1013toissue-1016included, no ISSUE-1007 onsources/issue-1016AI usage disclosure:
YES. Claude Code wrote the code, tests and docs, following decisions made with the author on #254 and #678. The author reviewed the changes and is responsible for them.
🤖 Generated with Claude Code