ci/actions-pinned
Actions and CI includes are pinned
| Severity | warning |
| Tiers | 1 |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.8.0 |
| Selected by | fleetlint-recommended@v0.8.0 |
Requirement
Every uses: reference in a GitHub, Gitea or Forgejo workflow is pinned to a full 40-character commit SHA with a version comment; a docker:// image is pinned by @sha256: digest; local actions (./path) are exempt. In GitLab CI, a project include has a commit SHA as ref:, a component a commit SHA as its version, and a remote include an integrity: hash; local and template includes are exempt.
Why
A tag or branch can be moved; a SHA cannot. Pinning is what makes a pipeline reproducible and tamper-evident.
Applies when
workflows().size() > 0Check
For each item in:
grep(".github/workflows/*.y*ml", r'^\s*-?\s*uses:\s*["\x27]?([^\s"\x27#]+)') + grep(".gitea/workflows/*.y*ml", r'^\s*-?\s*uses:\s*["\x27]?([^\s"\x27#]+)') + grep(".forgejo/workflows/*.y*ml", r'^\s*-?\s*uses:\s*["\x27]?([^\s"\x27#]+)') + workflows().filter(w, ci_kind(w) == "gitlab").map(w,
includes(w).filter(i, i.type in ["project", "component", "remote"]).map(i, {
"path": w,
"name": i.type + " " + i.target + (i.ref != "" ? "@" + i.ref : ""),
"kind": i.type, "target": i.target, "ref": i.ref
})).flatten()"kind" in item
? (item.kind == "remote"
? [dyn(yaml(item.path)["include"])].exists(inc, (type(inc) == list ? inc : [inc]).exists(e,
type(e) == map && "remote" in e && e.remote == item.target && "integrity" in e))
: item.ref.matches("^[0-9a-f]{40}$"))
: (item.match.startsWith("./")
|| (item.match.startsWith("docker://") ? item.match.contains("@sha256:") : item.match.matches("@[0-9a-f]{40}$")))Fix
Run pinact run for Actions workflows; pin GitLab includes to commit SHAs. Let Renovate keep the pins current.
Agent instruction: Run pinact run to pin all uses: references to SHAs with version comments, pin docker:// images by digest, and set GitLab project includes and components to commit SHAs (remote includes get integrity:); do not change anything else.
Sources
- https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions (guidance, Using third-party actions)
- https://github.com/ossf/scorecard/blob/main/docs/checks.md (standard, Pinned-Dependencies)
- https://docs.zizmor.sh/audits/ (check, unpinned-uses)
- https://docs.gitlab.com/ci/yaml/ (spec, include:integrity)
- https://fleetlint.org/baseline/#security
Generated by fleetlint docs from catalog v0.8.0.