Repository navigation
fix(lookup): mise lists a repository's tools with a token scoped to it - #327
Merged
Merged
Conversation
As a GitHub App, mise got the installation token, so any repository's mise.toml could list the releases of any private repository the App can read. mise lookups now get a read-only token (contents and metadata read) minted for the repository the lookup is for. Credentials that cannot mint one (personal tokens, an Action's own token) and local directories keep the run's token. Listings stay shared across repositories where they are public data: a tool released from another repository, from a package registry or a core tool is listed once per batch and cached as public. A tool released from the repository itself, or of unknown source in a private repository, is listed and cached for that repository alone. The access is the third element of the batch lookup key and part of the catalog scope. Bumps mise-ls-remote, lookup-hint, catalog and the code-versioned states whose hashed sources this touches.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | eddf349 | Commit Preview URL Branch Preview URL |
Nov 14 2026, 09:22 PM |
…are the lookup's access - Public listings mint `metadata: read`, which reads no private releases, so a renamed repository whose mise.toml names its old name cannot put its own private releases into the shared public listing. A repository's own listing keeps `contents: read`. - `Sources::mise_access` is the one place the access is decided, from the repository a lookup is made for. Release notes get a client made for the repository, so their mise listing and backend lookup use the same token and scope as the proposal's; the note-source read is keyed by it. - A batch lookup checks its key's access against the repository it is made for and fails otherwise: a public key without a repository never runs. - A repository's own listing and catalog view are keyed by the numeric id the mint names, so a repository that takes a renamed one's name reads none of them. Repository names in the access are lowercased.
This was referenced Nov 14, 2026
sweepies
added a commit
that referenced
this pull request
Nov 14, 2026
…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
added a commit
that referenced
this pull request
Nov 14, 2026
…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
added a commit
that referenced
this pull request
Nov 14, 2026
…o mise (#329) * feat(mise): look up tools whose entries carry options, passing them to 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. * fix(mise): options keep the repository's token; metadata endpoints and 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. * test(mise): a refused selector test no longer reads as a credential URI
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First PR in the mise trust series. Option pass-through,
trustedRepositories, centralised code-execution flags and plugin backends come in later PRs.Problem
mise_token()handed mise the run's whole token. In--all-repos, multi-repo Action runs andpatchula serve, that is the installation token, so any repository'smise.tomlcould namegithub:org/private-tooland get that private tool's releases listed.What changes
Token. A mise lookup for a repository gets a token minted with
Credentials::scoped_token. The permission set depends on the access:Repositorylistings getContentsRead({"contents":"read","metadata":"read"}), the smallest set that lists the repository's own private releases.Publiclistings getMetadataReadonly. That reads public repositories' releases and tags (GitHub: permissions "are required to access private resources"; "published releases are available to everyone") and no private repository's contents, including the minted repository's own. Without that, a renamed private repository whosemise.tomlnames its old name could put its own private releases into the shared public listing.Permissionsis a public enum passed toscoped_token. Credentials also answermints_scoped_tokens()andrepository_id(), and actions.lock passesMetadataReadexplicitly.The access is decided in one place,
Sources::mise_access(repository, tool), which batch lookups and release notes both use:MiseAccess::Run, today's behaviourPR 3 can switch this one function to "trusted → run token, untrusted → scoped". A batch lookup checks that its key's access matches what its repository gives, and fails otherwise. A
Publickey with no repository to mint for never runs, and nothing falls back to the run token.Cache sharing (the scope rule,
patchula_datasource::mise_access).patchula_mise::github_sources(tool)returns the GitHub repositories a listing may read:github:,ubi:,aqua:,packslip:, andcargo:with a GitHub URL name their repositorycore:and plainnpm/cargo/pypi/pipx/gem/condanames → no GitHub repositorygo:,http:,spm:,gitlab:, unlisted shorthands…) → unknown. This list fails closed.From that:
Public: the source is known and isn't this repository, or the current repository is public and the source is unknown. Listed once per batch and cached underpublic. The token comes from the first repository that asked, so it is never the source repository's token.Repository(repo)(name lowercased): the source is this repository, or the source is unknown and the repository is private (or its visibility wasn't read). The listing is cached under<credential scope>:<repository id>, and the catalog view underRepository(<id>). The id is the one the mint resolves, so a new repository that takes a renamed one's name reads neither.Run: today's credential scope. Never served to scoped lookups.To make this work:
MiseAccessis the third element of the engine'sLookupKey, so batch dedup and thecatalogstate scope both respect it.with_mise_repository). The notes mise listing andmise toolbackend lookup therefore get the same token and listing scope as the proposal's, and the in-memory note-source read for a mise tool is keyed by that access.Workrecords the repository's visibility, read frommodel::Repository.privateor GraphQLisPrivate.Tool options in
ListingScope: deferred to PR 2.patchula_mise::checkstill refuses bracketed options, so no listing can depend on options today and the field would always be empty. PR 2 adds the field together with the code that passes options, and bumpsmise-ls-remoteagain (one extra cache miss).State bumps
These states are bumped on purpose:
mise-ls-remote1→2 (scope shape)lookup-hint2→3 (key shape)catalog6→7 (scope gainsaccess)The parity guard also required bumps for states whose hashed trees this touches (
crates/github/src/,crates/engine/src/,crates/mise/src/,crates/notes/src/,crates/datasource/src/): source-head, tag-catalog, tag-object, github-release-head, extract, files, config, config-files, catalog-controls, changelog, notes-adapter, notes-adapter-listing, parsed-postgres-sgml, parsed-go-history, release-notes, not-ours, notes-source-{npm,crates,pypi}. Expect one cold run after upgrading.Tests
miseunit test:github_sourcesper backend kind.datasource/tests/mise_lookup.rs:ContentsReadfor the repository's own listing,MetadataReadfor a public one, the installation token without a repository, and the run token when credentials can't mintPublickey without a via, or a key the via doesn't give, fails without starting misemise_accessfalls back toRunfor a token run, a local directory and non-mise sources; unread visibility counts as private; names are lowercasedRun,Public,Repository(a)andRepository(b)views of one package separate, each reused for itself, and drops the repository view after a rename (new id)mise_viaspicks up dependencies promoted after the first pass. It's a unit test of what the secondage_catalogspass recomputes, not an end-to-end lockfile promotion.ContentsReadmint is cached separately fromMetadataReadfor the same repository.Docs
internals/github-client.md: scoped permissions.internals/cache.md: the mise listing scope rule.guide/sources.md: which token mise gets, and how listings are shared.renovate/departures.md: a private tool from another repository no longer resolves under an App.Follow-ups (not in this PR)
Remaining paths where a repository's lookup reads GitHub with the installation token:
uses: org/private-action,github-releasesdependencies) and the release-notes reads of releases, changelogs and tags from a source repository. For example, a public package such asnpm:internal-cliwhose registry metadata names a private repository can still get that repository's release notes into a PR. This PR moves the notes' mise lookups onto the repository's access but not those GitHub reads.nix flake prefetchgetsrun_tool_token()).