Recommended repository settings and branch protection #179

Closed
opened 2026-11-15 18:57:47 +00:00 by Claude · 2 comments
Owner

Part of #87

Question

What settings, branch protection, tag protection and account permissions should the maintainer apply so that each role (maintainer, trusted contributor, friend, outsider, every bot and the agent account) can do only its own job?

Inputs already decided

The output is a recommendation; the maintainer applies it.

Part of #87 ## Question What settings, branch protection, tag protection and account permissions should the maintainer apply so that each role (maintainer, trusted contributor, friend, outsider, every bot and the agent account) can do only its own job? ## Inputs already decided - [Record current repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/90): today's state. The bots and the agent account are organisation owners; zero approvals; there is no CODEOWNERS file. - [Threat model: what we defend against and what we accept](https://git.rkdr.net/Mortis/Kamino/issues/99): each token can do only its own job and none is an organisation owner; "Block on CODEOWNERS review" is on for `main`. - [AI-assistance policy and commit trailer](https://git.rkdr.net/Mortis/Kamino/issues/94): the agent account can never approve (not an owner, not a code owner). - [CI image pipeline: keep, simplify or replace](https://git.rkdr.net/Mortis/Kamino/issues/96): branches must be up to date before merging; runner `capacity` 2. - [Renovate automerge posture](https://git.rkdr.net/Mortis/Kamino/issues/97): unattended bot merges rely on the required checks and on admin-override blocking staying on. - [Release automation](https://git.rkdr.net/Mortis/Kamino/issues/98): the `v*` tag allowlist is the maintainer plus the `kamino-release` bot, whose token is a repository secret. - [How friends get code in](https://git.rkdr.net/Mortis/Kamino/issues/100): trusted contributors are write collaborators, not organisation members; friends and outsiders have no repository permission; self-registration stays closed. The output is a recommendation; the maintainer applies it.
Claude added the
Wayfinder
Grilling
label 2026-11-15 18:57:47 +00:00
Defame1297 was assigned by Claude 2026-11-15 20:41:49 +00:00
Author
Owner

Resolution (2026-11-15)

Grilled with the maintainer. A recommendation; the maintainer applies it.

Facts found (Gitea 28.0.0 source, read at the v28.0.0 tag)

  • "Require approval from code owners" (block_on_codeowner_reviews): every CODEOWNERS rule that matches a changed file needs an approval from one of its owners; approvals from accounts outside the approvals allowlist count; stale or dismissed ones do not. CODEOWNERS is read from the base branch.
  • Patterns are anchored regular expressions, not globs (\.gitea/.*, not .gitea/**). !pattern is a separate rule, not an exception. Nothing exempts a pull request by author or branch.
  • The pull request's author is removed from each rule's owners; a rule whose only owner is the author is skipped.
  • A scheduled automerge waits for the code-owner approval and merges itself when it arrives.
  • Anyone with write on the Actions unit can approve fork workflow runs.
  • The merge allowlist is checked against whoever scheduled the merge; it drops accounts without write.
  • Organisation package push needs Packages: write from a team plus a write:package token; that a team with no repositories suffices is inferred, not tested.

Accounts

Account Access Token scopes
Maintainer Only member of organisation Owners; only code owner; v* tag allowlist; merge allowlist own
Trusted contributor Write collaborator on this repository; merge allowlist by name; may approve fork runs own
Friend, outsider Account only, no repository permission; self-registration stays closed own
Agent account Write collaborator on this repository; not in the merge or approvals allowlist, not a code owner write:issue, write:repository, read:organization
Renovate bot Write collaborator on this repository; merge allowlist write:repository, write:issue, read:package
Release bot Write collaborator on this repository; v* tag allowlist; not in the merge allowlist write:repository
Package push bot Organisation team with Packages: write and no repositories write:package

No bot or agent account stays in Owners.

main rule

Today's settings stay (required Lint, Build, Molecule; 0 approvals; approvals allowlist the maintainer; dismiss stale; block on rejected and official review requests; block on outdated branch; admin override blocked). Added: require approval from code owners and the merge allowlist (maintainer, each trusted contributor, Renovate bot).

Effects:

  • The agent account cannot merge: "agents do not merge" becomes a control. A human driving an agent merges with their own account.
  • A Renovate pull request that touches a gate file waits for the maintainer's approval, then merges itself. Chosen over leaving the block off (no mechanical stop on gate files) and over a custom approval check (a custom checker). This narrows Renovate automerge posture.
  • The maintainer's own pull requests skip the code-owner rules.

Other settings

  • Secrets stay organisation-level (the maintainer expects more repositories to need them). Consequence: write access to any repository in the organisation is secret access to all of them; recorded in ADR 0001.
  • No further branch or tag rules (release/next, renovate/* stay unprotected; their checks hold them).
  • Units: wiki off; issues, pull requests, Actions, packages, releases and projects on.
  • Merge styles unchanged, merge commit the default.

Rules

  • Agent accounts do not approve fork workflow runs. Gitea gives that to every write user. Held by: review (AI-assistance policy).
  • Granting write on any repository in the organisation is granting this repository's secrets. Held by: review (ADR 0001).

Order

Each bot gets its new access and is tested (one image push, one Renovate run, one agent-account branch push) before it leaves Owners.

No ADR: each setting reverses in a minute.

Not verified

  • A Packages-only team pushing an image (tested by the implementation issue before the bot leaves Owners).
  • That a non-member write collaborator stays in the merge allowlist after saving.
## Resolution (2026-11-15) Grilled with the maintainer. A recommendation; the maintainer applies it. ### Facts found (Gitea 28.0.0 source, read at the `v28.0.0` tag) - "Require approval from code owners" (`block_on_codeowner_reviews`): every CODEOWNERS rule that matches a changed file needs an approval from one of its owners; approvals from accounts outside the approvals allowlist count; stale or dismissed ones do not. CODEOWNERS is read from the base branch. - Patterns are anchored regular expressions, not globs (`\.gitea/.*`, not `.gitea/**`). `!pattern` is a separate rule, not an exception. Nothing exempts a pull request by author or branch. - The pull request's author is removed from each rule's owners; a rule whose only owner is the author is skipped. - A scheduled automerge waits for the code-owner approval and merges itself when it arrives. - Anyone with write on the Actions unit can approve fork workflow runs. - The merge allowlist is checked against whoever scheduled the merge; it drops accounts without write. - Organisation package push needs Packages: write from a team plus a `write:package` token; that a team with no repositories suffices is inferred, not tested. ### Accounts | Account | Access | Token scopes | |---|---|---| | Maintainer | Only member of organisation Owners; only code owner; `v*` tag allowlist; merge allowlist | own | | Trusted contributor | Write collaborator on this repository; merge allowlist by name; may approve fork runs | own | | Friend, outsider | Account only, no repository permission; self-registration stays closed | own | | Agent account | Write collaborator on this repository; not in the merge or approvals allowlist, not a code owner | `write:issue`, `write:repository`, `read:organization` | | Renovate bot | Write collaborator on this repository; merge allowlist | `write:repository`, `write:issue`, `read:package` | | Release bot | Write collaborator on this repository; `v*` tag allowlist; not in the merge allowlist | `write:repository` | | Package push bot | Organisation team with Packages: write and no repositories | `write:package` | No bot or agent account stays in Owners. ### `main` rule Today's settings stay (required Lint, Build, Molecule; 0 approvals; approvals allowlist the maintainer; dismiss stale; block on rejected and official review requests; block on outdated branch; admin override blocked). Added: **require approval from code owners** and the **merge allowlist** (maintainer, each trusted contributor, Renovate bot). Effects: - The agent account cannot merge: "agents do not merge" becomes a control. A human driving an agent merges with their own account. - A Renovate pull request that touches a gate file waits for the maintainer's approval, then merges itself. Chosen over leaving the block off (no mechanical stop on gate files) and over a custom approval check (a custom checker). This narrows [Renovate automerge posture](https://git.rkdr.net/Mortis/Kamino/issues/97). - The maintainer's own pull requests skip the code-owner rules. ### Other settings - **Secrets stay organisation-level** (the maintainer expects more repositories to need them). Consequence: write access to any repository in the organisation is secret access to all of them; recorded in ADR 0001. - **No further branch or tag rules** (`release/next`, `renovate/*` stay unprotected; their checks hold them). - **Units:** wiki off; issues, pull requests, Actions, packages, releases and projects on. - **Merge styles** unchanged, merge commit the default. ### Rules - Agent accounts do not approve fork workflow runs. Gitea gives that to every write user. *Held by:* review (AI-assistance policy). - Granting write on any repository in the organisation is granting this repository's secrets. *Held by:* review (ADR 0001). ### Order Each bot gets its new access and is tested (one image push, one Renovate run, one agent-account branch push) before it leaves Owners. No ADR: each setting reverses in a minute. ### Not verified - A Packages-only team pushing an image (tested by the implementation issue before the bot leaves Owners). - That a non-member write collaborator stays in the merge allowlist after saving.
Author
Owner

Review of the map (2026-11-17).

Partly superseded by Agent credentials and what unattended agents can do: the agent account is not a write collaborator. It sits in an organisation team with Code, Issues and Pull requests write and Actions read, so "agent accounts do not approve fork workflow runs" is a control, no longer held by review.

Partly superseded by Code-owner approval against Renovate automerge, and where secrets live: every secret this repository uses becomes a repository secret when a second repository joins the organisation, and new secrets start there. renovate/* and release/* get push and force-push allowlists (the bot plus the maintainer), so "no further branch or tag rules" no longer holds. Whether those two rules stay is open in Pushes onto a pull request that has a scheduled merge.

The facts here were read at Gitea 28.0.0. The server reports 28.3.0 on 2026-11-17; token scopes and team units were not re-read.

Review of the map (2026-11-17). Partly superseded by [Agent credentials and what unattended agents can do](https://git.rkdr.net/Mortis/Kamino/issues/209): the agent account is not a write collaborator. It sits in an organisation team with Code, Issues and Pull requests write and Actions read, so "agent accounts do not approve fork workflow runs" is a control, no longer held by review. Partly superseded by [Code-owner approval against Renovate automerge, and where secrets live](https://git.rkdr.net/Mortis/Kamino/issues/210): every secret this repository uses becomes a repository secret when a second repository joins the organisation, and new secrets start there. `renovate/*` and `release/*` get push and force-push allowlists (the bot plus the maintainer), so "no further branch or tag rules" no longer holds. Whether those two rules stay is open in [Pushes onto a pull request that has a scheduled merge](https://git.rkdr.net/Mortis/Kamino/issues/248). The facts here were read at Gitea 28.0.0. The server reports 28.3.0 on 2026-11-17; token scopes and team units were not re-read.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#179