Repository navigation
feat(lockfiles): give Cargo, Composer, Go and Terraform opted-in registry credentials - #179
Merged
Merged
Conversation
…stry credentials An entry with `tools = true` now reaches every lockfile tool but Bundler, dotnet, uv and Poetry, in the form each reads: - Cargo: `CARGO_REGISTRIES_<NAME>_TOKEN`, the header a lookup sends, for each registry whose sparse index falls under the entry. Cargo now reads the repository's `.cargo/config.toml` files, reduced to their `registries`. - Composer: `COMPOSER_AUTH`. - Go: `~/.netrc` for basic entries, with their hosts in `GOPRIVATE`. - Terraform: `TF_TOKEN_<host>` for bearer entries. Composer, Go and Terraform match by host, so they only get an entry alone on its host that names no port. A credentialed run that fails shows none of its output. Refs #157
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | 1189ae1 | Commit Preview URL Branch Preview URL |
Nov 04 2026, 08:23 AM |
…vironment Cargo runs outside the repository, so it never read the reduced `.cargo/config.toml`. It now gets each credentialed registry the configs at or above the project define as `CARGO_REGISTRIES_<NAME>_INDEX` and `_TOKEN`, and nothing is written to the tree. The configs are fetched only when the runner has tools entries, and a linked one is skipped instead of failing every lockfile run. `.netrc` also refuses quotes, backslashes and `#`. The docs list the tools that get credentials and say that `allowedInstallations` does not bound what code an unsandboxed tool runs can read.
…credentials to bare hosts Cargo configurations are now fetched only at or above a Cargo project the plan relocks, checked out beside the tree rather than into it, and read leniently: one that is not UTF-8, is over 1 MiB or is a link defines no registries, and no other ecosystem depends on it. Composer, Go and Terraform only get an entry whose prefix is a bare host, since they would widen a path to the whole host, and Terraform skips a host with `_`, whose variable could name another host. The docs list the credentials a tool cannot take and Composer's basic credentials in Git URLs.
…al-form index Cargo and curl read an index URL as written, so one that parses to another form (a backslash, an escape, a user, uppercase, dot segments) could send the token to another host than the entry's. Such an index, or a name outside Cargo's own characters, now gets nothing. The docs name `.cargo/config` too.
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.
Part of #157, phase 4. Follows #178, which did the npm family.
What
An entry with
tools = truenow reaches every lockfile tool except Bundler, dotnet, uv and Poetry. Each tool gets the credential in the form it reads:CARGO_REGISTRIES_<NAME>_INDEXand_TOKEN[registries.<name>]COMPOSER_AUTH(http-basic,bearer)~/.netrc, with the host inGOPRIVATETF_TOKEN_<host>[registries]of the.cargo/config.tomland.cargo/configfiles at or above a Cargo project the plan relocks. They are fetched only when it has tools entries, checked out beside the tree rather than into it, and read leniently: a link, a file that isn't UTF-8 or one over 1 MiB defines no registries. It passes each credentialed registry asCARGO_REGISTRIES_<NAME>_INDEXand_TOKEN, and nothing is written to the tree.Bearer <token>orBasic <base64>), because Cargo sends it verbatim asAuthorization.a-banda_b), gets nothing.GOPRIVATEkeeps the private modules away from proxy.golang.org and sum.golang.org, and Git reads the same.netrc. A user or password containing whitespace, quotes, a backslash or#is left out, because.netrcreaders disagree on them._, whose variable could name another host. The docs list the credentials a tool can't take.Runner::held_tool).Cargo (
update), Composer (--no-scripts --no-plugins), Go and Terraform (providers lock) run no package code while locking. The trust grant is still the repository's.The docs now also say that lockfile tools run unsandboxed as the Count's own user. Code an npm-family tool runs (a git dependency's build script) can read what concurrent runs hold, and the Count's own environment and files, so
allowedInstallationsdecides which installations' tools are given a credential, not what such code can read. This predates this PR.Docs
The
guide/lockfiles.mdprivate-registries note now has a table of tools.guide/sources.md,reference/settings.mdx,PatchulaSettings.pkl,renovate/compatibility.mdandrenovate/departures.mdare updated too.