Isolate the CI runners by trust level #5

Open
opened 2026-11-26 02:15:17 +01:00 by claude-bot · 1 comment

Untrusted work (PR checks) and trusted work (deploys) must not share a runner or credentials. A runner is only as safe as the least trusted job it accepts.

Enterprise practice: runner groups per trust level, deploy runners restricted to protected branches, no access to the container engine from jobs.

Steps

Checks runner (on docker)

  • Check container.docker_host in the act_runner config. If it is empty, act_runner mounts the Docker socket into job containers, which gives every PR job control over all containers on docker (Gitea, Postgres, apps). Set it to - so the socket isn't mounted
  • Set container.valid_volumes to an empty list, so workflows can't mount host paths
  • Make sure the checks runner holds no deploy keys or secrets

Deploy runner (on ansible)

  • Dedicated unprivileged user (act_runner), no sudo
  • Registered to this repo only, label ansible:host
  • Own SSH key for docker, separate from personal keys
  • Deploy workflows trigger only on push to main or workflow_dispatch, never on pull_request
  • Replace actions/checkout with a plain git fetch step, so no third-party code runs on this runner; then remove nodejs from the LXC
  • Set runner.capacity: 1, so deploys never run in parallel

Tools

act_runner config (config.yaml), Gitea workflow triggers.

Done when

No PR job can reach the Docker socket or a deploy key, and the deploy runner runs only first-party code from main.

Untrusted work (PR checks) and trusted work (deploys) must not share a runner or credentials. A runner is only as safe as the least trusted job it accepts. **Enterprise practice:** runner groups per trust level, deploy runners restricted to protected branches, no access to the container engine from jobs. ## Steps ### Checks runner (on `docker`) - [ ] Check `container.docker_host` in the act_runner config. If it is empty, act_runner mounts the Docker socket into job containers, which gives every PR job control over all containers on `docker` (Gitea, Postgres, apps). Set it to `-` so the socket isn't mounted - [ ] Set `container.valid_volumes` to an empty list, so workflows can't mount host paths - [ ] Make sure the checks runner holds no deploy keys or secrets ### Deploy runner (on `ansible`) - [x] Dedicated unprivileged user (`act_runner`), no sudo - [x] Registered to this repo only, label `ansible:host` - [x] Own SSH key for `docker`, separate from personal keys - [ ] Deploy workflows trigger only on `push` to `main` or `workflow_dispatch`, never on `pull_request` - [ ] Replace `actions/checkout` with a plain `git fetch` step, so no third-party code runs on this runner; then remove `nodejs` from the LXC - [ ] Set `runner.capacity: 1`, so deploys never run in parallel ## Tools act_runner config (`config.yaml`), Gitea workflow triggers. ## Done when No PR job can reach the Docker socket or a deploy key, and the deploy runner runs only first-party code from `main`.

Update: the checks runner on docker (the gitea-runner container) is being retired by #18. Its replacement is a dedicated runner VM (kasun/homelab-infrastructure-as-code#82) with Docker job containers, docker_host: "-" and empty valid_volumes, so the "Checks runner" steps above move to #18.

Open point for this ticket: the new VM runner is planned to serve PR checks for both homelab-* repos and the infra deploys of homelab-infrastructure-as-code (Proxmox, pfSense, Pulumi credentials). That mixes trust levels, which this ticket says to avoid. Options: register a second runner instance with its own label on the same VM for PR checks only (weaker, same host), or a separate small checks VM. To decide before #18 is done.

Update: the checks runner on `docker` (the `gitea-runner` container) is being retired by #18. Its replacement is a dedicated runner VM (kasun/homelab-infrastructure-as-code#82) with Docker job containers, `docker_host: "-"` and empty `valid_volumes`, so the "Checks runner" steps above move to #18. Open point for this ticket: the new VM runner is planned to serve PR checks for both `homelab-*` repos **and** the infra deploys of homelab-infrastructure-as-code (Proxmox, pfSense, Pulumi credentials). That mixes trust levels, which this ticket says to avoid. Options: register a second runner instance with its own label on the same VM for PR checks only (weaker, same host), or a separate small checks VM. To decide before #18 is done.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kasun/homelab-ansible#5