fleetlint Policy for a fleet of repositories
v0.9
Getting started

release/hosted-builder

Releases build on hosted runners

Severityinfo
Tiers1
Stacksany
Scoperoot
Kindexpr
Sourcelibrary v0.6.0
Selected byfleetlint-recommended@v0.6.0

Requirement

Jobs of a tag-triggered GitHub workflow run on GitHub-hosted runners, not self-hosted ones, so the build platform is isolated and ephemeral (SLSA Build L2 and up). Gitea, Forgejo and GitLab are not checked: their runners are mostly self-hosted by design, and GitLab.com’s hosted runners cannot be told apart from the file.

Why

A persistent self-hosted runner carries state between jobs; anything that compromised one earlier job can tamper with the release.

Applies when

tagged_workflows().exists(w, ci_kind(w) == "github")

Check

For each item in:

tagged_workflows().filter(w, ci_kind(w) == "github" && type(yaml(w)) == map && "jobs" in yaml(w) && type(yaml(w).jobs) == map).map(w,
  yaml(w).jobs.map(k, {
    "path": w,
    "name": k,
    "ok": !(type(yaml(w).jobs[k]) == map && "runs-on" in yaml(w).jobs[k] && [dyn(yaml(w).jobs[k]["runs-on"])].exists(r,
      [dyn(type(r) == map && "labels" in r ? r.labels : r)].exists(l,
        type(l) == list ? l.exists(x, x == "self-hosted") : l == "self-hosted")))
  })).flatten()
item.ok

Fix

Move the release job to a GitHub-hosted runner (ubuntu-latest), or document why it cannot and add an exception.

Agent instruction: Change runs-on of the flagged release jobs to a GitHub-hosted label such as ubuntu-latest; if the build needs special hardware, tell the user instead of changing it.

Sources


Generated by fleetlint docs from catalog v0.6.0.