diff --git a/AGENTS.md b/AGENTS.md index 78a8798..7c0a466 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -86,6 +86,8 @@ renovate.json dependency automation ## Before you start - Before your first commit in a clone: [docs/contributing/setup.md](docs/contributing/setup.md). +- Before cutting a release, granting or withdrawing access, rotating a secret, or changing repository or + organisation settings: [docs/contributing/maintaining.md](docs/contributing/maintaining.md). - Before filing an issue or opening a pull request: use the headings of the matching template in `.gitea/`, never your tool's built-in body; read [docs/contributing/making-a-change.md](docs/contributing/making-a-change.md). - Before bringing content in from another repository: [docs/contributing/making-a-change.md](docs/contributing/making-a-change.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f93a349..2ce2e6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,6 +24,8 @@ vulnerability as [SECURITY.md](SECURITY.md) says, never in an issue. - [code-style.md](docs/contributing/code-style.md): code style outside roles. - [reviewing.md](docs/contributing/reviewing.md): closing a fork pull request, merging someone else's, running an unmerged branch locally. +- [maintaining.md](docs/contributing/maintaining.md): the maintainer's procedures: secrets, access, + settings, releases. Rules tied to one directory are in that directory's `AGENTS.md`: [roles/](roles/AGENTS.md), [scripts/](scripts/AGENTS.md), [.gitea/workflows/](.gitea/workflows/AGENTS.md), diff --git a/docs/contributing/maintaining.md b/docs/contributing/maintaining.md new file mode 100644 index 0000000..3fbf6e2 --- /dev/null +++ b/docs/contributing/maintaining.md @@ -0,0 +1,88 @@ +# Maintaining + +Read this before cutting a release, granting or withdrawing access, rotating a secret, or changing +repository or organisation settings. Only the maintainer does these; this file records how, and what +the settings should be. + +Every rule gives its reason and how it is held: by a control (a named hook, check or setting), by +review, or aspirational (checked by nothing and nobody). Most acts here are seen by nobody else, so +they are aspirational unless a control is named. The positions are defined in +[GLOSSARY.md](../../GLOSSARY.md). + +## Secrets and rotation + +Every secret the workflows in [.gitea/workflows/](../../.gitea/workflows/) reference: + +| Secret | Used by | Account (role) | Token scope | Issued and stored | +|---|---|---|---|---| +| `PACKAGE_PUSH_USER` | `image.yml` | Package push bot | none: the account's login name | Organisation secret | +| `PACKAGE_PUSH_TOKEN` | `image.yml` | Package push bot | `write:package` | Token issued on the bot's account in this Gitea; organisation secret | +| `RENOVATE_BOT_TOKEN` | `renovate.yml` | Renovate bot | `write:repository`, `write:issue`, `read:package` | Token issued on the bot's account in this Gitea; organisation secret | +| `GITHUB_TOKEN` | `build.yml`, `lint.yml`, `molecule.yml`, `image.yml`, `gitea-release-key.yml` | none: the job token | set per workflow by `permissions:` | Issued by Gitea Actions for each run and expires with it; nothing to rotate | + +- **When a trusted contributor's access is withdrawn, or a secret may have leaked, rotate every secret + in the table: issue a new token on the bot's account, replace the secret, then revoke the old token.** + *Reason:* any write-capable token can push a branch whose workflow reads every secret, so one + withdrawn or leaked credential exposes them all. + *Held by:* aspirational. + +## Granting and withdrawing a trusted contributor + +- **Grant: make the account a write collaborator on this repository and add it to the merge allowlist + of `main`; save, reload the page and check the name is still there.** + *Reason:* the allowlist silently drops an account without write access, and only a listed account + can merge. + *Held by:* aspirational. +- **Withdraw: remove the collaborator access and the merge-allowlist entry, then rotate every secret + (see above).** + *Reason:* write access is secret access, so the secrets the account could read must change. + *Held by:* aspirational. + +## Agent and bot accounts + +- **Only the maintainer creates agent and bot accounts.** + *Reason:* every account on this forge is then one the maintainer knows. + *Held by:* aspirational. +- **An agent account names its one accountable person in its Gitea profile.** + *Reason:* every change has a human who answers for it, and an agent is not that human. + *Held by:* aspirational. +- **Each account's token carries only the scopes its job needs:** the agent account `write:issue`, + `write:repository` and `read:organization`; the bots as in the secrets table. + *Reason:* least privilege limits what a leaked or misused token can do through the API. + *Held by:* aspirational. + +## Intended settings + +A checklist, not rules: what the repository and organisation settings should be. The maintainer +applies them and checks them against this list after any change. + +- Branch protection on `main`: required checks Lint, Build and Molecule; zero required approvals; + "Require approval from code owners"; "Dismiss stale approvals"; block on rejected and on official + review requests; block on an outdated branch; administrators cannot override; the approvals + allowlist is the maintainer. +- Merge allowlist on `main`: the maintainer, each trusted contributor and the Renovate bot. +- Push allowlist on `release/*`: the maintainer; no rule for `renovate/*`. +- Tag protection on `v*`, with the maintainer on its allowlist. +- No bot or agent account in the organisation's Owners team. +- The agent account sits in an organisation team on this repository with Code, Issues and Pull + requests write and Actions read, so it cannot approve fork runs. +- Wiki off. +- The runner is registered for this repository only; the skills source's runner is isolated from it. +- Self-registration closed. +- Gitea 28.4.0 or later, because its fork-run approval gate keeps outsiders' forks from running. + +## Releases + +A **full run** is a `schedule` or `workflow_dispatch` run of `molecule.yml` on `main`. + +- **The maintainer cuts a release by hand: an annotated tag `vX.Y.Z` on `main`, equal to the version + in `galaxy.yml`.** + *Reason:* consumers install by tag, so a tag is the release. + *Held by:* control: tag protection on `v*`, and Build's release tag check. +- **The maintainer owns triage of a failed full Molecule run; any trusted contributor may fix it.** + *Reason:* the nightly is the only run of the scenarios a pull request's diff did not select. + *Held by:* aspirational. +- **No release while the latest full run on `main` is red. After a fix, dispatch Molecule on `main` + and release only once it succeeds.** + *Reason:* a release must not ship drift the nightly has seen. + *Held by:* aspirational.