Threat model
Read this before changing credentials, lookups, caches shared between repositories, or anything that runs a tool. Every guard in those areas should follow from the rules below. A guard that doesn’t follow from them is noise, and it breaks legitimate setups.
Who is trusted
Section titled “Who is trusted”- The operator runs the Count and writes its settings: the operator settings file, flags and environment. The operator is fully trusted.
- Every repository the Count reads is treated the same way. Its writers may be hostile toward the Count and toward other repositories. There is no setting that trusts a repository.
Someone who can change what the Count reads in a repository — its configuration, manifests or lockfiles on the branch he reads — already has write access to that repository. Nothing the Count does can take that access away, and nothing needs to protect the repository from its own writers.
What a repository may cause
Section titled “What a repository may cause”It may:
- point the Count at any host, registry or package its configuration names.
The Count follows repository-declared sources, such as a registry, a mise
api_urlor tool options. He never falls back to a public package of the same name when the declared source fails (dependency confusion). - receive a credential whose reach is no wider than that repository’s own, such as a token minted for that repository. Sending that credential to a host of its choosing gains the writer nothing.
It may not:
- run code on the Count’s machine. That covers plugin backends (asdf, vfox), lifecycle scripts, hooks, build logic, credential helpers and anything else that executes something the repository chose. The Count runs as one user, with his credentials, his cache and, under an App, the private key, so code running there reaches all of them.
- obtain a credential wider than its own reach: the installation token, the
App key, another repository’s token, an operator registry credential meant
for other repositories, or the machine’s own credentials. Cloud
instance-metadata endpoints (link-local addresses such as
169.254.169.254) hand those out, so a repository-chosen fetch target may not be one. - see data that only another repository’s credentials could fetch. Results shared between repositories, such as listings and catalogs, are shared only when they came from public data or from a credential the reader may hold.
Consequences
Section titled “Consequences”- Follow, don’t refuse. If the Count can reproduce what a repository declares, he does it. He refuses only what would run code chosen by the repository, or what he cannot reproduce faithfully.
- Scope credentials, don’t strip them. Give each lookup the narrowest credential its repository is entitled to. Don’t withhold that credential because a repository-chosen host could see it.
- Never run code a repository chose. Plugin backends, lifecycle scripts, hooks and the like stay off for every repository.
- Keep shared results honest. A shared cache key includes everything that changes the answer: the options, the source, and the reach of the credential that fetched it.
- Argument hygiene is separate from trust. Rejecting values that a tool would read as flags, selectors or extra arguments is about parsing correctly, and applies to every repository.
Cache scopes
Section titled “Cache scopes”Results the Count keeps from GitHub (Git objects, HTTP validators, catalogs, listings, hints) are keyed by a credential scope that names the credential’s reach, never its secret:
- an App installation by the App and the installation;
- an installation token (
ghs_: an Action’s App token orGITHUB_TOKEN) by the API root, its App’s bot user and the exact set of repository ids GitHub lists for that token in the run. What GitHub calls the selection (allorselected) never shapes the scope. Anything unexpected in the listing keeps the token hash; - any other token (personal, OAuth or user tokens) by a hash of the token, since GitHub does not report what it reaches.
Two credentials share entries only when their reach is the same. A token narrowed to fewer repositories shares nothing with the full installation.
Permissions are not part of the scope. The endpoints the cache answers
without asking GitHub are listed in one place,
patchula_github::unrevalidated::ENDPOINTS: Git blobs, trees and commits by
SHA, each needing contents: read. A read that skips revalidation on any
other endpoint fails, and a test fails when a call site names one. An
installation token has the same permissions on every repository it reaches,
so a token run uses its reach as the scope only after the token has read a
repository’s contents in that run, a private one when the reach has any.
Everything else is asked of GitHub every time.
An installation’s scope does not change when a repository leaves it. Git objects already cached from that repository stay readable under the installation’s scope until they are evicted, though the installation could no longer fetch them.
Planting
Section titled “Planting”The scope is not a secret, so the cache file is trusted like the operator’s settings: whoever can write the file the Count opens can plant entries in it. On a runner that is whoever can write the Actions cache the workflow restores, which is the operator, or the repository’s own writers when the workflow lives in the repository it updates. A Git blob read from the cache must hash to its SHA, so a planted blob is read from GitHub again. Trees, commits, catalogs, listings and hints cannot be checked that way and stay plantable by that writer, as public registry responses always were.
Confidentiality
Section titled “Confidentiality”The cache file is as confidential as the widest credential that filled it: it holds Git objects, catalogs and listings from every repository that credential reached. Whoever can read the file reads them. A fork’s pull request can restore a public repository’s Actions cache without holding any secret, so the action saves its cache in a public repository only when the token is an installation token whose listing is that repository alone. It saves nothing when it cannot show that, a personal token included.
Out of scope
Section titled “Out of scope”- Protecting a repository from its own writers.
- A compromised operator, or a compromised host the operator configured.
© 2026 Sweepy
