Skip to content

feat(mise): look up tools whose entries carry options, passing them to mise - #329

Merged
sweepies merged 3 commits into
mainfrom
fix/mise-tool-options
Nov 14, 2026
Merged

sweepies merged 3 commits into
mainfrom
fix/mise-tool-options

Conversation

@sweepies

@sweepies sweepies commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #327 (fix/mise-scoped-token); retarget to main when it merges.

What changes

The Count used to refuse mise tools whose entries carry options. Now he passes those options to the pinned mise, which applies them to ls-remote just as it does at install time. There is no per-backend table, and mise ignores keys it doesn't read (e.g. mr_boxington).

Mechanism: bracket syntax on the tool argument

Checked against mise 2026.10.11:

  • mise reads bracketed options as InlineBackendArg, the same layer it gives an entry's own table options.
  • Brackets parse as a TOML inline table, so arrays and tables come through faithfully.
  • A generated config would mean dropping MISE_NO_CONFIG, so I didn't take that route. MISE_NO_CONFIG, MISE_NO_ENV, MISE_NO_HOOKS and MISE_AUTO_INSTALL=0 all stay on.

Extraction

  • Options go into package as canonical, sorted brackets: rust[components="clippy,rustfmt",mr_boxington=true,profile="minimal"]. A name that already has brackets is passed as written.
  • A string containing " is written as a TOML literal string ('…'). mise reads that form; checked with deepsource's url.
  • No merge across layers. I tested the pinned mise with mise.toml plus mise.local.toml, mise.toml plus .tool-versions, and a child folder. mise does not merge a tool's options across configuration files: the highest-precedence entry replaces the others whole, options included. So each entry is looked up with its own options.
  • Arrays. mise lists a tool with its first request's options, so every version in an array uses those.
  • Task tools. These are runtime requests. mise layers the [tools] entry's options under the task's own, choosing by version (apply_config_options_to_runtime_arg). The Count doesn't reproduce that, so a task tool is refused when it, or its [tools] entry in the task's configuration hierarchy, has table options. Brackets on a task tool's name are part of the backend argument and pass.
  • Write-back only touches the version span, so names, brackets and options stay byte-for-byte (tested).
  • http/s3 skip. These tools are skipped only when the parsed options lack version_list_url (or version_prefix). s3 also checks the per-platform forms mise reads (platforms.<os>-<arch>.*, platform_*). A refused entry now fails its lookup rather than being reported as skipped.

Argument hygiene (applies to every repository)

  • No leading - in the name, option keys or string values.
  • No @ outside an npm scope.
  • No control characters, and a 1024-byte limit.
  • Options must be either the canonical form (which must round-trip exactly) or mise's legacy key=value form. Legacy values that TOML would read as numbers, booleans or dates (1e5, 0x10, 1_0, true, 1979-05-27) are refused. asdf and vfox stay refused.

Tokens and scope

  • Same token as any other lookup. A tool's options may send mise to another host (api_url, e.g. a GitHub Enterprise server), and mise hands its GitHub token to any GitHub-API-shaped host. The token is the one fix(lookup): mise lists a repository's tools with a token scoped to it #327 gives the lookup, which reaches no further than the repository, so options get it like any other lookup.
  • Public listings. I verified that a public listing is always fetched with the token of a repository whose own entry asked for that exact tool and options. mise_vias keys on the full lookup key, and options are part of the package, so one repository's options never carry another repository's token. A new engine test pins this.
  • Scope rule. github_sources returns None for any tool with options, so its listing is shared only from public repositories.
  • Listing state. ListingScope gains options, and mise-ls-remote goes to version 3.

Instance-metadata endpoints refused

  • The rule. Fetch targets may point at any host, except a cloud instance-metadata endpoint. Every http(s) URL in the options, nested ones included, is checked: a host that is, or currently resolves to, 169.254.0.0/16 or fe80::/10 (IPv4-mapped forms too), fd00:ec2::254, metadata.google.internal or metadata is refused. Any spelling the URL parser normalises (decimal or hex IPv4) is caught. A host that doesn't resolve is refused too, since the Count can't check it. There is no private-range or https-only restriction.
  • Known gaps (no cheap fix):
    • mise resolves the name again when it fetches, so a host that changes its DNS answer between the check and the fetch isn't caught.
    • mise follows redirects, so a host that redirects to the metadata endpoint isn't caught either.
    • Closing these needs network-level blocking of the metadata endpoint (or IMDSv2 with a hop limit of 1). The guide says so.
  • The s3 backend's AWS SDK gets no credentials. No AWS_* variable is inherited, its config and credential files point into the scratch home, and AWS_EC2_METADATA_DISABLED=true stops the default chain from fetching the machine's role.

Other

A rule's packages matches the bare tool name too (packages: ["rust"] selects rust[profile=…]).

Verification

  • Dry run on this checkout (VM): patchula lookup --here --default-config --json exits 0 with no lookup failures. rust, both nu-lint entries and gh-actions-lock (in tasks.toml and crates/tools/src/lockfiles/defaults.toml) look up. nu-lint is offered 1.9.2; rust and gh-actions-lock are current. http:deepsource is skipped as before (no version_list_url).
  • Pinned mise checks:
    • The bracket forms list correctly, including an os for another platform.
    • minimum_release_age in brackets filters the listing, as at install.
    • The config-layer and array behaviour above (mise tool --json in scratch directories).
    • mise reads a literal-string url.
  • Tests: patchula-mise, -manager, -datasource, -engine, -notes, -lookup, -update and -tools pass on the VM. Workspace clippy with -D warnings is clean. The metadata-address tests use IP literals and fixed names, so they need no network; the unresolvable-host test uses .invalid.
  • Corpus snapshots: no diff (the corpus has no mise entries with options).
  • State guard: bumped extract, files, config, config-files, catalog, catalog-controls, changelog, notes-adapter, notes-source-{npm,crates,pypi}, notes-adapter-listing, parsed-postgres-sgml and parsed-go-history.

Docs: guide/managers.md, guide/sources.md, internals/cache.md, renovate/departures.md.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 93c9c08 Commit Preview URL

Branch Preview URL
Nov 14 2026, 10:59 PM

@sweepies
sweepies changed the base branch from fix/mise-scoped-token to main November 14, 2026 22:58
…o mise

The Count refused a mise tool whose entry set options (`rust = { version,
profile, components }`, a forgejo tool with `api_url`) or whose name
carried them in brackets (`github:org/tool[bin=tool]`). Now the options
travel with the tool to the pinned mise, which applies them to the listing
exactly as it does when installing.

- Extraction writes the entry's options (every key but `version`) into the
  package in mise's bracket syntax, sorted and canonical; a bracketed name
  is passed as written. An entry with both, or an option the canonical
  form cannot hold, fails its lookup without repeating what it holds.
- `patchula_mise::check` validates options too: no leading `-` in keys or
  string values, no `@`, no control characters, a length limit, and only
  the canonical TOML form or mise's legacy `key=value` form.
- mise sends `MISE_GITHUB_TOKEN` to any host shaped like a GitHub API, so a
  tool whose options hold a `:` (and so may name a host) gets no token;
  its listing is public, keyed apart by its options. Any tool with options
  is one whose source the Count cannot place for the scope rule.
- The `mise-ls-remote` scope carries the options (state version 3).
- http/s3 tools are skipped only when the entry lacks `version_list_url`
  (or `version_prefix`), since those options are now passed.
- A rule's `packages` matches the bare tool name as well.
…d unreproducible layering refused

- A tool whose options name another host gets the same token as any other
  lookup from its repository: under #327 that token reaches no further
  than the repository whose own entry wrote the options. A public key's
  token is minted for a repository that asked for exactly that tool and
  options (options are part of the lookup key), which a test pins.
- Options that point mise at a cloud instance-metadata endpoint are
  refused: a URL whose host is, or resolves to, a link-local address
  (169.254.0.0/16, fe80::/10), fd00:ec2::254, metadata.google.internal or
  metadata. Such endpoints hand out the machine's own credentials. mise
  resolves again and follows redirects, which this does not catch.
- The sandbox gives the s3 backend's AWS SDK no credentials: config and
  credential files in the scratch home, AWS_EC2_METADATA_DISABLED=true.
- mise does not merge a tool's options across configuration files (the
  highest-precedence entry replaces the others whole, checked with the
  pinned mise), so each entry keeps its own; an array lists with its first
  request's options. A task's tool is refused when it or its [tools] entry
  in the task's hierarchy has table options, since mise layers the two by
  version in a way the Count does not reproduce.
- The http/s3 skip reads the parsed options (s3 per platform too), and a
  refused entry fails its lookup rather than look skipped.
- Legacy bracket values TOML would read as non-strings are refused;
  strings holding `"` are written as TOML literal strings.
@sweepies
sweepies force-pushed the fix/mise-tool-options branch from 3183a1d to 93c9c08 Compare November 14, 2026 22:59
@sweepies
sweepies merged commit 18455a2 into main Nov 14, 2026
13 checks passed
@sweepies
sweepies deleted the fix/mise-tool-options branch November 14, 2026 23:09
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant