SKY-D295 · CI/CD pipelines
Job runs on a self-hosted runner
A self-hosted runner is a machine you own that GitHub sends jobs to, instead of a fresh virtual machine GitHub throws away after each job. SKY-D295 reports every job whose runs-on: may pick such a runner, so a person can check who is able to start that job.
- Languages
- GitHub Actions workflows
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
- Catalog name
- GitHub Actions self-hosted runner
Why it matters
Code in a job runs on the runner with its network access and whatever the last job left behind. If a pull request from a fork can reach the runner, its author can install a backdoor that reads the secrets, caches and build outputs of every later job, including your releases.
What Skylos flags
name: GPU testson: pull_request: branches: [main]permissions: contents: readjobs: gpu-tests: runs-on: [self-hosted, linux, gpu] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: persist-credentials: false - run: pip install -e ".[test]" && pytest tests/gpuWhat Skylos leaves alone
name: Unit testson: pull_request: branches: [main]permissions: contents: readjobs: unit-tests: strategy: matrix: os: [ubuntu-latest, macos-15, windows-2022] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: persist-credentials: false - run: pip install -e ".[test]" && pytest tests/unitWhy Skylos leaves it alone
runs-on is an expression, but it reads a matrix written out in the file, and every value in it is a GitHub-hosted label. Skylos expands the matrix and finds no row that could reach a machine you own.
How Skylos decides
- Reads workflow files under
.github/workflows. Composite actions have noruns-on, so they are not checked. - Skips a job without
runs-onand a job that calls a reusable workflow withuses:; the called workflow is checked on its own. - Reports the job when one of its labels is
self-hosted(any case), whenruns-onnames a runnergroup, or when it is empty, a mapping with other keys thanlabels, or a label that is not text. - A label written as an expression
${{ … }}counts, unless it is exactly${{ matrix.<name> }}and every row of a matrix written in the file gives labels from GitHub's list of hosted images, such asubuntu-latest,windows-2022ormacos-15. - Any other fixed label, such as
gpu-large, is not reported, because only theself-hostedlabel proves a machine you own. - The trigger is not considered. One HIGH finding per job, on its
runs-online.
How to fix it
Do not let pull requests reach a self-hosted runner. Run them on GitHub-hosted runners, and keep the self-hosted job for events only people with write access can cause, such as a push to main. Use ephemeral runners, which take one job and are then destroyed, and record that review next to runs-on.
name: GPU testson:Removed: pull_request:Added: push: branches: [main]permissions: contents: readjobs: gpu-tests:Added: # skylos: ignore[SKY-D295] ephemeral runner, pushes to main only runs-on: [self-hosted, linux, gpu] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: persist-credentials: false - run: pip install -e ".[test]" && pytest tests/gpuWhen it can be wrong
- A self-hosted job that only runs on
push,scheduleorworkflow_dispatchis reported the same as one that runs on pull requests from forks, because the trigger is not read. - Missed: a self-hosted runner picked by a custom label alone, such as
runs-on: gpu-large, without theself-hostedlabel. runs-on: ${{ inputs.runner }}and matrices built withfromJSON()are reported, because Skylos cannot see which label they become.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put
# skylos: ignore[SKY-D295]as a YAML comment at the end of theruns-online or on its own line directly above it, one rule per marker.YAML # skylos: ignore[SKY-D295] ephemeral runner, pushes to main onlyruns-on: [self-hosted, linux, gpu][tool.skylos] ignore = ["SKY-D295"]turns the rule off for the whole project.