Repository navigation
Description
Blog now checks its GitHub Environment secrets and variables against a declared list (ptr727/Blog#285). The hub already checks the repository-scope half of the same problem, and documents the environment-scope half without checking it. This proposes one declarative source for both, checked by the hub-hosted audit, so no repository keeps its own checker or its own prose list.
The gap in the hub today
spec/audit.pychecks repository-scope secret names, in the Actions and Dependabot stores. It checks them againstspec/secrets.json: the fleet baseline, the mechanisms a repository's publish targets and types map to, and the registry entry'srequiredSecrets. It reports missing, stale, and forbidden names.repo-config/configure.sh checkchecks that each environment in the registry exists and carries its branch policy. It also reports an environment the registry does not declare. It leaves secret names tospec/audit.pyand reads no environment secrets or variables. Its own comment notes that the API can list those names. Leaving them unchecked is a choice about ownership, not an API limit.- Environment-scope names are checked by nothing.
spec/secrets.jsonsays so itself. Thedeploy-sshmechanism's note says per-environment names have no vocabulary there and that neithervalidate.pynoraudit.pyqueries an environment store. The file's top-level note says anenvironmentslisting, where one exists, is operator documentation that no tool reads. So a clean audit is no evidence that a deploy environment is configured. - A repository therefore keeps its own prose list. Blog's
AUDIT.md"Environment scope" section names each environment's secrets and variables by hand, withghcommands for a human to run. That list drifted within a day: Blog added a family-site variable and token pair to its environments, and the section does not mention them. Hand-kept lists drift, and nothing notices.
What Blog built
checks/check-github-env.py, with tests in checks/tests/test_check_github_env.py. Blog's ENVIRONMENT.md table "The GitHub Environments" is the declaration. Each row names a value, its kind (variable or secret), and a "Held on" cell listing its stores:
| Value | Kind | Held on | Names |
| --- | --- | --- | --- |
| `SITE_BASE_URL` | variable | `staging`, `production` | the base URL ... |
| `SITE_AUTH_TOKEN` | secret | `staging` | the access token ... |
| `CODEGEN_APP_CLIENT_ID` | secret | `repository`, `dependabot` | the merge bot's App client id ... |
A store is a deployment environment's name, repository for the Actions repository store, or dependabot for the Dependabot secret store. The checker works like this:
-
Parse the table strictly. Every row either parses or is refused. An earlier version skipped a row it could not match, so a capitalized kind or a missing backtick silently dropped a declared value.
-
Read the names GitHub holds, through
gh api --paginate --hostname github.com repos/<owner>/<repo>/...with--jq '.<key>[].name':actions/secretsactions/variablesdependabot/secretsenvironments, thenenvironments/<name>/secretsandenvironments/<name>/variablesfor each one
Only names leave
gh, so a variable's value never reaches the output. -
Compare both ways, as
(store, kind, name)triples:- missing: declared but not held.
- unlisted: held but not declared.
- wrong kind: held as a variable where the declaration says secret, or the reverse.
Every environment GitHub has is read, not just the declared ones. An environment the declaration never names must therefore hold nothing, and a stray value there is reported. The same rule catches a credential leaking into an environment that must not have it, such as an access token on a public production site. That is the "absent from production" assertion Blog's
AUDIT.mdspells out by hand. -
Exit 0 on agreement, 1 on a finding or a malformed declaration, and 2 when GitHub could not be read. A failed query therefore never reads as a pass.
What it had to get right
Each of these was a real defect caught in review, and each applies to any hub version:
- Pin the target repository and host.
gh api repos/{owner}/{repo}/...resolves the placeholder fromGH_REPObefore the checkout's remote, andGH_HOSTmoves the host. Either one silently points the check at another repository. Blog's checker resolves owner and repo fromorigin, against a pattern anchored on the whole URL, and passes--hostname github.com. The hub audit already names its target repository, so the host pin is the part that transfers. - Refuse an environment named like a store label. An environment called
repositoryordependabotwould merge its values into that store's findings. - Names only, including for variables. The environment variables endpoint returns values. A
--jqprojection to.namekeeps them out of logs, which is the same reason Blog'sAUDIT.mdinsists on--json name. - Listing environment secrets needs an admin login. A workflow's
GITHUB_TOKENcannot, so CI cannot run this. That fitsspec/audit.py, which is already owner-run.
Proposal
- Declare environment-scope names in the hub, next to what already describes the environment. Each registry
environmentsentry already carriesname,branchPolicy, andbranches, and it could also carrysecretsandvariablesname lists. The same move could give repository-scope variables a declaration, since the registry hasrequiredSecretsand nothing for variables. Keeping the declaration hub-side follows the audit's own principle that a repository's claim about itself is not evidence. - Extend
spec/audit.pyto read the environment stores, names only, and report missing, unlisted, and wrong-kind values per environment. The rule that an undeclared environment must be empty comes along with it. Thedeploy-sshnote and theenvironmentsnote inspec/secrets.jsonthen become true statements about a checked declaration. - Retire the per-repository copies. Blog's
AUDIT.md"Environment scope" section shrinks to a pointer at the audit run, and Blog's checker is deleted once the audit covers the same ground. A repository's own documentation still describes what each value means, which is repository knowledge. The hub declaration holds names, kinds, and stores.
Open question
Where the declaration lives. In the registry, the audit reads its own ground truth and a repository cannot vouch for itself, which is why I would start there. The cost is that adding one environment variable becomes a hub pull request as well as a repository change. The alternative is a small declarative file the repository carries, such as JSON beside its workflows, which the hub-hosted checker reads. That keeps one change in one repository, but it makes the repository its own ground truth. A third option is both: the hub declares which environments and stores exist, and the repository declares the names inside them.
Related
- No tool manages a deployment environment, and GOVERNANCE.md still says a repo carries ruleset payloads #1482, closed by Promote the Host-Tools Carry Rule, the Multi-Interpreter Validator Leg, and the Release-Trigger Retirement #1489, gave
configure.shits check that each declared environment exists. This is the next step: checking what those environments hold. - P1: Give Every Rule One Home, Replacing Restatements With Pointers or Generated Includes #1317, giving every rule one home, is the same principle applied to configuration. A hand-kept per-repository list is a restatement, and the declaration plus one checker is its one home.
Blog's checker stays in place until this lands, and it is the reference implementation to port from.
Activity
ptr727 commentedon Nov 1, 2026
Decision needed (decision triage, 2026-11-01)
Question: Where should a repository's per-environment secret and variable names be declared so the owner-run
spec/audit.pycan check them: the hub'sregistry/repos.jsonenvironments[]entries, a file the repository carries, or a split between the two?Options, recommended first:
requiredSecretsalready lives there and is read by audit.py:1864-1865, and the fleet's rule is that a repository's claim about itself is not evidence. Cost: a new environment value needs a hub PR, rare with one deploy adopter. Unblocks Hand a Variable Set of Environment Values to a Hub Task's Hook Instead of Named Pairs #2174 option 6 and Say Where the Deploy-Site Task Actually Requires the SSH Key #1801 option 2. No work in flight.Evidence: spec/secrets.json:47 (
deploy-sshnote): no tool queries an environment store. spec/secrets.schema.json:48-62 defines an unread fleet-wideenvironmentsobject, which the chosen option should retire or absorb. Blog's driftNotes (registry/repos.json:329) leave deploy credentials out ofrequiredSecretsbecause the audit would demand them in the Actions store. configure.sh:37 is check-only for environments.Blocks: #2174 (its option 6), #1801 (its option 2)
ptr727 commentedon Nov 1, 2026
Maintainer answer (decision triage, 2026-11-01): Option 1: add secrets and variables name lists to each registry/repos.json environments[] entry, read by spec/audit.py, and retire or absorb the unread environments object in spec/secrets.schema.json. This is now work for the next burndown round.
Provision a Repository's Secrets From the Host's Secrets Directory (#…