pipeline.actions.pinned-references

Workflow actions are pinned to immutable references

Every action a workflow uses is referenced by a commit hash or a release tag, never by a moving branch.

High Planned Preventive

Assertion

for every reference u: ref(u) matches /^[0-9a-f]{40}$/ or ref(u) matches /^v[0-9]+(\.[0-9]+)*$/, and ref(u) is not a branch name

Evaluated against .gitea/workflows/*.yaml, every `uses:` reference, collected on-push.

Rationale

A workflow step written as uses: org/action@main runs whatever that branch holds at the moment the job starts. The action’s author, or anyone who compromises the author’s account, can change what every downstream pipeline executes without a single commit appearing in the repositories that depend on it. Pinning to a commit hash, or to a release tag that the publisher does not move, turns an update into a diff that is reviewed like any other dependency change.

Observation

The collector parses every workflow file and extracts the reference after @ in each uses: line. A reference passes when it is a full forty-digit commit hash or a version tag of the form v1, v1.2, or v1.2.3. A branch name fails. Actions referenced by a local path have no reference and are out of scope, since they are part of the repository being checked.

This control is planned. Its collector is defined but not yet scheduled, so no claim is made about any workflow until it is.

Remediation

Replace the branch with the hash of the commit the branch currently points at, and add the tag as a trailing comment so the next reader knows what version it is:

uses: org/action@3f2c1a9e5b7d8c0f1a2b3c4d5e6f7a8b9c0d1e2f # v2.1.0

A dependency update tool keeps the hash current by opening pull requests, which is the reviewed path the control exists to enforce.