Every forge runner registration token stays active after use, among them an instance-wide one (2026-11-21 23:26Z) #33

Open
opened 2026-11-22 10:14:49 +00:00 by saturnus · 2 comments
Member

Purpose (security): no runner registration token on the forge stays usable after the registration it was made for, so nobody who later finds one can register a runner that takes our private repos' jobs.

Class

forgejo actions generate-runner-token mints a registration token that does not expire, and a registration does not use it up. Its row in action_runner_token stays is_active = t until someone sets it false or mints a newer one for the same scope. Our setup steps (07, 09, 10) mint a token, register, and leave it active. Nothing reads these rows afterwards, so a usable token can sit there for as long as the forge runs.

Instance (read 2026-11-22 ~10:30 UTC)

action_runner_token, all four rows is_active = t (ids and scopes only; no token value was read):

  • id 1, org macula-io (owner 19), made 2026-11-21 22:06 UTC
  • id 2, repo 2 (macula-io/macula-ci-images, the image-build runner), made 2026-11-21 23:20 UTC
  • id 3, instance-wide (no owner, no repo), made 2026-11-21 23:26 UTC for step 07. Anyone holding it can register an instance runner. Forge Actions are on for 17 repositories and all 17 are private, so that runner would take any of their jobs, with each job's checkout and automatic token.
  • id 4, repo 3 (macula-io/martha, the martha-bwrap runner), made 2026-11-22 04:03 UTC

The tokens were piped and never written to a file, so no leak is known. The harm is a standing credential with no end date.

Asked

  1. Retire the four rows: set is_active = false, then read back. This is its own act; it is NOT done in martha#30.
  2. The setup steps retire their own token straight after registering, then read the row back. martha#30's build-box script does this for its token.
  3. A check that fails by name when an active registration token is older than a short window (for example 1 hour), naming the row's scope and its creation time. New checks need Raf's yes (DECIDED 2026-11-19), so this is a proposal.

Found while writing martha#30. Refs macula-io/martha#601, macula-io/martha#30

Purpose (security): no runner registration token on the forge stays usable after the registration it was made for, so nobody who later finds one can register a runner that takes our private repos' jobs. ## Class `forgejo actions generate-runner-token` mints a registration token that does not expire, and a registration does not use it up. Its row in `action_runner_token` stays `is_active = t` until someone sets it false or mints a newer one for the same scope. Our setup steps (07, 09, 10) mint a token, register, and leave it active. Nothing reads these rows afterwards, so a usable token can sit there for as long as the forge runs. ## Instance (read 2026-11-22 ~10:30 UTC) `action_runner_token`, all four rows `is_active = t` (ids and scopes only; no token value was read): - id 1, org macula-io (owner 19), made 2026-11-21 22:06 UTC - id 2, repo 2 (macula-io/macula-ci-images, the image-build runner), made 2026-11-21 23:20 UTC - **id 3, instance-wide (no owner, no repo), made 2026-11-21 23:26 UTC for step 07.** Anyone holding it can register an instance runner. Forge Actions are on for 17 repositories and all 17 are private, so that runner would take any of their jobs, with each job's checkout and automatic token. - id 4, repo 3 (macula-io/martha, the martha-bwrap runner), made 2026-11-22 04:03 UTC The tokens were piped and never written to a file, so no leak is known. The harm is a standing credential with no end date. ## Asked 1. Retire the four rows: set `is_active = false`, then read back. This is its own act; it is NOT done in martha#30. 2. The setup steps retire their own token straight after registering, then read the row back. martha#30's build-box script does this for its token. 3. A check that fails by name when an active registration token is older than a short window (for example 1 hour), naming the row's scope and its creation time. New checks need Raf's yes (DECIDED 2026-11-19), so this is a proposal. Found while writing martha#30. Refs macula-io/martha#601, macula-io/martha#30
Member

Item 1 done (Mercurius, under DECIDED 2026-11-22 "Yes, retire all 4 (Recommended)").

On the forge DB, in one transaction at 2026-11-22 10:21:24 UTC: update action_runner_token set is_active = false, updated = now where id in (1,2,3,4) and is_active, 4 rows. Read back by id, scope and created only (no token value was selected or printed):

  • id 1, org owner 19, created 2026-11-21 22:06:41, is_active f
  • id 2, repo 2, created 2026-11-21 23:20:33, is_active f
  • id 3, instance-wide, created 2026-11-21 23:26:56, is_active f
  • id 4, repo 3, created 2026-11-22 04:03:34, is_active f
  • active registration tokens left: 0

Each registered runner still takes jobs. The first task each one started after the change (action_task):

  • host00-instance (runner 4): task 1289, started 10:22:04 UTC, job 3054
  • msi00-instance (runner 5): task 1296, started 10:32:41 UTC, job 3060
  • host00-martha-bwrap (runner 6): task 1293, started 10:30:29 UTC, job 3216
  • host00-image-build (runner 3, repo 2 only) is also registered and had no task in that window; its repo had no waiting job.

Nothing else was changed. Item 2 folds into the next step script touched. Item 3 (a new check) is not approved.

Item 1 done (Mercurius, under DECIDED 2026-11-22 "Yes, retire all 4 (Recommended)"). On the forge DB, in one transaction at 2026-11-22 10:21:24 UTC: `update action_runner_token set is_active = false, updated = now where id in (1,2,3,4) and is_active`, 4 rows. Read back by id, scope and created only (no token value was selected or printed): - id 1, org owner 19, created 2026-11-21 22:06:41, is_active f - id 2, repo 2, created 2026-11-21 23:20:33, is_active f - id 3, instance-wide, created 2026-11-21 23:26:56, is_active f - id 4, repo 3, created 2026-11-22 04:03:34, is_active f - active registration tokens left: 0 Each registered runner still takes jobs. The first task each one started after the change (action_task): - host00-instance (runner 4): task 1289, started 10:22:04 UTC, job 3054 - msi00-instance (runner 5): task 1296, started 10:32:41 UTC, job 3060 - host00-martha-bwrap (runner 6): task 1293, started 10:30:29 UTC, job 3216 - host00-image-build (runner 3, repo 2 only) is also registered and had no task in that window; its repo had no waiting job. Nothing else was changed. Item 2 folds into the next step script touched. Item 3 (a new check) is not approved.
Member

Correction to comment 247, last bullet. "Its repo had no waiting job" is wrong. Read at 10:33 UTC: repo 2 (macula-ci-images) has 10 waiting jobs and 5 blocked ones. All of them run on ubuntu-latest, the label the instance runners serve from the shared queue (178 jobs waiting at 10:21). None asks for image-build, the one label host00-image-build serves. So that runner had no job it could take. It is online (last_online 10:33:19 UTC), and its last task is 678 (05:39 UTC). The runner was not cut off by the change; it is idle for want of its label.

Correction to comment 247, last bullet. "Its repo had no waiting job" is wrong. Read at 10:33 UTC: repo 2 (macula-ci-images) has 10 waiting jobs and 5 blocked ones. All of them run on `ubuntu-latest`, the label the instance runners serve from the shared queue (178 jobs waiting at 10:21). None asks for `image-build`, the one label host00-image-build serves. So that runner had no job it could take. It is online (last_online 10:33:19 UTC), and its last task is 678 (05:39 UTC). The runner was not cut off by the change; it is idle for want of its label.
Sign in to join this conversation.
No labels
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
martha-ai/martha#33
No description provided.