ADR-0032 settles the safety model for the infra and delivery packages: action tiers, the secrets rule, odd jobs in HITL sessions, the dry run as the PR apply gate, and the layered enforcement with credentials as the real boundary. Glossary: odd jobs run only in HITL sessions. Refs #172 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
4.6 KiB
Credentials, not hooks, are the agent safety boundary
The infra packages (ansible, gitops, k8s, later tofu) and the delivery team keep agents
safe by what they cannot do, not by what they are told: stage sessions hold no apply credentials, no
vault password and no Secret read, and every infra change applies by merge after a human approves the
PR. Hooks and skill instructions sit above that boundary as guardrails, because every provider
documents hooks as a guardrail rather than a security boundary and a hook "ask" works only in Claude
Code and Copilot CLI. Decided in holocron#172.
Action tiers
Every package skill classifies each command it drives into one tier:
- Read — lint, syntax check, dry run, diff,
kubectl get/describe/logs,flux get,flux diff,kubectl diff. Free. - Propose — branch, commit, push, open a PR, comment. Free.
- Apply-by-merge — every change to infrastructure. Happens only through an approved merge; the agent never runs it.
- Odd job —
ansible-playbookoutside check mode,tofu apply,flux reconcile. The agent runs it, only in a HITL session the human started and supplied the apply credentials to; that session takes its instruction from the human and loads no issue or PR text. The guard hook asks before each command. - Never —
kubectl apply/delete/edit/patch/scale,helm install/upgrade/rollback,tofu destroy,tofu state rm|mv|push|pull|show,git commit|push --no-verifyandSKIP=,ansible-vault view/decrypt/edit,kubeseal --recovery-unseal, reading vault password files, private keys,.tfstateor Secret objects.
Secrets
Agents never decrypt Ansible Vault or Sealed Secrets and never read the material that would. Stage
sessions use a kubeconfig bound to the built-in view ClusterRole (which excludes Secrets) plus a
read-only aggregated role for SealedSecret objects. Ansible stage work runs only what succeeds with
a placeholder vault password (--syntax-check, ansible-lint, inventory reads); a real
--check --diff runs in CI, which holds the password.
Enforcement layers
- Skill instructions name each command's tier.
deliveryships one portable guard hook: deny the Never tier everywhere; ask for odd-job commands where the runtime supports ask (Claude Code, Copilot CLI), deny them elsewhere.- Host permission settings are documented, not shipped.
- Credential boundary in each consuming repo — the real control:
- agents act as a dedicated Gitea bot user;
- branch protection: approvals allowlist of humans only, dismiss stale approvals, bot off the merge allowlist, protected file patterns for agent config, AGENTS.md, CI workflows and tests;
- every PR carries the dry run (
--check --diff,flux diff, latertofu plan) as a required status and a PR comment; apply happens after merge; - stage leads start only when a user on the human allowlist in
docs/agents/delivery.mdset the gate label, checked against the issue timeline; - a CI check fails if test paths changed after the test author's commit; the implementer hands disputed tests back instead of editing them.
- Pre-commit and CI in the consuming repo are the deterministic backstop.
Considered Options
- Agent drafts odd jobs, human runs them (no agent ever holds apply credentials): rejected by the owner in favour of agent-run odd jobs in HITL sessions with per-command ask.
- Gated vault-touching check runs, or a scoped vault credential for agents: rejected — moving
--check --diffto CI removes the conflict without loosening the read rule. - Apply before merge (Atlantis model): rejected — Gitea has no native support; merge-then-apply with the dry run as a required check is the existing pattern in the reference repo.
- A deny hook on test paths: rejected for v1 — a repo-wide hook cannot portably tell the test author from the implementer, and misses edits made through the shell.
- PATH wrapper scripts: rejected — trivially bypassed.
Consequences
- Most of the safety model is setup in each consuming repo, not code in these packages; it is
documented there (
docs/agents/delivery.md) and checked before the destination test. - Accepted risk: odd jobs leave no durable record beyond the session itself. This departs from the governance rule to log agent actions in reviewable form; the owner accepted it.
- Accepted risk: an odd-job session holds apply credentials; its safety rests on the human starting it, keeping untrusted text out of it, and answering each ask.
- Headless sessions running repo-controlled config are not addressed here; launching from pinned config is part of run mode.