Code-owner approval against Renovate automerge, and where secrets live #210

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

Part of #87

Question

Recommended repository settings and branch protection turns on "require approval from code owners". The code-owned files include the tool pins, their lock, requirements.yml and the workflows that hold image pins. So nearly every pull request that Renovate automerge posture says merges with no approval would wait for the maintainer, and the pin pull request no longer follows an image build at once. Decide:

  • Which classes of bot pull request still merge unattended? Is CODEOWNERS narrowed to keep them, or is the automerge decision amended?
  • Gitea reads the first of CODEOWNERS, docs/CODEOWNERS and .gitea/CODEOWNERS. A pull request that adds a root file would match no rule and replace the gates. Where does the file live, or are all three paths owned?
  • Gate inputs CODEOWNERS misses: images/** (its build steps run next to the push credential), the lint configs, the sanity ignore files, tests/scripts, REUSE.toml, changelogs/config.yaml. Own them or record the risk?
  • Secrets stay organisation-level, so write access to any repository in the organisation is secret access here, and the Renovate bot is on the merge allowlist. Repository secrets instead? "Least privilege for tokens" cannot hold while every write token can read every secret; is that recorded as accepted?
  • renovate/* and release/* branches are unprotected: any writer can push onto a bot pull request and ride its scheduled merge. Push allowlists on both?
  • What happens when write access is withdrawn or a writer's token leaks? Write access is secret access, so that means rotating every secret.

From the review

  • Amends, depending on the answer: the CODEOWNERS issue (#144), the settings issue (#192), the ADR 0001 issue (#143), the Renovate issues (#172, #173), the map's gist for the automerge decision.
Part of #87 ## Question [Recommended repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/179) turns on "require approval from code owners". The code-owned files include the tool pins, their lock, `requirements.yml` and the workflows that hold image pins. So nearly every pull request that [Renovate automerge posture](https://git.rkdr.net/Mortis/Kamino/issues/97) says merges with no approval would wait for the maintainer, and the pin pull request no longer follows an image build at once. Decide: - Which classes of bot pull request still merge unattended? Is CODEOWNERS narrowed to keep them, or is the automerge decision amended? - Gitea reads the first of `CODEOWNERS`, `docs/CODEOWNERS` and `.gitea/CODEOWNERS`. A pull request that adds a root file would match no rule and replace the gates. Where does the file live, or are all three paths owned? - Gate inputs CODEOWNERS misses: `images/**` (its build steps run next to the push credential), the lint configs, the sanity ignore files, `tests/scripts`, `REUSE.toml`, `changelogs/config.yaml`. Own them or record the risk? - Secrets stay organisation-level, so write access to any repository in the organisation is secret access here, and the Renovate bot is on the merge allowlist. Repository secrets instead? "Least privilege for tokens" cannot hold while every write token can read every secret; is that recorded as accepted? - `renovate/*` and `release/*` branches are unprotected: any writer can push onto a bot pull request and ride its scheduled merge. Push allowlists on both? - What happens when write access is withdrawn or a writer's token leaks? Write access is secret access, so that means rotating every secret. ## From the review - Amends, depending on the answer: the CODEOWNERS issue (#144), the settings issue (#192), the ADR 0001 issue (#143), the Renovate issues (#172, #173), the map's gist for the automerge decision.
Claude added the
Wayfinder
Grilling
label 2026-11-16 06:10:52 +00:00
Claude added a new dependency 2026-11-16 06:11:27 +00:00
Author
Owner

Evidence from the review of the map (2026-11-15). Gitea source is read at tag v28.0.0, the server's version.

Which bot pull requests still merge unattended

  • Renovate automerge posture: "Gate: branch protection's required checks ... on an up-to-date branch, no approval."
  • Recommended repository settings and branch protection: "A Renovate pull request that touches a gate file waits for the maintainer's approval ... This narrows [the automerge decision]", and "Nothing exempts a pull request by author or branch" (confirmed in services/issue/pull.go: no bot exemption).
  • What Renovate changes: tool pins and lock (requirements-dev.*), collections (requirements.yml), consumer image pins in lint.yml, build.yml, molecule.yml. All match owned patterns. Left unowned: Dockerfile FROM digests and, later, skills bumps. So "narrows" means automerge is close to off, and the pin pull request after an image build waits for a click. Nothing on the automerge decision records it, and Re-evaluate Renovate's never-automerge exceptions once the push trigger is live plans against the old posture.
  • Option seen: leave requirements-dev\.lock and the image pin lines unowned, since the bot-diff gate already limits what a renovate/ branch may change; or amend the automerge decision.

Where CODEOWNERS lives

  • Gitea reads the first file that exists: var codeOwnerFiles = []string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"} (services/issue/pull.go at v28.0.0), from the base branch.
  • The planned patterns do not match CODEOWNERS or docs/CODEOWNERS. A pull request adding an empty root file matches no rule, merges on green, and from then on replaces every gate silently.
  • Recommendation: put the file at the root CODEOWNERS, or keep .gitea/CODEOWNERS and own the other two paths. Confidence high.

Gate inputs not owned

  • images/**: image.yml:346-347: "The credential file stays in the job container for the whole build, where the Dockerfile's RUN steps run as root". The ci image is the Lint and Build tool chain; its pin pull request shows only a digest.
  • .ansible-lint, .yamllint, ruff.toml, tests/sanity/ignore-*.txt, tests/scripts/**, REUSE.toml, changelogs/config.yaml (feeds the release version).
  • The threat model's own actor "edits a workflow to turn a check green" can do it more cheaply by adding a skip to a lint config.
  • Recommendation: own them in one rule; owning images/ makes Renovate's base-image bumps wait for the maintainer, or record images/ as accepted risk instead. Confidence high.

Organisation or repository secrets; least privilege

  • The settings decision: "Secrets stay organisation-level"; the Renovate bot is a write collaborator and on the merge allowlist. CLAUDE.md describes Renovate running "as a Kamino-only bot user".
  • The files disagree: renovate.yml:4-6 calls RENOVATE_BOT_TOKEN "the repository secret ... (not an org secret)", while Record current repository settings and branch protection recorded it as an organisation secret.
  • Scenario: a writer on another repository in the organisation reads the Renovate token from a branch workflow, then pushes a branch here and schedules its merge as an allowlisted account.
  • Recommendation: make RENOVATE_BOT_TOKEN a repository secret; no cost.
  • Least privilege: Threat model: what we defend against and what we accept says "Write access is secret access" and sets "each bot or agent token can do only its own job". The agent, Renovate and release tokens are all write collaborators, so each can push a workflow that prints the others. Option: record "any token with write on any organisation repository yields every organisation secret; least privilege limits settings and merges, not secrets"; or move the push credential to a place with no write-capable bot.

Unprotected renovate/* and release/*

  • Established in Establish how fork approval behaves on this server's Gitea version: a push does not cancel a scheduled merge, whoever pushes; the new head merges as the scheduler once checks pass. Whether a new push dismisses approvals was not established.
  • The bot-diff gate allows version, digest and hash lines without checking their values (scripts/check_bot_pr_diff.py docstring).
  • Scenario: the agent account, outside the merge allowlist, pushes a changed digest onto an open Renovate branch; Renovate's scheduled merge merges it.
  • Recommendation: push and force-push allowlists: renovate/* for the Renovate bot, release/* for the release bot. Two settings.

When write access is withdrawn

  • The settings decision: "write access to any repository in the organisation is secret access to all of them". The friend decision covers granting write access only.
  • So removing a writer, or a leaked writer token, means rotating every organisation secret. No ticket says which, or by whom.
  • Option seen: one line in ADR 0001 may be enough.
Evidence from the review of the map (2026-11-15). Gitea source is read at tag v28.0.0, the server's version. ### Which bot pull requests still merge unattended - [Renovate automerge posture](https://git.rkdr.net/Mortis/Kamino/issues/97): "Gate: branch protection's required checks ... on an up-to-date branch, no approval." - [Recommended repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/179): "A Renovate pull request that touches a gate file waits for the maintainer's approval ... This narrows [the automerge decision]", and "Nothing exempts a pull request by author or branch" (confirmed in `services/issue/pull.go`: no bot exemption). - What Renovate changes: tool pins and lock (`requirements-dev.*`), collections (`requirements.yml`), consumer image pins in `lint.yml`, `build.yml`, `molecule.yml`. All match owned patterns. Left unowned: Dockerfile `FROM` digests and, later, skills bumps. So "narrows" means automerge is close to off, and the pin pull request after an image build waits for a click. Nothing on the automerge decision records it, and [Re-evaluate Renovate's never-automerge exceptions once the push trigger is live](https://git.rkdr.net/Mortis/Kamino/issues/173) plans against the old posture. - Option seen: leave `requirements-dev\.lock` and the image pin lines unowned, since the bot-diff gate already limits what a `renovate/` branch may change; or amend the automerge decision. ### Where CODEOWNERS lives - Gitea reads the first file that exists: `var codeOwnerFiles = []string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"}` (`services/issue/pull.go` at v28.0.0), from the base branch. - The planned patterns do not match `CODEOWNERS` or `docs/CODEOWNERS`. A pull request adding an empty root file matches no rule, merges on green, and from then on replaces every gate silently. - Recommendation: put the file at the root `CODEOWNERS`, or keep `.gitea/CODEOWNERS` and own the other two paths. Confidence high. ### Gate inputs not owned - `images/**`: `image.yml:346-347`: "The credential file stays in the job container for the whole build, where the Dockerfile's RUN steps run as root". The `ci` image is the Lint and Build tool chain; its pin pull request shows only a digest. - `.ansible-lint`, `.yamllint`, `ruff.toml`, `tests/sanity/ignore-*.txt`, `tests/scripts/**`, `REUSE.toml`, `changelogs/config.yaml` (feeds the release version). - The threat model's own actor "edits a workflow to turn a check green" can do it more cheaply by adding a skip to a lint config. - Recommendation: own them in one rule; owning `images/` makes Renovate's base-image bumps wait for the maintainer, or record `images/` as accepted risk instead. Confidence high. ### Organisation or repository secrets; least privilege - The settings decision: "Secrets stay organisation-level"; the Renovate bot is a write collaborator and on the merge allowlist. `CLAUDE.md` describes Renovate running "as a Kamino-only bot user". - The files disagree: `renovate.yml:4-6` calls `RENOVATE_BOT_TOKEN` "the repository secret ... (not an org secret)", while [Record current repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/90) recorded it as an organisation secret. - Scenario: a writer on another repository in the organisation reads the Renovate token from a branch workflow, then pushes a branch here and schedules its merge as an allowlisted account. - Recommendation: make `RENOVATE_BOT_TOKEN` a repository secret; no cost. - Least privilege: [Threat model: what we defend against and what we accept](https://git.rkdr.net/Mortis/Kamino/issues/99) says "Write access is secret access" and sets "each bot or agent token can do only its own job". The agent, Renovate and release tokens are all write collaborators, so each can push a workflow that prints the others. Option: record "any token with write on any organisation repository yields every organisation secret; least privilege limits settings and merges, not secrets"; or move the push credential to a place with no write-capable bot. ### Unprotected `renovate/*` and `release/*` - Established in [Establish how fork approval behaves on this server's Gitea version](https://git.rkdr.net/Mortis/Kamino/issues/204): a push does not cancel a scheduled merge, whoever pushes; the new head merges as the scheduler once checks pass. Whether a new push dismisses approvals was not established. - The bot-diff gate allows version, digest and hash lines without checking their values (`scripts/check_bot_pr_diff.py` docstring). - Scenario: the agent account, outside the merge allowlist, pushes a changed digest onto an open Renovate branch; Renovate's scheduled merge merges it. - Recommendation: push and force-push allowlists: `renovate/*` for the Renovate bot, `release/*` for the release bot. Two settings. ### When write access is withdrawn - The settings decision: "write access to any repository in the organisation is secret access to all of them". The friend decision covers granting write access only. - So removing a writer, or a leaked writer token, means rotating every organisation secret. No ticket says which, or by whom. - Option seen: one line in ADR 0001 may be enough.
Defame1297 was assigned by Claude 2026-11-16 21:12:29 +00:00
Author
Owner

Resolution

Grilled with the session's driver on 2026-11-16. Each line is the rule, its reason, and how it is held.

  1. Which bot pull requests still merge unattended. .gitea/** stays code-owned: workflows are the gates. So Renovate's pin-follow pull request for our own images (PR 2 of the image loop) waits for one maintainer approval per image build. That is a named never-automerge exception added to Renovate automerge posture. The Python and collection pin files (requirements-dev.txt, requirements-dev.lock, requirements.yml) are not code-owned and keep automerging. A bot's change to them is limited by the bot-diff gate run from main, and a human's change is read by the approver (friends) or trusted (trusted contributors). Held by: control (code-owner approval in branch protection; bot-diff gate).
  2. Where CODEOWNERS lives. At the root as CODEOWNERS, which owns itself. Gitea reads the first of CODEOWNERS, docs/CODEOWNERS, .gitea/CODEOWNERS, and nothing outranks the root path, so no pull request can shadow it with another file. Replaces .gitea/CODEOWNERS in the CODEOWNERS issue. Held by: control.
  3. Gate inputs CODEOWNERS missed. Also owned: .ansible-lint, .yamllint, ruff.toml, tests/sanity/ignore-*.txt, tests/scripts/**, REUSE.toml, changelogs/config.yaml, images/**. A skip in a lint config is a cheaper way to turn a check green than a workflow edit, and images/** runs as root next to the registry push credential. Consequence: Renovate's Dockerfile FROM bumps also wait for the maintainer, so they are grouped into one weekly pull request. Held by: control.
  4. Organisation or repository secrets. Every secret this repository uses becomes a repository secret, and the move happens when a second repository lands in the mortis organisation (the public skills source, chore: publish the agent skills source in the organisation before opening to friends). Until then Kamino is the only repository, so organisation and repository scope are equivalent. A new secret (the release bot's token) starts as a repository secret. Fact found in this session: the repository holds no repository secrets today, so RENOVATE_BOT_TOKEN is an organisation secret and the header of .gitea/workflows/renovate.yml is wrong about it. Held by: review (a settings change by the maintainer).
  5. Least privilege and secrets. ADR 0001 records an accepted risk: least privilege limits a token's API scope and merge rights, not its reach to this repository's secrets. Every write-capable token (humans, the agent account, Renovate, the release bot) can push a branch workflow that reads them. This sharpens "write access is secret access" from Threat model: what we defend against and what we accept; it does not add a second statement. Trigger to revisit: ephemeral runners, or secrets scoped to environments.
  6. Bot branches. Push and force-push allowlists: renovate/* for the Renovate bot and the maintainer, release/* for the release bot and the maintainer. Anyone else's change to a bot pull request goes in their own pull request. This replaces CLAUDE.md's "hand edits on a bot branch" note. Held by: control (branch protection).
  7. Withdrawn access or a leaked write token. The maintainer rotates every repository secret. One line in ADR 0001, and a rotation list (each secret and where it is issued) in the maintainer's contributor doc. No automation. Held by: review.

No new ADR, because each point amends an existing decision. No glossary change.

Backlog

## Resolution Grilled with the session's driver on 2026-11-16. Each line is the rule, its reason, and how it is held. 1. **Which bot pull requests still merge unattended.** `.gitea/**` stays code-owned: workflows are the gates. So Renovate's pin-follow pull request for our own images (PR 2 of the image loop) waits for one maintainer approval per image build. That is a named never-automerge exception added to [Renovate automerge posture](https://git.rkdr.net/Mortis/Kamino/issues/97). The Python and collection pin files (`requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml`) are **not** code-owned and keep automerging. A bot's change to them is limited by the bot-diff gate run from `main`, and a human's change is read by the approver (friends) or trusted (trusted contributors). Held by: control (code-owner approval in branch protection; bot-diff gate). 2. **Where CODEOWNERS lives.** At the root as `CODEOWNERS`, which owns itself. Gitea reads the first of `CODEOWNERS`, `docs/CODEOWNERS`, `.gitea/CODEOWNERS`, and nothing outranks the root path, so no pull request can shadow it with another file. Replaces `.gitea/CODEOWNERS` in the CODEOWNERS issue. Held by: control. 3. **Gate inputs CODEOWNERS missed.** Also owned: `.ansible-lint`, `.yamllint`, `ruff.toml`, `tests/sanity/ignore-*.txt`, `tests/scripts/**`, `REUSE.toml`, `changelogs/config.yaml`, `images/**`. A skip in a lint config is a cheaper way to turn a check green than a workflow edit, and `images/**` runs as root next to the registry push credential. Consequence: Renovate's Dockerfile `FROM` bumps also wait for the maintainer, so they are grouped into one weekly pull request. Held by: control. 4. **Organisation or repository secrets.** Every secret this repository uses becomes a repository secret, and the move happens when a second repository lands in the `mortis` organisation (the public skills source, [chore: publish the agent skills source in the organisation before opening to friends](https://git.rkdr.net/Mortis/Kamino/issues/229)). Until then Kamino is the only repository, so organisation and repository scope are equivalent. A new secret (the release bot's token) starts as a repository secret. Fact found in this session: the repository holds no repository secrets today, so `RENOVATE_BOT_TOKEN` is an organisation secret and the header of `.gitea/workflows/renovate.yml` is wrong about it. Held by: review (a settings change by the maintainer). 5. **Least privilege and secrets.** ADR 0001 records an accepted risk: least privilege limits a token's API scope and merge rights, not its reach to this repository's secrets. Every write-capable token (humans, the agent account, Renovate, the release bot) can push a branch workflow that reads them. This sharpens "write access is secret access" from [Threat model: what we defend against and what we accept](https://git.rkdr.net/Mortis/Kamino/issues/99); it does not add a second statement. Trigger to revisit: ephemeral runners, or secrets scoped to environments. 6. **Bot branches.** Push and force-push allowlists: `renovate/*` for the Renovate bot and the maintainer, `release/*` for the release bot and the maintainer. Anyone else's change to a bot pull request goes in their own pull request. This replaces CLAUDE.md's "hand edits on a bot branch" note. Held by: control (branch protection). 7. **Withdrawn access or a leaked write token.** The maintainer rotates every repository secret. One line in ADR 0001, and a rotation list (each secret and where it is issued) in the maintainer's contributor doc. No automation. Held by: review. No new ADR, because each point amends an existing decision. No glossary change. ### Backlog - Amended: [ci: require maintainer review for gate files through CODEOWNERS](https://git.rkdr.net/Mortis/Kamino/issues/144) (points 1-3), [#192](https://git.rkdr.net/Mortis/Kamino/issues/192) (points 1, 6), [#143](https://git.rkdr.net/Mortis/Kamino/issues/143) (points 5, 7), [#172](https://git.rkdr.net/Mortis/Kamino/issues/172) (points 1, 3), [#173](https://git.rkdr.net/Mortis/Kamino/issues/173) (point 1). - New: [chore: move Kamino's secrets to repository level when a second repository joins the organisation](https://git.rkdr.net/Mortis/Kamino/issues/239) (point 4).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#210