Skip to content

feat(lockfiles): give Bundler, dotnet, uv and Poetry registry credentials, and say lockfile tools run code - #180

Merged
sweepies merged 4 commits into
mainfrom
feat/lockfile-credentials-all-tools
Nov 4, 2026
Merged

sweepies merged 4 commits into
mainfrom
feat/lockfile-credentials-all-tools

Conversation

@sweepies

@sweepies sweepies commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Part of #157. Follows #178 and #179.

Why

Several lockfile tools run repository and package code:

  • Bundler evaluates the Gemfile and gemspecs.
  • dotnet evaluates MSBuild projects and targets.
  • uv and Poetry build sdists to read their metadata.
  • Yarn and npm prepare git dependencies by running their build scripts.

The tools run unsandboxed as the Count's user, so excluding four of them from tools credentials while the others got them was inconsistent, and protected nothing. The decision: code may run, there is no sandbox, and the docs say so.

What

Tool Form Credentials Matched by
Bundler BUNDLE_<HOST> (. → __, - → ___) basic host
dotnet NuGetPackageSourceCredentials_<key> = Username=…;Password=…;ValidAuthenticationTypes=basic basic the URL of each nuget.config source, from the project up to the root
uv ~/.netrc basic host
Poetry POETRY_HTTP_BASIC_<NAME>_USERNAME / _PASSWORD basic the URL of each [[tool.poetry.source]]
  • Name-keyed tools (Cargo, NuGet, Poetry) share one rule, Runner::named. A name gets the entry its URL falls under, by the same longest-prefix match as lookups. The URL must be written in its normal form, and a name defined two ways gets nothing.
  • Host-keyed tools (Bundler, Composer, Go, uv, Terraform) only get bare-host entries that are alone on their host.
  • Every credentialed run that fails withholds its output.

Docs

  • guide/lockfiles.md has a new danger callout: lockfile tools run repository and package code with the Count's access (environment, settings secrets, GitHub App credentials, concurrent runs), so run it only for repositories you trust that far.
  • The private-registries section is now its own heading, with every tool in the table, and says that neither tools nor allowedInstallations is a boundary.
  • Install scripts are still skipped where a tool allows it, because a lockfile needs none. The Yarn yarnPath/plugins handling is now explained by what the scratch tree lacks, not by safety.
  • sources.md, settings.mdx, PatchulaSettings.pkl, compatibility.md and departures.md are updated to match.

View guided diff Turn on auto-fix

Review rounds

Three Sonnet rounds. Fixes from them:

  • NuGet:
    • Keys are compared without case.
    • A key given twice in one file is a conflict.
    • Every nuget.config in the tree counts, read in any case or namespace.
    • Any unreadable config withholds all NuGet credentials.
  • Poetry:
    • Inline source arrays are read.
    • The ~/.netrc it may read now counts as holding credentials.
  • Name folding: names are folded in full Unicode case as the tool does (Poetry folds acmeſ onto ACMES). A folded or non-plain name poisons its group, so it never inherits another name's credentials.
  • Bundler: dotless hosts are refused (their variables collide with settings like BUNDLE_PATH), and only URL-safe userinfo characters are accepted.
  • Cargo: grouping is now stricter (identical a-b and a_b definitions get nothing), never looser.
  • Cargo.lock: updated for the new roxmltree dependency.

…ials, and say lockfile tools run code

Lockfile tools run repository and package code: Bundler evaluates the
Gemfile, dotnet MSBuild, uv and Poetry build sdists, and Yarn and npm
prepare git dependencies. The Count runs them unsandboxed, so leaving four
of them out of `tools` credentials protected nothing. They now get them in
the form each reads:

- Bundler: `BUNDLE_<HOST>`, by host.
- dotnet: `NuGetPackageSourceCredentials_<key>` for each `nuget.config`
  source under a tools entry.
- uv: `~/.netrc`, by host.
- Poetry: `POETRY_HTTP_BASIC_<NAME>_USERNAME` and `_PASSWORD` for each
  `[[tool.poetry.source]]` under a tools entry.

The lockfile guide now says plainly that lockfile tools run repository and
package code with the Count's access, and that `tools` and
`allowedInstallations` are not a boundary. Install scripts stay skipped
because a lockfile needs none.

Refs #157
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 4, 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 1fc144e Commit Preview URL

Branch Preview URL
Nov 04 2026, 09:15 AM

…ler and Poetry credentials

- Name-keyed sources come as lists, so a key given twice in one file is a
  conflict, and NuGet keys that differ only in case are one key. dotnet reads
  every `nuget.config` in the tree, since a project can name any of them.
- Poetry may read `~/.netrc`, so a run with one withholds its output, and
  inline `source = [{ … }]` arrays count.
- Bundler takes no dotless host, whose variable could be a Bundler setting,
  and no credentials it could not put in a URL as they are.
- The docs say which tools match by host whatever the scheme or port, and
  no longer say that no lifecycle script ever runs.
… credentials for an unreadable config

- Names are grouped by the fragment the tool makes of them, folded in full
  Unicode case, and a name that is not plain still counts, so one a tool
  folds onto a credentialed name (Poetry's `acmeſ` onto `ACMES`) keeps it
  from being given.
- NuGet gives no source credentials when any `nuget.config` in the tree,
  in any case, cannot be read, as it could define any key.
- Poetry withholds its failure output whenever `~/.netrc` exists.
- Bundler takes only credentials made of characters a URL's user part holds
  unescaped.
- The docs name the lockfile tools that get no credentials.
…nfig as NuGet does

`Cargo.lock` now records the new dependency, which `--locked` builds need.
NuGet elements and attributes match in any case or namespace, and Bundler
credentials leave out `+`, which a form decoder reads as a space.
@sweepies
sweepies merged commit 6447db1 into main Nov 4, 2026
12 checks passed
@sweepies
sweepies deleted the feat/lockfile-credentials-all-tools branch November 4, 2026 09:22
@sweepies sweepies mentioned this pull request Nov 4, 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