The Semaphore runner reaches infra-forge, and forge gets its CI login (SC-16) #31

Merged
pit merged 1 commit from hermes/sc16-semaphore-runner-infra-forge into main 2026-11-09 12:34:48 +00:00
Owner

Implements SC-16. The infra-silo half (the three deploy-key policies) is olympus/infra-silo's PR on hermes/sc16-forge-deploy-state-keys.

Summary

 bao/policies/
   automation-runner.hcl     # runner (145): 9 named paths -> 20
+                            #   services/forgejo/{db,secret-key,internal-token,jwt-secret,runner,accounts/pit,smtp}
+                            #   tofu-state/forge-{guest,runner,edge}/deploy
+                            #   services/semaphore/forgejo-status   (+ its accepted risk in the header)
+  ci-forge.hcl              # reads secret/ci/forge/semaphore-api, nothing else
 bao/service/roles/openbao/defaults/main.yml
+  openbao_jwt_roles: forge -> ci-forge, bound olympus/infra-forge, refs/heads/main, push
 scripts/env.sh
-  tracker|cockpit)        CLASS='CI'
+  tracker|cockpit|forge)  CLASS='CI'      # re-pinned; test case_forge_actor
 docs/  store-layout (6 paths declared, 74 -> 80), store-identity, proxmox-credentials, env-fetch

Decided with the Operator in the session: the Forgejo token is a restricted forge user semaphore with Write on infra-forge only, token write:repository limited to that repository, stored at secret/services/semaphore/forgejo-status. The ticket's "can't push" isn't expressible: Forgejo 15.0.9 gates POST /repos/…/statuses/{sha} on reqRepoWriter(unit.TypeCode), the same right as a push. The residual risk (it can push a non-main branch or tag to infra-forge) is written in the policy header and the identity page. The JWT role is forge/ci-forge by the store's naming convention (ticket text said ci-forge for the role).

Evidence

Live, 2026-11-09 (all already applied; this PR records it):

  • Store: make service-check before: 3 writes (automation-runner, ci-forge, jwt/role/forge). make service: changed=3. make service-check after: changed=0. Both policies read back byte-identical; auth/jwt/role/forge bound to olympus/infra-forge, refs/heads/main, push, aud openbao, 10m/20m.
  • Runner login on 145 (as semaphore, own seed): 16 reads 200 (the 11 new + tracker's/shared), 17 refusals 403 (forge apply/plan keys, ci/forge/semaphore-api, silo/*, Semaphore server paths, …), LIST 403, capabilities-self = read only. Token revoked.
  • Proxmox: pveum user token permissions infra-runner@pve deploy lists /vms/141, /vms/142, /vms/146, no VM.Allocate, no VM.PowerMgmt. As the token: config of 141/142/146 200, 143/144/145/150 403, create 403.
  • Forgejo token (read from the store): status on an infra-forge commit 201 (sc16/status-token-probe), infra-secrets 404, /user 403, repo search lists infra-forge only. main's protection: enable_push: false.
  • Checks: make check green (before the env.sh change, the new forge actor case was red: forge logs in by the JWT door FAIL).

Not proved yet: a forge login from a real push-to-main run. That's FO-50's first deploy.

Merge Danger

Door: two-way

Blast Radius: store

The store already carries this text, so merge soon: the role never deletes, but a make service from today's main rewrites automation-runner back to the tracker-only text and takes infra-forge's reach away from the runner. scripts/env.sh moves to a new pin; the other four repositories take it at their next re-vendor (infra-forge's FO-50 needs it for ACTOR=forge). Undo of the live half: revert, make service (policy text), and bao delete auth/jwt/role/forge + bao policy delete ci-forge by hand (the role adds, never deletes).

Implements [SC-16](https://vikunja.thepit.space/tasks/274). The infra-silo half (the three deploy-key policies) is olympus/infra-silo's PR on `hermes/sc16-forge-deploy-state-keys`. ## Summary ```diff bao/policies/ automation-runner.hcl # runner (145): 9 named paths -> 20 + # services/forgejo/{db,secret-key,internal-token,jwt-secret,runner,accounts/pit,smtp} + # tofu-state/forge-{guest,runner,edge}/deploy + # services/semaphore/forgejo-status (+ its accepted risk in the header) + ci-forge.hcl # reads secret/ci/forge/semaphore-api, nothing else bao/service/roles/openbao/defaults/main.yml + openbao_jwt_roles: forge -> ci-forge, bound olympus/infra-forge, refs/heads/main, push scripts/env.sh - tracker|cockpit) CLASS='CI' + tracker|cockpit|forge) CLASS='CI' # re-pinned; test case_forge_actor docs/ store-layout (6 paths declared, 74 -> 80), store-identity, proxmox-credentials, env-fetch ``` Decided with the Operator in the session: the Forgejo token is a restricted forge user `semaphore` with Write on infra-forge only, token `write:repository` limited to that repository, stored at `secret/services/semaphore/forgejo-status`. The ticket's "can't push" isn't expressible: Forgejo 15.0.9 gates `POST /repos/…/statuses/{sha}` on `reqRepoWriter(unit.TypeCode)`, the same right as a push. The residual risk (it can push a non-main branch or tag to infra-forge) is written in the policy header and the identity page. The JWT role is `forge`/`ci-forge` by the store's naming convention (ticket text said `ci-forge` for the role). ## Evidence Live, 2026-11-09 (all already applied; this PR records it): - **Store:** `make service-check` before: 3 writes (automation-runner, ci-forge, jwt/role/forge). `make service`: `changed=3`. `make service-check` after: `changed=0`. Both policies read back byte-identical; `auth/jwt/role/forge` bound to `olympus/infra-forge`, `refs/heads/main`, `push`, aud `openbao`, 10m/20m. - **Runner login on 145** (as `semaphore`, own seed): 16 reads 200 (the 11 new + tracker's/shared), 17 refusals 403 (forge apply/plan keys, `ci/forge/semaphore-api`, `silo/*`, Semaphore server paths, …), LIST 403, `capabilities-self` = `read` only. Token revoked. - **Proxmox:** `pveum user token permissions infra-runner@pve deploy` lists /vms/141, /vms/142, /vms/146, no VM.Allocate, no VM.PowerMgmt. As the token: config of 141/142/146 200, 143/144/145/150 403, create 403. - **Forgejo token** (read from the store): status on an infra-forge commit 201 (`sc16/status-token-probe`), infra-secrets 404, `/user` 403, repo search lists infra-forge only. main's protection: `enable_push: false`. - **Checks:** `make check` green (before the env.sh change, the new `forge actor` case was red: `forge logs in by the JWT door` FAIL). Not proved yet: a `forge` login from a real push-to-main run. That's FO-50's first deploy. ## Merge Danger **Door:** two-way **Blast Radius:** store The store already carries this text, so **merge soon**: the role never deletes, but a `make service` from today's `main` rewrites `automation-runner` back to the tracker-only text and takes infra-forge's reach away from the runner. `scripts/env.sh` moves to a new pin; the other four repositories take it at their next re-vendor (infra-forge's FO-50 needs it for `ACTOR=forge`). Undo of the live half: revert, `make service` (policy text), and `bao delete auth/jwt/role/forge` + `bao policy delete ci-forge` by hand (the role adds, never deletes).
The Semaphore runner reaches infra-forge, and forge gets its CI login (SC-16)
All checks were successful
pr-checks / check (pull_request) Successful in 17s
2bb56f7bee
Member

Review started (round 1/5) on 2bb56f7bee — reading the diff now.

**Review started** (round 1/5) on 2bb56f7beec19ef7b46a4f3d44d1d69f46861e13 — reading the diff now.
bot-minos approved these changes 2026-11-09 12:25:06 +00:00
bot-minos left a comment

repo olympus/infra-secrets · PR #31 · reviewed head 2bb56f7bee · round 1/5 (no earlier review on the thread) · verdict: merge

Recommendation: merge

No blockers. Two advisories, so the volume rule does not trip. Both are advice, and neither blocks.

Spec: SC-16 (Vikunja task 274), read live with its three comments. Its four acceptance criteria are the contract. The comments govern the body where they differ: the Operator's decisions name the JWT role forge (policy ci-forge, where the ticket text said ci-forge for the role) and amend "can't push" to an accepted risk.
Standards: AGENTS.md §Checks (make check is the floor), workshop ADR-0002, ADR-0007, ADR-0010 and ADR-0012, read from main. The repo keeps no docs/adr/ of its own and no wrap-width rule.

Standards

  1. ADVISORY — bao/policies/automation-runner.hcl:25-30 and docs/store-identity.md:167-173: the accepted-risk text is narrower than the right it records.
    • The text concludes "nothing it pushes deploys". That is true of main's deploy, and it is the whole risk the text names.
    • POST /statuses/{sha} is gated on reqRepoWriter(unit.TypeCode). I confirmed this in the v15.0.9 routers/api/v1/api.go. The same Write right therefore lets the holder set any status context on any infra-forge commit, including a pull request's head. A forged green on a required check satisfies the merge gate in ADR-0002 §"The checks the repository defines gate the merge".
    • A pushed branch carrying its own on: push workflow runs with that repository's Actions secrets. docs/proxmox-credentials.md lists PROXMOX_VE_PLAN_API_TOKEN on olympus/infra-forge, and plan.yml in infra-forge's main reads the FORGE_GUEST_PLAN_STATE_* secrets. I could not drive this live: this identity has no write on infra-forge and cannot read its branch protection (the API answered 403 "owner or collaborator with admin write").
    • Both consequences are bounded: the secrets are read-level, and the merge still needs a second person's approval. The Operator decision stands. The ask is only that the written risk name both consequences next to "can push a branch or a tag".
  2. ADVISORY — docs/store-identity.md:148-156 and :196: the hand-edited paragraphs were not reflowed.
    • Line 149 is the fragment grows: the.
    • Lines 153 and 196 run to 106 and 107 characters in prose that is otherwise wrapped at about 80.
    • The repo has no written width rule, so this is cosmetic.

Standards-axis baseline smells: none found. automation-runner.hcl repeats path … { capabilities = ["read"] }, which is the file's established named-path shape. Collapsing it would break ADR-0007's whole-grant rule.

Spec

All four SC-16 acceptance criteria are met by the diff, or honestly named as pending. No findings.

Criterion Verdict Evidence I reproduced
AppRole login reads each new path, refused outside Met in the policy text. The live login is the author's claim. bao-policy-capability-probe.sh on a throwaway dev server with the head automation-runner.hcl. All 11 new ACL paths give read. Near-misses give deny: forgejo/db/x, forgejo/dbx, forgejo/admin, semaphore/forgejo-status2, forge apply and plan keys, ci/forge/semaphore-api, semaphore/config, semaphore/admin, and list on metadata/services/forgejo/.
pveum … deploy lists /vms/141, 142, 146 Docs match the claim. The live ACL is the author's claim. docs/proxmox-credentials.md rows and the recipe loop (:179-211) agree with each other and with store-layout.md:176 and store-identity.md:112,258.
ci-forge token only for a push on main in infra-forge Configured, and honestly marked "not proved by a run" (store-identity.md:79-84; ticket comment 2). defaults/main.yml:133-140 has the same shape as tracker and cockpit. ci-forge.hcl gives read on secret/data/ci/forge/semaphore-api alone. The probe shows deny on ci/forge/other, …/semaphore-api/x, ci/tracker/semaphore-api, forgejo-status, the forge deploy key and a list. store.yml:120 globs bao/policies/*.hcl, so the new file is picked up with no list to edit.
Forgejo token sets a status, can't push Met "as amended" by the Operator. The residual is stated, but see advisory 1. The route gate is confirmed from the v15.0.9 source (above).
  • Scope: every hunk maps to SC-16. I found no creep. The smtp and ci/forge/semaphore-api declarations are the "undeclared but already in the store" paths, and the ticket comment says so.
  • Counts re-derived:
    • The runner policy goes from 9 to 20 named paths: grep -c '^path ' gives 20, and the base-vs-head path diff adds exactly the 11, with no duplicates and no capability other than read.
    • tofu-state paths go from 23 to 26: three deploy rows added, and the forge apply/plan rows already existed at base.
    • Declared paths go from 74 to 80 = 3 deploy + forgejo-status + forgejo/smtp + ci/forge/semaphore-api.
    • "Seven policy files" matches ls bao/policies.
    • "Other five deploy keys read by the runner" matches the table (2 tracker + 3 forge).

What I verified, and how

  • Head: refs/pull/31/head resolves to 2bb56f7, the dispatch SHA. It descends from origin/main fc69677, so the PR is current. It is a single commit.

  • make check at head: exit 0, 124 ok and 0 FAIL. Forgejo CI reports pr-checks / check (pull_request) as success on this SHA.

  • Pin: env-check reports the copy matches its pin. A control copy re-pinned unmutated runs green, so the re-pin helper is neutral.

  • Mutation of the new test case_forge_actor, with env.sh re-pinned each time so the pin check is not the red:

    Mutation Result
    forge dropped from the CI actors RED, 4 FAIL
    JWT role hard-coded to cockpit RED, 4 FAIL, including the fetch exited 0 with the wrong role's token
    forge classed as AppRole RED, 4 FAIL

    The test can fail, and it fails for the reasons it names.

  • Evidence scripts: under cache/scratch/infra-secrets-31-r1/ (wave1.sh, wave2.sh, wave3b.sh).

Could not verify (attempt made, refusal stated)

  • Every live-store and live-host claim (the changed=3 run, byte-identical read-back, the 16/17 login counts, pveum output, the Forgejo token's 201/404/403 results, enable_push: false): the profile .env holds only Forgejo and Vikunja keys, so there is no store or Proxmox credential. The author's recorded results are unchecked by me. The policy and role text they apply is what I reproduced above.
  • infra-forge's branch protection and Actions secrets: the branch-protection list answered 403, and search_users lacked the read:user scope. This is the gap behind advisory 1.

Named, not charged

  • ACTOR=forge in the other four repositories: they re-vendor env.sh at their next pull of the pin, and infra-forge's FO-50 needs it. The PR body discloses this, and each repo's env-check reads its own copy against its own pin.
  • The forge login from a real push-to-main run, and the public half of the Semaphore key on 141 and 146: pending FO-50 by the PR's and the ticket's own words.
  • Merge ordering ("merge soon"): a make service from today's main would rewrite automation-runner. The PR body discloses this, and no code issue follows from it.
  • infra-silo!25 (the three deploy-state policies) is the companion half. I did not review it here.

Summary

Axis Findings Worst
Standards 2 (0 BLOCKER, 2 ADVISORY) ADVISORY 1: the accepted-risk text omits status forgery and branch-workflow secret reach
Spec 0 none

Recommendation is merge: there are no blockers, and two advisories is under the three that would turn the recommendation.

<!-- minos review-loop: repo=olympus/infra-secrets pr=31 head=2bb56f7beec19ef7b46a4f3d44d1d69f46861e13 round=1/5 axes=standards,spec --> repo olympus/infra-secrets · PR #31 · reviewed head 2bb56f7beec19ef7b46a4f3d44d1d69f46861e13 · round 1/5 (no earlier review on the thread) · verdict: merge Recommendation: merge No blockers. Two advisories, so the volume rule does not trip. Both are advice, and neither blocks. **Spec:** SC-16 (Vikunja task 274), read live with its three comments. Its four acceptance criteria are the contract. The comments govern the body where they differ: the Operator's decisions name the JWT role `forge` (policy `ci-forge`, where the ticket text said `ci-forge` for the role) and amend "can't push" to an accepted risk. **Standards:** `AGENTS.md` §Checks (`make check` is the floor), workshop ADR-0002, ADR-0007, ADR-0010 and ADR-0012, read from `main`. The repo keeps no `docs/adr/` of its own and no wrap-width rule. ## Standards 1. **ADVISORY** — `bao/policies/automation-runner.hcl:25-30` and `docs/store-identity.md:167-173`: the accepted-risk text is narrower than the right it records. - The text concludes "nothing it pushes deploys". That is true of main's deploy, and it is the whole risk the text names. - `POST /statuses/{sha}` is gated on `reqRepoWriter(unit.TypeCode)`. I confirmed this in the `v15.0.9` `routers/api/v1/api.go`. The same Write right therefore lets the holder set any status context on any infra-forge commit, including a pull request's head. A forged green on a required check satisfies the merge gate in ADR-0002 §"The checks the repository defines gate the merge". - A pushed branch carrying its own `on: push` workflow runs with that repository's Actions secrets. `docs/proxmox-credentials.md` lists `PROXMOX_VE_PLAN_API_TOKEN` on `olympus/infra-forge`, and `plan.yml` in infra-forge's `main` reads the `FORGE_GUEST_PLAN_STATE_*` secrets. I could not drive this live: this identity has no write on infra-forge and cannot read its branch protection (the API answered 403 "owner or collaborator with admin write"). - Both consequences are bounded: the secrets are read-level, and the merge still needs a second person's approval. The Operator decision stands. The ask is only that the written risk name both consequences next to "can push a branch or a tag". 2. **ADVISORY** — `docs/store-identity.md:148-156` and `:196`: the hand-edited paragraphs were not reflowed. - Line 149 is the fragment `grows: the`. - Lines 153 and 196 run to 106 and 107 characters in prose that is otherwise wrapped at about 80. - The repo has no written width rule, so this is cosmetic. Standards-axis baseline smells: none found. `automation-runner.hcl` repeats `path … { capabilities = ["read"] }`, which is the file's established named-path shape. Collapsing it would break ADR-0007's whole-grant rule. ## Spec All four SC-16 acceptance criteria are met by the diff, or honestly named as pending. No findings. | Criterion | Verdict | Evidence I reproduced | | --- | --- | --- | | AppRole login reads each new path, refused outside | Met in the policy text. The live login is the author's claim. | `bao-policy-capability-probe.sh` on a throwaway dev server with the head `automation-runner.hcl`. All 11 new ACL paths give `read`. Near-misses give `deny`: `forgejo/db/x`, `forgejo/dbx`, `forgejo/admin`, `semaphore/forgejo-status2`, forge `apply` and `plan` keys, `ci/forge/semaphore-api`, `semaphore/config`, `semaphore/admin`, and `list` on `metadata/services/forgejo/`. | | `pveum … deploy` lists /vms/141, 142, 146 | Docs match the claim. The live ACL is the author's claim. | `docs/proxmox-credentials.md` rows and the recipe loop (`:179-211`) agree with each other and with `store-layout.md:176` and `store-identity.md:112,258`. | | `ci-forge` token only for a push on main in infra-forge | Configured, and honestly marked "not proved by a run" (`store-identity.md:79-84`; ticket comment 2). | `defaults/main.yml:133-140` has the same shape as `tracker` and `cockpit`. `ci-forge.hcl` gives `read` on `secret/data/ci/forge/semaphore-api` alone. The probe shows `deny` on `ci/forge/other`, `…/semaphore-api/x`, `ci/tracker/semaphore-api`, `forgejo-status`, the forge deploy key and a `list`. `store.yml:120` globs `bao/policies/*.hcl`, so the new file is picked up with no list to edit. | | Forgejo token sets a status, can't push | Met "as amended" by the Operator. The residual is stated, but see advisory 1. | The route gate is confirmed from the v15.0.9 source (above). | - **Scope:** every hunk maps to SC-16. I found no creep. The `smtp` and `ci/forge/semaphore-api` declarations are the "undeclared but already in the store" paths, and the ticket comment says so. - **Counts re-derived:** - The runner policy goes from 9 to 20 named paths: `grep -c '^path '` gives 20, and the base-vs-head path diff adds exactly the 11, with no duplicates and no capability other than `read`. - tofu-state paths go from 23 to 26: three `deploy` rows added, and the forge `apply`/`plan` rows already existed at base. - Declared paths go from 74 to 80 = 3 deploy + `forgejo-status` + `forgejo/smtp` + `ci/forge/semaphore-api`. - "Seven policy files" matches `ls bao/policies`. - "Other five deploy keys read by the runner" matches the table (2 tracker + 3 forge). ## What I verified, and how - **Head:** `refs/pull/31/head` resolves to 2bb56f7, the dispatch SHA. It descends from `origin/main` fc69677, so the PR is current. It is a single commit. - **`make check` at head:** exit 0, 124 `ok` and 0 `FAIL`. Forgejo CI reports `pr-checks / check (pull_request)` as success on this SHA. - **Pin:** `env-check` reports the copy matches its pin. A control copy re-pinned unmutated runs green, so the re-pin helper is neutral. - **Mutation of the new test `case_forge_actor`, with `env.sh` re-pinned each time so the pin check is not the red:** | Mutation | Result | | --- | --- | | `forge` dropped from the CI actors | RED, 4 FAIL | | JWT role hard-coded to `cockpit` | RED, 4 FAIL, including `the fetch exited 0 with the wrong role's token` | | `forge` classed as AppRole | RED, 4 FAIL | The test can fail, and it fails for the reasons it names. - **Evidence scripts:** under `cache/scratch/infra-secrets-31-r1/` (`wave1.sh`, `wave2.sh`, `wave3b.sh`). ## Could not verify (attempt made, refusal stated) - **Every live-store and live-host claim** (the `changed=3` run, byte-identical read-back, the 16/17 login counts, `pveum` output, the Forgejo token's 201/404/403 results, `enable_push: false`): the profile `.env` holds only Forgejo and Vikunja keys, so there is no store or Proxmox credential. The author's recorded results are unchecked by me. The policy and role text they apply is what I reproduced above. - **infra-forge's branch protection and Actions secrets:** the branch-protection list answered 403, and `search_users` lacked the `read:user` scope. This is the gap behind advisory 1. ## Named, not charged - **`ACTOR=forge` in the other four repositories:** they re-vendor `env.sh` at their next pull of the pin, and infra-forge's FO-50 needs it. The PR body discloses this, and each repo's `env-check` reads its own copy against its own pin. - **The `forge` login from a real push-to-main run, and the public half of the Semaphore key on 141 and 146:** pending FO-50 by the PR's and the ticket's own words. - **Merge ordering ("merge soon"):** a `make service` from today's `main` would rewrite `automation-runner`. The PR body discloses this, and no code issue follows from it. - **infra-silo!25** (the three deploy-state policies) is the companion half. I did not review it here. ## Summary | Axis | Findings | Worst | | --- | --- | --- | | Standards | 2 (0 BLOCKER, 2 ADVISORY) | ADVISORY 1: the accepted-risk text omits status forgery and branch-workflow secret reach | | Spec | 0 | none | Recommendation is `merge`: there are no blockers, and two advisories is under the three that would turn the recommendation.
pit merged commit 6ec93701e1 into main 2026-11-09 12:34:48 +00:00
pit deleted branch hermes/sc16-semaphore-runner-infra-forge 2026-11-09 12:34:48 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
olympus/infra-secrets!31
No description provided.