Skip to content

Require generic_paths for generic upstreams with credentials - #581

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/generic-auth-paths
Oct 24, 2026
Merged

andrew merged 1 commit into
git-pkgs:mainfrom
simonchrz:fix/generic-auth-paths

Conversation

@simonchrz

Copy link
Copy Markdown
Contributor

A generic upstream forwards any path below /generic/{name}/. With the documented mise setup, a bearer GITHUB_TOKEN on https://api.github.com to raise the rate limit, that means any API call anyone reaching the proxy makes is sent with the operator's token, and the answer lands in the shared metadata cache. upstream.git already refuses an upstream with credentials unless it lists its repos; this applies the same rule to generic upstreams.

  • New upstream.generic_paths: per generic upstream, the paths after /generic/{name}/ it may serve, using the repos pattern syntax (path.Match, trailing /** for anything nested). Other paths answer 404 without contacting the upstream. Paths containing %, ?, # or a backslash are also refused for these upstreams, so the path that matched is the path the upstream sees.
  • Config validation refuses a generic upstream that upstream.auth has credentials for unless it has generic_paths, with an error naming the setting. This also covers a github.com token reaching the generic github upstream.
  • Upstreams without credentials keep the plain name: url form and serve every path, as before.
  • README, docs/configuration.md and config.example.yaml show the paths mise needs (repos/*/*/releases, repos/*/*/releases/**, repos/*/*/tags) and recommend a fine-grained token with read-only access to public repositories.

Upgrade note: a config with upstream.auth credentials covering a generic upstream's URL won't start until upstream.generic_paths lists that upstream's paths.

A generic upstream forwards any path below /generic/{name}/. The
documented mise setup puts a GITHUB_TOKEN on api.github.com to raise
the rate limit, so anyone who could reach the proxy could make any GET
request with that token, including for private repositories it can
read, and the answers went into the shared metadata cache. upstream.git
already refuses an upstream with credentials unless it lists its repos.

upstream.generic_paths now lists, per generic upstream, the paths it
may serve, with the same pattern syntax as git repos. Other paths
answer 404 without reaching the upstream, and so does a path holding
'%', '?', '#' or a backslash, which the upstream could read as a
different path than the one that matched. Config validation refuses a
generic upstream that upstream.auth has credentials for unless it has
generic_paths, which also covers a github.com token reaching the
generic github upstream. Upstreams without credentials keep serving
every path.

The docs and example config show the paths mise needs and recommend a
fine-grained token limited to public repositories.
@andrew
andrew merged commit 5d9df60 into git-pkgs:main Oct 24, 2026
6 checks passed
@simonchrz simonchrz added the breaking Changes behaviour users rely on; needs a minor release label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Changes behaviour users rely on; needs a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants