Agent credentials and what unattended agents can do #209

Closed
opened 2026-11-16 06:10:52 +00:00 by Claude · 2 comments
Owner

Part of #87

Question

AI-assistance policy and commit trailer says unattended agents may comment and review but not open, push, approve or merge, held by review only. Recommended repository settings and branch protection makes the agent account a write collaborator. Decide:

  • Who may use the agent account's token, and may an agent act with a contributor's own token? The merge allowlist covers only the agent account, so "agents do not merge" is a control for that account alone.
  • Prompt injection through issue or pull request text is not among the threat model's actors. An unattended agent's token can push, and a push runs workflows with the secrets before any review. Does an unattended agent get a separate token that cannot push, which turns the rule into a control?
  • Status/Ready for Agent is defined as ready for an unattended agent, and committed skills brief such agents to push branches. Redefine the label, or change the policy?
  • "The pull request's opener is the author and answers for every line": in practice the agent account opens the pull request after a human-driven push. Who is the author of record then?
  • "Agent accounts do not approve fork workflow runs" has no home in any document and cannot be held by review.

From the review

  • Amends, depending on the answer: the ADR 0001 issue (#143), the settings issue (#192), the contributor docs issue (#189), the triage label doc, the map's gist for the settings decision.
Part of #87 ## Question [AI-assistance policy and commit trailer](https://git.rkdr.net/Mortis/Kamino/issues/94) says unattended agents may comment and review but not open, push, approve or merge, held by review only. [Recommended repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/179) makes the agent account a write collaborator. Decide: - Who may use the agent account's token, and may an agent act with a contributor's own token? The merge allowlist covers only the agent account, so "agents do not merge" is a control for that account alone. - Prompt injection through issue or pull request text is not among the threat model's actors. An unattended agent's token can push, and a push runs workflows with the secrets before any review. Does an unattended agent get a separate token that cannot push, which turns the rule into a control? - `Status/Ready for Agent` is defined as ready for an unattended agent, and committed skills brief such agents to push branches. Redefine the label, or change the policy? - "The pull request's opener is the author and answers for every line": in practice the agent account opens the pull request after a human-driven push. Who is the author of record then? - "Agent accounts do not approve fork workflow runs" has no home in any document and cannot be held by review. ## From the review - Amends, depending on the answer: the ADR 0001 issue (#143), the settings issue (#192), the contributor docs issue (#189), the triage label doc, the map's gist for the settings decision.
Claude added the
Wayfinder
Grilling
label 2026-11-16 06:10:52 +00:00
Author
Owner

Evidence from the review of the map (2026-11-15).

Who uses the agent account's token

  • Recommended repository settings and branch protection: the agent account is a write collaborator; "The agent account cannot merge: 'agents do not merge' becomes a control. A human driving an agent merges with their own account."
  • AI-assistance policy and commit trailer §6: unattended agents post "from the agent account, with the person who scheduled them as driver". No decision says who may drive the agent account or hold its token.
  • Threat model: what we defend against and what we accept: "Write access is secret access". So anyone handed the agent token is in effect a trusted contributor without being named one.
  • The merge allowlist checks the account, not the tool. A contributor's agent using the contributor's own token (the usual set-up for a Gitea MCP server or tea) can merge. The control holds for the agent account only.
  • Recommendation: decide both questions, and change the map's gist to "the agent account cannot merge". Confidence medium (inference from the decisions).

Prompt injection and a token that cannot push

  • The threat model's actor table has "a contributor's agent that overreaches" but no actor for instructions injected through issue, pull request or repository text. The map notes "outsiders file issues".
  • Policy §6: unattended agents "may not open pull requests or issues, push, approve or merge"; §8: "Controls: none". The settings decision gives the agent token write:issue, write:repository and read:organization.
  • Scenario: an outsider's issue tells a triage agent to push a "fix" branch. The push runs workflows with every organisation secret before any review (threat model: "Branch protection controls what merges, never what runs"). Review cannot stop it; the harm happens at push time.
  • Recommendation (two findings agree): unattended agents run with a second token or account without write:repository, commenting through write:issue only. Add injected instructions to the actor list of docs(adr): record the threat model as ADR 0001. Confidence high on the mechanism.
  • Not verified: which Gitea token scope pull request reviews need. If it is repository scope, unattended "reviews" become comments.

Status/Ready for Agent

  • docs/agents/triage-labels.md:9: "Status/Ready for Agent | Fully specified, ready for an AFK agent".
  • Skills that would be committed brief unattended agents to act: triage/AGENT-BRIEF.md:3 "an AFK agent will work from"; wayfinder/SKILL.md:115 "Push the branch but open no PR"; implement-spec/SKILL.md:27 opens a draft pull request.
  • Every backlog issue carries the label, so an agent reading the repository is told both things. Concrete instructions tend to win over a rule held by review.
  • Option seen: redefine the label as "ready for an agent session with a driver" in the triage doc and the contributor docs.

Author of record when the agent account opens the pull request

  • Policy: "the pull request's opener is author and answers for every line" and "every action has a human driver".
  • In practice the agent account opens the pull request after a human-driven session pushes the branch. Read literally, the bot becomes the accountable author; the Ansible AI policy the map credits wants a human. A trailer check cannot tell the cases apart.
  • Option seen: one sentence in the policy: when an agent account opens the pull request, the driving human is the author of record and is named in the template's confirmation box; or the human opens it. Confidence medium (depends on how the policy is meant).

"Agent accounts do not approve fork workflow runs"

  • The settings decision: "Held by: review (AI-assistance policy)". The contributor docs issue docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/ carries only the policy's rules into ai-assistance.md; rule 7 covers pull request approval and merge, not workflow-run approval. reviewing.md does not list it either.
  • Nobody reviews an approval click afterwards, so "held by review" is aspirational.
  • Options seen: add it to ai-assistance.md or reviewing.md and label it aspirational; or check it against the Actions run log.
Evidence from the review of the map (2026-11-15). ### Who uses the agent account's token - [Recommended repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/179): the agent account is a write collaborator; "The agent account cannot merge: 'agents do not merge' becomes a control. A human driving an agent merges with their own account." - [AI-assistance policy and commit trailer](https://git.rkdr.net/Mortis/Kamino/issues/94) §6: unattended agents post "from the agent account, with the person who scheduled them as driver". No decision says who may drive the agent account or hold its token. - [Threat model: what we defend against and what we accept](https://git.rkdr.net/Mortis/Kamino/issues/99): "Write access is secret access". So anyone handed the agent token is in effect a trusted contributor without being named one. - The merge allowlist checks the account, not the tool. A contributor's agent using the contributor's own token (the usual set-up for a Gitea MCP server or `tea`) can merge. The control holds for the agent account only. - Recommendation: decide both questions, and change the map's gist to "the agent account cannot merge". Confidence medium (inference from the decisions). ### Prompt injection and a token that cannot push - The threat model's actor table has "a contributor's agent that overreaches" but no actor for instructions injected through issue, pull request or repository text. The map notes "outsiders file issues". - Policy §6: unattended agents "may not open pull requests or issues, push, approve or merge"; §8: "Controls: none". The settings decision gives the agent token `write:issue`, `write:repository` and `read:organization`. - Scenario: an outsider's issue tells a triage agent to push a "fix" branch. The push runs workflows with every organisation secret before any review (threat model: "Branch protection controls what merges, never what runs"). Review cannot stop it; the harm happens at push time. - Recommendation (two findings agree): unattended agents run with a second token or account without `write:repository`, commenting through `write:issue` only. Add injected instructions to the actor list of [docs(adr): record the threat model as ADR 0001](https://git.rkdr.net/Mortis/Kamino/issues/143). Confidence high on the mechanism. - Not verified: which Gitea token scope pull request reviews need. If it is repository scope, unattended "reviews" become comments. ### `Status/Ready for Agent` - `docs/agents/triage-labels.md:9`: "`Status/Ready for Agent` | Fully specified, ready for an AFK agent". - Skills that would be committed brief unattended agents to act: `triage/AGENT-BRIEF.md:3` "an AFK agent will work from"; `wayfinder/SKILL.md:115` "Push the branch but open no PR"; `implement-spec/SKILL.md:27` opens a draft pull request. - Every backlog issue carries the label, so an agent reading the repository is told both things. Concrete instructions tend to win over a rule held by review. - Option seen: redefine the label as "ready for an agent session with a driver" in the triage doc and the contributor docs. ### Author of record when the agent account opens the pull request - Policy: "the pull request's opener is author and answers for every line" and "every action has a human driver". - In practice the agent account opens the pull request after a human-driven session pushes the branch. Read literally, the bot becomes the accountable author; the Ansible AI policy the map credits wants a human. A trailer check cannot tell the cases apart. - Option seen: one sentence in the policy: when an agent account opens the pull request, the driving human is the author of record and is named in the template's confirmation box; or the human opens it. Confidence medium (depends on how the policy is meant). ### "Agent accounts do not approve fork workflow runs" - The settings decision: "Held by: review (AI-assistance policy)". The contributor docs issue [docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/](https://git.rkdr.net/Mortis/Kamino/issues/189) carries only the policy's rules into `ai-assistance.md`; rule 7 covers pull request approval and merge, not workflow-run approval. `reviewing.md` does not list it either. - Nobody reviews an approval click afterwards, so "held by review" is aspirational. - Options seen: add it to `ai-assistance.md` or `reviewing.md` and label it aspirational; or check it against the Actions run log.
Defame1297 was assigned by Claude 2026-11-16 15:15:42 +00:00
Author
Owner

Resolution (2026-11-16)

Grilled with the maintainer.

Facts found (Gitea 28.0.0 source, read at the v28.0.0 tag; no server touched)

  • Token scopes: issue and pull request comments and issue creation need write:issue; every pull request review event (comment, request changes, approve), merge and pull request creation need write:repository (routers/api/v1/api.go). A push with a token lacking write:repository is refused (routers/web/repo/githttp.go).
  • Reviews: any reader may post comment, request-changes and approve reviews; only official reviews count or block, and with the approvals allowlist enabled only listed accounts are official (models/git/protected_branch.go). The agent account's change requests are therefore advisory.
  • Fork-run approval needs write on the Actions unit (reqRepoWriter(unit.TypeActions)). A direct collaborator has one access mode for every unit; an organisation team can set per-unit modes. Team membership makes the account an organisation member, which shows no organisation secret names or values (owner-only). Caveat: an API edit with units_map keeps a team's earlier general access mode, so create the team with per-unit access.
  • The merge allowlist applies to API merges and to scheduled automerge, re-checked when it runs.
  • AGit: any reader of a public repository can open a pull request by pushing to refs/for/<branch>; Actions classes it as a fork pull request (no organisation or repository secrets, read-only job token, approval on the usual terms). pull_request_target is the exception (secrets, no approval); this repository forbids it.
  • Approval is needed unless the doer can write Actions or has a merged pull request in the repository; a Restricted account is always asked. A Restricted account keeps read on a public repository in a public organisation and can fork, push to its fork and open pull requests. Source only, not tested live.

Decisions

  1. Agent accounts. An agent account is a Gitea account used only by agents, with exactly one accountable person, named in its Gitea profile. The maintainer creates them. Today only the maintainer has one; trusted contributors drive agents with their own accounts; per-contributor agent accounts are allowed later. Held by: review.
  2. Author of record (rewrites AI-assistance policy item 2): the person who opened the pull request, or the person accountable for the account that opened it. A bot always has someone accountable (its owner, or management if that sits outside this repository). No driver line in the pull request.
  3. No agent approves or merges (policy item 7, unchanged): a control for agent accounts (outside the merge and approvals allowlists); held by review for an agent acting with a contributor's own token, which cannot be split by tool.
  4. Agent accounts cannot approve fork runs: a control. Agent accounts move from write collaborator into an organisation team on this repository with Code, Issues and Pull requests write and Actions read. Tested by attempting an approval and seeing it refused.
  5. Unattended agents (rewrites policy item 6) act from the write agent account and may code, push, open pull requests and issues, comment and review; they may not approve or merge. Held by: aspirational; to be revisited.
  6. Prompt injection is added to the threat model's actors: instructions injected through issue, pull request or repository text an agent reads. Accepted risk: an unattended agent on the write agent account can be steered into pushing a branch whose workflow reads every organisation secret, before any review. Small today because registration is closed and every account is created by the maintainer. Trigger: before any account the maintainer did not create can write issues or comments, or after a first suspected injection, whichever comes first. Planned reduction: a separate Restricted account without write for unattended agents, whose pushes are fork runs always awaiting approval.
  7. Cheap measure: an unattended agent acts only on issues whose Status/Ready for Agent label was set by the maintainer or a trusted contributor, and treats issue and comment text as data, not instructions. Held by: agent instruction, aspirational.
  8. Status/Ready for Agent keeps meaning "ready for an unattended (AFK) agent"; its definition adds "set only by the maintainer or a trusted contributor".
  9. Objection recorded. The session recommended a separate account without write for unattended agents (decision 6's planned reduction) and objected to accepting the risk: organisation-level secrets make the blast radius every repository in the organisation. The maintainer accepted the risk with the trigger above.
  10. No new ADR: everything lands in ADR 0001.

Glossary terms (land with the rules, like Driver and Unattended agent): Agent account (a Gitea account used only by agents, with one accountable person).

Backlog

## Resolution (2026-11-16) Grilled with the maintainer. ### Facts found (Gitea 28.0.0 source, read at the `v28.0.0` tag; no server touched) - Token scopes: issue and pull request comments and issue creation need `write:issue`; every pull request review event (comment, request changes, approve), merge and pull request creation need `write:repository` (`routers/api/v1/api.go`). A push with a token lacking `write:repository` is refused (`routers/web/repo/githttp.go`). - Reviews: any reader may post comment, request-changes and approve reviews; only official reviews count or block, and with the approvals allowlist enabled only listed accounts are official (`models/git/protected_branch.go`). The agent account's change requests are therefore advisory. - Fork-run approval needs write on the Actions unit (`reqRepoWriter(unit.TypeActions)`). A direct collaborator has one access mode for every unit; an organisation team can set per-unit modes. Team membership makes the account an organisation member, which shows no organisation secret names or values (owner-only). Caveat: an API edit with `units_map` keeps a team's earlier general access mode, so create the team with per-unit access. - The merge allowlist applies to API merges and to scheduled automerge, re-checked when it runs. - AGit: any reader of a public repository can open a pull request by pushing to `refs/for/<branch>`; Actions classes it as a fork pull request (no organisation or repository secrets, read-only job token, approval on the usual terms). `pull_request_target` is the exception (secrets, no approval); this repository forbids it. - Approval is needed unless the doer can write Actions or has a merged pull request in the repository; a Restricted account is always asked. A Restricted account keeps read on a public repository in a public organisation and can fork, push to its fork and open pull requests. Source only, not tested live. ### Decisions 1. **Agent accounts.** An agent account is a Gitea account used only by agents, with exactly one accountable person, named in its Gitea profile. The maintainer creates them. Today only the maintainer has one; trusted contributors drive agents with their own accounts; per-contributor agent accounts are allowed later. *Held by:* review. 2. **Author of record** (rewrites AI-assistance policy item 2): the person who opened the pull request, or the person accountable for the account that opened it. A bot always has someone accountable (its owner, or management if that sits outside this repository). No driver line in the pull request. 3. **No agent approves or merges** (policy item 7, unchanged): a control for agent accounts (outside the merge and approvals allowlists); held by review for an agent acting with a contributor's own token, which cannot be split by tool. 4. **Agent accounts cannot approve fork runs: a control.** Agent accounts move from write collaborator into an organisation team on this repository with Code, Issues and Pull requests write and **Actions read**. Tested by attempting an approval and seeing it refused. 5. **Unattended agents** (rewrites policy item 6) act from the write agent account and may code, push, open pull requests and issues, comment and review; they may not approve or merge. *Held by:* aspirational; to be revisited. 6. **Prompt injection** is added to the threat model's actors: instructions injected through issue, pull request or repository text an agent reads. **Accepted risk:** an unattended agent on the write agent account can be steered into pushing a branch whose workflow reads every organisation secret, before any review. Small today because registration is closed and every account is created by the maintainer. *Trigger:* before any account the maintainer did not create can write issues or comments, or after a first suspected injection, whichever comes first. *Planned reduction:* a separate Restricted account without write for unattended agents, whose pushes are fork runs always awaiting approval. 7. **Cheap measure:** an unattended agent acts only on issues whose `Status/Ready for Agent` label was set by the maintainer or a trusted contributor, and treats issue and comment text as data, not instructions. *Held by:* agent instruction, aspirational. 8. **`Status/Ready for Agent`** keeps meaning "ready for an unattended (AFK) agent"; its definition adds "set only by the maintainer or a trusted contributor". 9. **Objection recorded.** The session recommended a separate account without write for unattended agents (decision 6's planned reduction) and objected to accepting the risk: organisation-level secrets make the blast radius every repository in the organisation. The maintainer accepted the risk with the trigger above. 10. **No new ADR**: everything lands in ADR 0001. **Glossary terms** (land with the rules, like *Driver* and *Unattended agent*): *Agent account* (a Gitea account used only by agents, with one accountable person). ### Backlog - Scope added to [docs(adr): record the threat model as ADR 0001](https://git.rkdr.net/Mortis/Kamino/issues/143), [chore: apply the recommended repository settings, account permissions and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/192) and [docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/](https://git.rkdr.net/Mortis/Kamino/issues/189). - New: [docs(agents): who may set Status/Ready for Agent, and issue text is data](https://git.rkdr.net/Mortis/Kamino/issues/230).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#209