Skip to content

ci: run Rust tests on the organization self-hosted runner - #102

Open
DJAscendance wants to merge 1 commit into
masterfrom
ci/self-hosted-runner
Open

DJAscendance wants to merge 1 commit into
masterfrom
ci/self-hosted-runner

Conversation

@DJAscendance

Copy link
Copy Markdown
Member

Moves rust-tests.yml from GitHub-hosted ubuntu-24.04 to the org runner gh-runner-ascendance3d ([self-hosted, Linux, X64]).

  • Fork PRs still run on ubuntu-24.04, so untrusted code never reaches the self-hosted machine (same pattern as X_ITE_R).
  • Repo variable CM_RUNNER_LABELS overrides the labels (set it to "ubuntu-24.04" to force hosted).
  • The package step no longer needs sudo on self-hosted runners; the packages are installed on the runner VM.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

MiniMax-M3.1-Flash QA

Findings

1. High — Same-repository PRs still execute arbitrary code on the self-hosted runner

Location: .github/workflows/rust-tests.yml, runs-on expression

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

This condition only distinguishes forks from branches in the upstream repository. It does not establish that the code is trusted. For example:

  • Dependabot PRs may have head.repo.full_name == github.repository.
  • A compromised maintainer account or bot token could open a same-repository PR.
  • Any contributor with permission to push a branch upstream can cause PR code to run on the self-hosted runner.

The workflow comment says that “untrusted code never reaches the self-hosted machine,” but the current expression does not guarantee that. Either:

  • Use a hosted runner for all pull_request events, or
  • Define an explicit trusted-actor/repository policy and ensure the self-hosted runner is isolated and disposable.

At minimum, exclude Dependabot and other untrusted actors explicitly rather than relying solely on the fork check.

2. Medium — CM_RUNNER_LABELS does not support the documented string format

Location: .github/workflows/rust-tests.yml, runs-on expression

The comment says:

CM_RUNNER_LABELS (a JSON array or string)

and gives this example:

"ubuntu-24.04"

However, the expression always applies fromJSON to the selected value:

fromJSON(...)

A plain string such as ubuntu-24.04 is not valid JSON, so setting the variable to the documented example will cause workflow expression evaluation to fail before the job starts.

Either:

  • Document and enforce JSON-array syntax only, for example ["self-hosted","Linux","X64"], or
  • Normalize the variable before passing it to fromJSON, handling both JSON arrays and plain label strings separately.

Also consider validating the variable format and failing with a clear error rather than allowing an opaque expression error.

3. Low — The hosted-runner package installation logic performs a redundant installation

Location: .github/workflows/rust-tests.yml, “System libraries” step

The step first installs only missing packages:

sudo apt-get install -y --no-install-recommends $missing

It then unconditionally runs:

sudo apt-get install -y --no-install-recommends pkg-config libwayland-dev libxkbcommon-dev libxkbcommon-x11-0 mesa-vulkan-drivers xvfb

This is unnecessary and makes the step slower and more susceptible to package-index issues. The unconditional command is also misleading because the preceding comment says self-hosted runners have no sudo, although the command is only reached for hosted runners after the self-hosted path exits.

Prefer a single installation path:

if [ -n "$missing" ]; then
  if [ "$RUNNER_ENVIRONMENT" = self-hosted ]; then
    echo "::error::missing packages on this self-hosted runner:$missing (install them on the runner image)"
    exit 1
  fi

  sudo apt-get update
  # shellcheck disable=SC2086
  sudo apt-get install -y --no-install-recommends $missing
fi

4. Low — The package check assumes Debian/Ubuntu package management

Location: .github/workflows/rust-tests.yml, “System libraries” step

The workflow now assumes every runner has dpkg and Debian package names:

dpkg -s "$p"

This is reasonable for an Ubuntu-based self-hosted image, but the workflow only says “self-hosted Linux runner.” If a different distribution is used, the check will report every package as missing or fail due to the missing dpkg command.

Document the required runner image/OS contract, or make the package check conditional on the runner type/distribution.

Overall assessment

The PR improves the handling of missing runner dependencies, but the runner-selection logic has a meaningful trust-boundary gap: same-repository and potentially Dependabot PR code can still run on the self-hosted runner. The CM_RUNNER_LABELS documentation should also be corrected so the documented string example does not break workflow evaluation.

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