docs(adr): state held-by on every layer and tighten the register

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-21 22:10:14 +00:00
1 parent e36872c255
commit 3ddbc751b5
2 files changed
+45 -57

No files matched your search

+22 -30
View File
@@ -30,19 +30,18 @@ reduction. A later decision that accepts a risk adds an entry here.
every account. Cheap measure: an unattended agent acts only on `Status/Ready for Agent` every account. Cheap measure: an unattended agent acts only on `Status/Ready for Agent`
issues opened by the maintainer, a trusted contributor or an agent account, never adds that issues opened by the maintainer, a trusted contributor or an agent account, never adds that
label itself, and treats issue text as data ([rule](docs/agents/issue-tracker.md)). label itself, and treats issue text as data ([rule](docs/agents/issue-tracker.md)).
- **Trigger:** an account the maintainer did not create can write issues or comments, or a - **Triggers**, the two moments to decide again: (1) an account the maintainer did not create
first injection is suspected; or the release bot's secret is stored. can write issues or comments, or a first injection is suspected; (2) the release bot's
- **Planned reduction:** none for now; decided again at either trigger. secret is stored.
- **Planned reduction:** none for now.
### Every write-capable token reaches the secrets ### Every write-capable token reaches the secrets
- **Risk:** least privilege limits a token's API scope and merge rights, not its reach: any - **Risk:** see the trust boundary in [ADR 0001](docs/adr/0001-threat-model.md).
write-capable token (humans, the agent account, Renovate, the release bot) can push a - **Why accepted:** write access goes only to those trusted with the secrets, and every
branch whose workflow reads every secret this repository's workflows can reach. secret is rotated when a writer is removed or a write-capable token leaks.
- **Why accepted:** write access goes only to people and bots trusted with the secrets, and - **Trigger:** ephemeral runners, or secrets scoped to environments, are adopted.
every secret is rotated when a writer is removed or a token leaks. - **Planned reduction:** none beyond the trigger.
- **Trigger:** ephemeral runners, or secrets scoped to environments, become available.
- **Planned reduction:** none planned beyond the trigger.
### Shared runner ### Shared runner
@@ -50,12 +49,11 @@ reduction. A later decision that accepts a risk adds an entry here.
the Renovate token. A Molecule job runs as root and can plant code in the cached molecule the Renovate token. A Molecule job runs as root and can plant code in the cached molecule
virtualenv and collection cache that later jobs, the privileged ones included, reuse. virtualenv and collection cache that later jobs, the privileged ones included, reuse.
- **Why accepted:** only trusted contributors' runs execute on it. The runner is to be - **Why accepted:** only trusted contributors' runs execute on it. The runner is to be
registered for this repository only, never for the organisation; another repository in the registered for this repository only, never for the organisation. Another repository in the
organisation (the skills source) runs on a runner sharing no host, Docker daemon, cache or organisation (the skills source) is to run on a runner sharing no host, Docker daemon, cache
filesystem with it and shares no secret with it. That repository's content reaches this one or filesystem with it, and to share no secret with it; its content reaches this repository
only through the content re-check and code-owner review of `.claude/`. only through the content re-check and code-owner review of `.claude/`.
- **Trigger:** ephemeral runners become available. - **Trigger and planned reduction:** ephemeral runners, a clean host per privileged job.
- **Planned reduction:** ephemeral runners, a clean host per privileged job.
### Required checks can be satisfied by a posted commit status ### Required checks can be satisfied by a posted commit status
@@ -63,18 +61,14 @@ reduction. A later decision that accepts a risk adds an entry here.
not check that Actions posted them, and the commit status API needs only code write. A not check that Actions posted them, and the commit status API needs only code write. A
leaked bot or agent token could post `success` for Lint, Build and Molecule on its own leaked bot or agent token could post `success` for Lint, Build and Molecule on its own
branch. Not tested on this server. branch. Not tested on this server.
- **Why accepted:** a compromised bot or agent token is defended by cheap measures only - **Why accepted:** a compromised bot or agent token gets cheap measures only (ADR 0001).
(ADR 0001, actors). - **Trigger and planned reduction:** none; accepted as is.
- **Trigger:** none set.
- **Planned reduction:** none planned.
### Agent-side hooks are a convenience, not a control ### Agent-side hooks are a convenience, not a control
- **Risk:** agent-side hooks bind only Claude Code and can be switched off locally. - **Risk:** agent-side hooks bind only Claude Code and can be switched off locally.
- **Why accepted:** server-side controls (branch protection, CI) hold the rules; the hooks - **Why accepted:** server-side controls (branch protection, CI) hold the rules.
only catch mistakes earlier. - **Trigger and planned reduction:** none; accepted as is.
- **Trigger:** none set.
- **Planned reduction:** none planned.
### Release assets and tags ### Release assets and tags
@@ -83,10 +77,9 @@ reduction. A later decision that accepts a risk adds an entry here.
tag message's sha256 catches a swap by any writer except the release bot, so a leaked tag message's sha256 catches a swap by any writer except the release bot, so a leaked
release-bot token can replace a release unreviewed. This is why tag protection alone does release-bot token can replace a release unreviewed. This is why tag protection alone does
not guard releases once a release token exists. not guard releases once a release token exists.
- **Why accepted:** artifact signing is not done; consumers who need more pin the git route - **Why accepted:** no artifact signing; consumers who need more pin the git route to a
to a commit. commit.
- **Trigger:** none set. - **Trigger and planned reduction:** none; accepted as is.
- **Planned reduction:** none planned.
### Release tarball file modes ### Release tarball file modes
@@ -94,8 +87,7 @@ reduction. A later decision that accepts a risk adds an entry here.
Collection metadata, but not file modes. A writer who swaps the release tarball can change Collection metadata, but not file modes. A writer who swaps the release tarball can change
a file's exec bit undetected. a file's exec bit undetected.
- **Why accepted:** the Collection ships roles only. - **Why accepted:** the Collection ships roles only.
- **Trigger:** none set. - **Trigger and planned reduction:** none; accepted as is.
- **Planned reduction:** none planned.
### A push onto a Renovate pull request that has a scheduled merge ### A push onto a Renovate pull request that has a scheduled merge
@@ -105,4 +97,4 @@ reduction. A later decision that accepts a risk adds an entry here.
approval, which a push dismisses; every account that can push there already reaches every approval, which a push dismisses; every account that can push there already reaches every
secret. There is no `renovate/*` push allowlist. secret. There is no `renovate/*` push allowlist.
- **Trigger:** a token that can push here but cannot reach the secrets. - **Trigger:** a token that can push here but cannot reach the secrets.
- **Planned reduction:** none planned. - **Planned reduction:** none for now.
+23 -27
View File
@@ -5,19 +5,18 @@ Status: accepted
## Context ## Context
This repository publishes Ansible roles that change the hosts they run on, built and tested by This repository publishes Ansible roles that change the hosts they run on, built and tested by
CI that holds secrets. Contributors, many working with AI agents, push to it. The guardrails CI that holds secrets. Contributors, many working with AI agents, push to it. Its rules and
defend first against mistakes and over-eager agents; against malice they take cheap measures controls defend first against mistakes and over-eager agents; against malice they take cheap
and write down what they leave undefended. measures and write down what they leave undefended.
## Decision ## Decision
**Actors and how far each is defended.** Held by is control (a named check), review (a person **Actors and how far each is defended.**
other than the one acting sees the change first) or aspirational (checked by nothing).
| Actor | Defence | | Actor | Defence |
|---|---| |---|---|
| A contributor with write access who makes a mistake | Controls | | A contributor with write access who makes a mistake | Controls |
| A contributor's agent that overreaches (turns a check green, weakens a gate, adds a secret reference) | Controls | | A contributor's agent that overreaches (turns a check green, weakens a control, adds a secret reference) | Controls |
| An outsider's fork or AGit pull request | A human closes it without approving its runs and points to issues; never approved or merged | | An outsider's fork or AGit pull request | A human closes it without approving its runs and points to issues; never approved or merged |
| Instructions injected through issue, pull request or repository text an agent reads | Cheap measures; the rest is accepted | | Instructions injected through issue, pull request or repository text an agent reads | Cheap measures; the rest is accepted |
| A malicious contributor, or a stolen contributor token | Cheap measures; the rest is accepted | | A malicious contributor, or a stolen contributor token | Cheap measures; the rest is accepted |
@@ -35,29 +34,28 @@ repository is access to every secret this repository's workflows can reach. Leas
limits a token's API scope and merge rights, not that reach: every write-capable token limits a token's API scope and merge rights, not that reach: every write-capable token
(humans, the agent account, Renovate, the release bot) can push a branch whose workflow reads (humans, the agent account, Renovate, the release bot) can push a branch whose workflow reads
them, before any review. Secrets live at repository level once a second repository joins the them, before any review. Secrets live at repository level once a second repository joins the
organisation. When a writer is removed, or any write-capable token leaks, the maintainer organisation (aspirational). When a writer is removed, or any write-capable token leaks, the
rotates every repository secret ([rotation list](../contributing/maintaining.md)). maintainer rotates every repository secret ([rotation list](../contributing/maintaining.md)).
**Least-privilege targets.** Each bot or agent token does only its own job, and none owns the **Least-privilege targets** (aspirational: settings no check reads). Each bot or agent token
organisation. Each agent account has exactly one accountable person, named in its profile, does only its own job, and none owns the organisation. Each agent account has exactly one
and sits in a team with Actions read, so it cannot approve fork runs. The push allowlist accountable person, named in its profile, and sits in a team with Actions read, so it cannot
applies to `release/*` only. approve fork runs. The push allowlist applies to `release/*` only.
**Layers against a pull request that removes its own gate.** **Layers against a pull request that removes its own control.** Held by is control (naming
the check), review (a person other than the one acting sees the change first) or aspirational.
- Code owners: gate files, `docs/adr/`, every `AGENTS.md` and `.claude/` need the
maintainer's approval (`CODEOWNERS`); held by control once branch protection requires it.
- Secrets: each secret is referenced by exactly one workflow; held by code-owner review - Secrets: each secret is referenced by exactly one workflow; held by code-owner review
([rule](../../.gitea/workflows/AGENTS.md)). ([rule](../../.gitea/workflows/AGENTS.md)).
- Judge scripts: a script that decides whether a pull request's own diff is allowed runs from - Judge scripts: a script that decides whether a pull request's own diff is allowed runs from
`main`'s copy, called from a workflow only the maintainer can change; a script that checks `main`'s copy, called from a workflow only the maintainer can change (CODEOWNERS); a script
content or the built artefact runs from the pull request's copy, and code-owner review that checks content or the built artifact runs from the pull request's copy. Both held by
covers edits to it. code-owner review.
- Agent instructions: committed skills and agents (`.claude/`) are owned like `AGENTS.md`, - Agent instructions: committed skills and agents (`.claude/`) are owned like `AGENTS.md`,
because a skill can grant itself tools, run shell commands and register hooks without a because a skill can grant itself tools, run shell commands and register hooks without a
trust prompt. trust prompt; held by code-owner review.
- Local runs: review the hook, script and agent-file changes of a branch you did not write - Local runs: review the hook and script changes of a branch you did not write before running
before running it; held by review ([rule](../contributing/reviewing.md)). it; held by review ([rule](../contributing/reviewing.md)).
**Every accepted risk is written down** with why it is accepted, its trigger and its planned **Every accepted risk is written down** with why it is accepted, its trigger and its planned
reduction, in the [Accepted risks](../../SECURITY.md#accepted-risks) register. Later reduction, in the [Accepted risks](../../SECURITY.md#accepted-risks) register. Later
@@ -66,13 +64,11 @@ decisions add entries there, not here.
## Reason ## Reason
Branch protection controls what merges, never what runs: anyone who can push a branch runs Branch protection controls what merges, never what runs: anyone who can push a branch runs
their own workflow with the secrets. So trust is drawn at write access, and the controls their own workflow with the secrets. So trust is drawn at write access, and the controls aim
aim at the likelier failure, a well-meant change that weakens a gate. at the likelier failure, a well-meant change that weakens a control.
## Not done ## Not done
- **Signed commits:** a signature proves which key signed, not who wrote the change. - **Signed commits:** a signature proves which key signed, not who wrote the change.
- **CLA or DCO:** GPL-3.0-or-later and REUSE already settle licensing, and only trusted - **CLA or DCO:** GPL-3.0-or-later and REUSE already settle licensing.
contributors' changes merge. - **Signing release artifacts:** see the register entry on release assets and tags.
- **Signing release artifacts:** the tag message's checksum covers what review can; the
remaining gap is an accepted risk.