Repository navigation
Closed
Labels
Description
Provisioning a repository should also set its GitHub secrets. It reads each value from the host's ~/.secrets/, writes every one it finds to the store that needs it, and reports every one it does not find so the maintainer can add it by hand. Today, provisioning sets every repository setting except secrets, and the values are pasted into the GitHub UI one repository at a time.
What Exists Today
- The names are already resolved per repository.
spec/secrets.jsongives the fleet baseline (CODEGEN_APP_CLIENT_ID,CODEGEN_APP_PRIVATE_KEY) and the mechanisms a repository's publish targets and types map to. For example,docker-hubmaps toDOCKER_HUB_USERNAMEandDOCKER_HUB_ACCESS_TOKEN. Each mechanism also names itsstores(actions,dependabot). A registry entry'srequiredSecretsadds the names specific to that repository.spec/audit.pyalready checks the names against this, reporting missing, stale and forbidden ones. repo-config/configure.shdeliberately writes no secret. Its header says an environment's secrets "exist nowhere in this repository", and its check run ends with a manual-verify note about secret values. This issue reverses that choice, so the comment and the README's "Secrets" section change with it.- The hardened readers exist.
lib/sh/secrets.shhasrequire_secret(it refuses a missing file, a dangling link, or one that group or other can read) andread_env_value(it reads a single value from an env file, never sourcing it). GOVERNANCE.md "Repo-Scoped Secrets" requires every shell read of a credential to go through these. - The
~/.secrets/convention is HomeAutomation-Config'sOPERATIONS.md"Host Secrets". The directory is700. A credential only a host script reads is600. A single opaque credential is a file with no extension, read rather than sourced. A missing file is a hard failure, never a fallback to an ambient value. File names are lowercase fields joined by_, per CODESTYLE.md "Script and Utility File Names".
Proposal
- Derive the names from
spec/secrets.jsonand the registry, never from a second list. The names each repository needs are the same set the audit resolves, so provisioning and the audit cannot drift. A secret that is common to the fleet is not the same as one every repository requires.DOCKER_HUB_USERNAMEhas one value fleet-wide, but only a repository with adockertarget needs it. Setting it anywhere else is a stale-secret finding today. - One file per credential in
~/.secrets/, read withrequire_secret. A multi-line value such as the App private key cannot live in an env file anyway. The names below are a starting point (see the open questions):- A common value:
github_<secret>, for examplegithub_codegen_app_private_keyorgithub_docker_hub_username. - A value specific to one repository:
github_<repo>_<secret>, the repository name lowercased with its hyphens kept, for examplegithub_plexcleaner_docker_hub_access_token. - A specific file wins over a common one, so one repository can override a fleet value.
- A common value:
- Write to each store the mechanism names. That is the Actions store, the Dependabot store (
gh secret set --app dependabot), and, where the registry declares a GitHub Environment, that environment (--env). Environments have no vocabulary for their secret names yet, which Declare Per-Environment Secrets and Variables Once and Check Them From the Hub #2070 is about, so environment scope depends on Declare Per-Environment Secrets and Variables Once and Check Them From the Hub #2070 or arrives with it. - Pass every value on stdin, never as an argument. For example,
gh secret set NAME --repo OWNER/REPO < file. A value in argv is visible in the process list and in anything that logs the invocation. No value is ever echoed, logged, or written to a report. - Report what is missing as a list, after the writes. Each entry is the secret name, the store, and the file path it was looked for under, so the maintainer can create the file and re-run. A missing secret does not stop the run setting the others. It does make the run exit non-zero, so the run never reads as fully provisioned. A file that is present but unsafe (too permissive, empty, or a dangling link) is reported as a refusal, separately from a missing one.
--dry-runlists, per store, each name it would set, its source (common or repository), and each name missing. It never prints a value.- The hub declares the
host-secretstype if it becomes a repository whose shell scripts read a credential from disk, as GOVERNANCE.md requires.
Open Questions
Each has a recommendation, to be confirmed before implementation.
- File naming in
~/.secrets/. The recommendation is thegithub_prefix scheme above, which keeps the flat directory the homelab convention uses. The alternative is a subdirectory per repository, which that convention does not use. - Overwrite policy. The API never returns a secret's value, so provisioning cannot tell a stale value from a current one. The recommendation is to set every name whose file is present on every run. A single source of truth makes rotation a file edit and one re-run. The alternative is to set only names missing on GitHub and add a
--rotateflag to overwrite, which keeps a re-run from touching live values. - Where it runs. The recommendation is a
secretsgroup insideconfigure.sh apply, so provisioning stays one command, plus aconfigure.sh checkline naming any required secret absent from GitHub. The alternative is a separatescripts/entry point. - Secrets on GitHub that nothing claims. The recommendation is to report them, which the audit already does, and never delete them. A deletion is irreversible and stays the maintainer's call.
Done When
- A test, run against a synthetic secrets directory and a stubbed
gh, covers each case: a common value, a repository-specific override, every store, a missing file, and an unsafe file. It also asserts that no value reaches argv, stdout, or stderr. repo-config/README.md"Secrets" lists the file name expected for each common secret and the rule that names a repository-specific one.- One live provisioning run sets a test repository's secrets, and
spec/audit.pyreports that repository's secret names clean afterwards.
🤖 Generated with Claude Code
Activity
ptr727 commentedon Nov 8, 2026
Decided by the maintainer, 2026-11-08, settling three of the four open questions:
github_prefix scheme. Common values aregithub_<secret>, and values specific to one repository aregithub_<repo>_<secret>.~/.secrets/is the single source of truth.secretsgroup insideconfigure.sh apply, plus aconfigure.sh checkline naming each required secret absent from GitHub.Still open: secrets on GitHub that nothing claims. The recommendation stays to report them and never delete them.
ptr727 commentedon Nov 8, 2026
Decided by the maintainer, 2026-11-08, settling the last open question:
All four open questions are now settled, so #3932 is ready to implement.
Provision a Repository's Secrets From the Host's Secrets Directory (#…
Promote Develop: Provision a Repository's Secrets From the Host's Sec…