Skip to content

ci: run the jobs on the self-hosted xite-ci runners - #97

Closed
DJAscendance wants to merge 4 commits into
masterfrom
ci/self-hosted-runners
Closed

DJAscendance wants to merge 4 commits into
masterfrom
ci/self-hosted-runners

Conversation

@DJAscendance

Copy link
Copy Markdown
Member

Summary

GitHub does not start jobs on GitHub-hosted runners for this account (spending limit). This PR moves all jobs of the two workflows to the self-hosted runner group xite-ci. The group is for X_ITE_R and CodeMirror_R only and accepts no public repository.

Changes

  • runs-on of each job: group: xite-ci, labels: [self-hosted, Linux, X64]. 2 jobs in 2 workflows.
  • apt-get waits up to 300 s for the dpkg lock. Two runners share the VM.

Unchanged

  • Job names. The repository has no required checks.
  • Test commands, CM_EVIDENCE allow list, CodeMirror 5.65.21 reference step.
  • permissions and checkout settings.

Runner environment

Proxmox VM gh-runner: Ubuntu 24.04, 8 vCPU, 13.6 GB RAM, no swap, no GPU. Rust 1.95.0 with rustfmt, clippy and wasm32-unknown-unknown is preinstalled. Each runner service has MemoryMax=11G. The first test uses one active runner.

Validation

  • actionlint 1.7.12 (pinned digest): no findings.
  • CI results at the exact head: added below after the run.

Ledger effect

None: CI process change, no REA entry.

Report location

~/Projects/cybertown/.reports/ci-self-hosted/2026-10-28-xite-ci/REPORT.md

Issue Reference

Refs #96

GitHub does not start jobs on GitHub-hosted runners for this account
(spending limit). Both jobs now use the runner group xite-ci (Proxmox
VM, Ubuntu 24.04, no GPU). Job names and test commands do not change.

- runs-on: group xite-ci, labels self-hosted, Linux, X64.
- apt-get waits for the dpkg lock (two runners share the VM).

Refs #96
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

MiniMax-M3.1-Flash QA

Findings

1. Critical: fork pull requests are still scheduled on the self-hosted runner

File: .github/workflows/rust-tests.yml

The protection is implemented as a step:

- name: Same-repository branch
  if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
  run: |
    echo "::error::Fork pull requests do not run on the self-hosted runners."
    exit 1

This does not prevent the job from being assigned to xite-ci. The runner is selected before steps execute, so a fork PR can still occupy and interact with a persistent self-hosted runner.

More importantly, for pull_request events, GitHub Actions generally evaluates the workflow from the PR’s merge ref. A malicious fork can modify or remove this step and then execute arbitrary commands on the self-hosted runner. The if condition on a step is therefore not a sufficient security boundary.

Use a job-level condition or route fork PRs to a GitHub-hosted runner. For example:

jobs:
  test:
    # Keep all actual execution away from self-hosted runners for fork PRs.
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
    runs-on:
      group: xite-ci
      labels: [self-hosted, Linux, X64]

If this job must remain a required check that fails for forks, add a separate GitHub-hosted job that fails for fork PRs, or use a conditional runs-on expression so fork PRs are assigned to ubuntu-24.04 rather than xite-ci.

At minimum, the same repository check must be moved to the job level, not left as a step-level guard.


2. Medium: the code-review job has no explicit protection against non-PR executions

File: .github/workflows/code-review.yml

This condition is appropriate for PRs:

if: github.event.pull_request.head.repo.full_name == github.repository

However, it assumes the workflow is only triggered by pull_request. If the workflow is also triggered by push, workflow_dispatch, or another event, github.event.pull_request.head.repo.full_name may be null or the event may not contain the expected fields.

Make the intended trigger explicit, for example:

if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository

Or ensure the workflow’s on: configuration contains only pull_request.


3. Low: the runner-environment distinction is duplicated and brittle

File: .github/workflows/rust-tests.yml

The workflow assumes that:

  • runner.environment == 'github-hosted' means the hosted runner path is selected;
  • runner.environment == 'self-hosted' means the VM path is selected.

This works today, but it creates two mutually exclusive steps and leaves the job without an explicit failure if the environment value is unexpected. A missing or changed environment value would cause both library steps to be skipped.

A more robust structure would use explicit job-level conditions or separate jobs for hosted and self-hosted execution. At minimum, add a final validation step that fails unless the expected environment is detected.


4. Low: actions/checkout@v7 should be verified

File: .github/workflows/rust-tests.yml

- uses: actions/checkout@v7

Please verify that actions/checkout@v7 is a published and intended version. The commonly used versions are v4/v5 depending on the repository’s timeframe. If v7 is not a valid tag, the workflow will fail before any tests run.


Positive observations

  • persist-credentials: false is a good security improvement and prevents the checkout token from remaining in the local Git configuration.
  • The self-hosted runner’s lack of sudo is a meaningful containment measure.
  • The self-hosted system-library check fails closed rather than silently accepting missing packages.
  • The job timeout is retained.
  • The code-review workflow correctly places its same-repository check at the job level.

Overall assessment

The main security boundary is currently ineffective for rust-tests.yml: fork PRs are assigned to the persistent self-hosted runner before the guard step runs, and the PR can potentially alter the workflow. Move the check to job level and ensure fork PRs never select xite-ci; use a separate GitHub-hosted failing job if the check must fail closed.

MiniMax review of #97: the PR job ran apt on a shared persistent VM.

- System libraries: apt runs on GitHub-hosted runners only. On the VM a
  check fails the job when a package is not installed.
- Remove the dpkg lock timeout; no PR job on the VM runs apt.

The VM now gives each xite-ci runner its own unprivileged user, home
and Rust toolchain, with no sudo, PrivateTmp and NoNewPrivileges.

Refs #96
Independent review of #97: without node, the cm-view and cm-web tests
that start node record an allowed tool-absent skip, and the suite
passes with less evidence. The first self-hosted run (old head d6b2f61)
had 27 skips against 24 on GitHub-hosted for this reason.

Refs #96
MiniMax review (untrusted PR code on persistent runners):

- test: a fork PR fails at the first step, before checkout, so no fork
  code runs on the VM and the required check fails closed.
- Review: runs only for a same-repository PR head.
- checkout: persist-credentials: false, so PR code cannot read the job
  token from the git config.
@DJAscendance

Copy link
Copy Markdown
Member Author

Closed without merge. The repository is now public.

  • GitHub-hosted runners are free for public repositories, so the billing block no longer stops CI. The workflows on the default branch already use ubuntu-24.04.
  • This PR moved every PR job to persistent self-hosted runners. For a public repository, that lets any pull request run code on private infrastructure. GitHub recommends against it.
  • The self-hosted runner group accepts private repositories only, so these jobs would not start.

Normal PR CI stays on GitHub-hosted Linux runners. Trusted GPU tests need a separate design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant