ci: the release and deploy jobs run only on the server's runner, their secrets sealed with a key only it has #2123

Merged
HumanBean merged 1 commit from HumanBean/Longshot:ci/sealed-deploy-secrets into main 2026-11-21 21:28:03 +00:00
Owner

Summary

A runner reports its own labels, so a label only routes a job, it doesn't keep anyone out. Until now a runner lent by someone else (one is registered now, with ubuntu-latest and ubuntu-24.04) could:

  • add quick to its config and take the release's Sign and publish job, which holds RELEASE_SIGNING_KEY;
  • take the website job on ubuntu-latest as it is today, which holds CLOUDFLARE_API_TOKEN and PREVIEW_COMMENT_TOKEN.

This change:

  • Label deploy for the jobs that sign, publish or deploy: release.yml's version and publish, and website.yml's job. Only the server's quick runner carries it (MagicBeanDev/Infra, runner/quick/config.yml).
  • Sealed secrets. The secrets become RELEASE_SIGNING_KEY_SEALED, CLOUDFLARE_API_TOKEN_SEALED and PREVIEW_COMMENT_TOKEN_SEALED, sealed by the new scripts/ci_secret.sh (AES-256, PBKDF2). The key that opens them, seal.key, is a file on the server. Only the quick runner lets a job mount it (container.valid_volumes), and only deploy jobs mount it. A runner without it that takes such a job gets text it can't open, so the job fails and signs or deploys nothing. A fork's run can mount the file but gets no secrets to open.
  • Docs: docs/dev/reference/ci.md gets a new section, Secrets only our runners can open, covering the runners table, the secrets and what sealing doesn't cover. releases.md gets the new secret name in signing, rotation, setup and troubleshooting.

Read first: scripts/ci_secret.sh, then the publish job in release.yml and the website job's steps.

The launcher reads the same organization secret, and LongshotLauncher #241 makes the same change there. The old secrets can be deleted only once both PRs are merged.

Testing

Tested: on the server, 2026-11-21. A one-off job on a temporary branch (deleted since) asked for runs-on: deploy with this PR's container and volume lines. It ran on unraid-quick-1 (runner 3), mounted /run/magicbean-secrets/seal.key through valid_volumes, and sealed the three secrets with the same openssl settings as scripts/ci_secret.sh in the catthehacker/ubuntu:act-24.04 image. Each opened again byte for byte. Those sealed values are the _SEALED organization secrets, now set; the plain ones in Longshot, the launcher and the organization are deleted. CI's Python checks, dispatched on this branch: results below when they finish. Website build and checks and Guide screenshots fail on main (971f77f5) the same way: graphics-settings.ts and the guide's review hashes, not this change.

Still to test:

  • Server: the first nightly after a feat:/fix: merge signs on unraid-quick-1 and passes verify (by hand, in the run's log).
  • Server: the first website deploy after this merge (a docs change, or the hourly one) deploys, the token masked (by hand).

Measurements

Nothing to measure: CI workflows and docs only, nothing the game runs.

Risks

  • If it merges before the server and the secrets are ready, the nightly and the website deploy fail until they are. Nothing is published wrongly. Reverting is enough.
  • A website preview for a PR branch older than this one has no scripts/ci_secret.sh, so its preview fails until it is rebased. Its comment step falls back to the job token.
  • Players notice nothing.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (CI only: tested on the server's runner, as Testing says)
  • mise run test passes (any failure that also fails on main is named). (not run on this PC; CI runs it)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary A runner reports its own labels, so a label only routes a job, it doesn't keep anyone out. Until now a runner lent by someone else (one is registered now, with `ubuntu-latest` and `ubuntu-24.04`) could: - add `quick` to its config and take the release's **Sign and publish** job, which holds `RELEASE_SIGNING_KEY`; - take the **website** job on `ubuntu-latest` as it is today, which holds `CLOUDFLARE_API_TOKEN` and `PREVIEW_COMMENT_TOKEN`. This change: - **Label `deploy`** for the jobs that sign, publish or deploy: `release.yml`'s version and publish, and `website.yml`'s job. Only the server's quick runner carries it (MagicBeanDev/Infra, `runner/quick/config.yml`). - **Sealed secrets.** The secrets become `RELEASE_SIGNING_KEY_SEALED`, `CLOUDFLARE_API_TOKEN_SEALED` and `PREVIEW_COMMENT_TOKEN_SEALED`, sealed by the new `scripts/ci_secret.sh` (AES-256, PBKDF2). The key that opens them, `seal.key`, is a file on the server. Only the quick runner lets a job mount it (`container.valid_volumes`), and only `deploy` jobs mount it. A runner without it that takes such a job gets text it can't open, so the job fails and signs or deploys nothing. A fork's run can mount the file but gets no secrets to open. - **Docs:** `docs/dev/reference/ci.md` gets a new section, *Secrets only our runners can open*, covering the runners table, the secrets and what sealing doesn't cover. `releases.md` gets the new secret name in signing, rotation, setup and troubleshooting. Read first: `scripts/ci_secret.sh`, then the publish job in `release.yml` and the website job's steps. The launcher reads the same organization secret, and [LongshotLauncher #241](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/241) makes the same change there. The old secrets can be deleted only once both PRs are merged. ## Testing **Tested:** on the server, 2026-11-21. A one-off job on a temporary branch (deleted since) asked for `runs-on: deploy` with this PR's container and volume lines. It ran on `unraid-quick-1` (runner 3), mounted `/run/magicbean-secrets/seal.key` through `valid_volumes`, and sealed the three secrets with the same `openssl` settings as `scripts/ci_secret.sh` in the `catthehacker/ubuntu:act-24.04` image. Each opened again byte for byte. Those sealed values are the `_SEALED` organization secrets, now set; the plain ones in Longshot, the launcher and the organization are deleted. CI's Python checks, dispatched on this branch: results below when they finish. *Website build and checks* and *Guide screenshots* fail on `main` (971f77f5) the same way: `graphics-settings.ts` and the guide's review hashes, not this change. **Still to test:** - Server: the first nightly after a `feat:`/`fix:` merge signs on `unraid-quick-1` and passes `verify` (by hand, in the run's log). - Server: the first website deploy after this merge (a docs change, or the hourly one) deploys, the token masked (by hand). ## Measurements Nothing to measure: CI workflows and docs only, nothing the game runs. ## Risks - If it merges before the server and the secrets are ready, the nightly and the website deploy fail until they are. Nothing is published wrongly. Reverting is enough. - A website preview for a PR branch older than this one has no `scripts/ci_secret.sh`, so its preview fails until it is rebased. Its comment step falls back to the job token. - Players notice nothing. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. (CI only: tested on the server's runner, as Testing says) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (not run on this PC; CI runs it) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ci: the release and deploy jobs run only on the server's runner, and their secrets are sealed with a key only it has
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 20s
CI / Website build and checks (pull_request) Failing after 26s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 32s
CI / Workflow lint (actionlint) (pull_request) Successful in 34s
Third-party parts / As their notes say (pull_request) Successful in 40s
PR description / Description follows the template (pull_request_target) Failing after 8s
7d43e97365
A runner says its own labels, so a runner lent by someone else could ask for quick and take
the release's sign-and-publish job, with RELEASE_SIGNING_KEY; and every ubuntu-latest runner
took the website's deploy, with the Cloudflare token. Now a release's version and publish and
the website's job ask for label deploy, which only the server's quick runner carries, and read
RELEASE_SIGNING_KEY_SEALED, CLOUDFLARE_API_TOKEN_SEALED and PREVIEW_COMMENT_TOKEN_SEALED: sealed
by scripts/ci_secret.sh with seal.key, a file on the server that only that runner lets a job
mount. A runner without it that takes such a job opens nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: ci: the release and deploy jobs run only on the server's runner, their secrets sealed with a key only it has to ci: the release and deploy jobs run only on the server's runner, their secrets sealed with a key only it has 2026-11-21 21:27:54 +00:00
HumanBean deleted branch ci/sealed-deploy-secrets 2026-11-21 21:28:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
MagicBeanDev/Longshot!2123
No description provided.