Skip to content

Pin every action to a commit, keeping the tag as a comment - #22

Merged
DenisDrobyshev merged 1 commit into
mainfrom
harden/pin-actions
Sep 18, 2026
Merged

DenisDrobyshev merged 1 commit into
mainfrom
harden/pin-actions

Conversation

@DenisDrobyshev

Copy link
Copy Markdown
Member

A tag is a label somebody else can move, and these workflows run with a token that can write here. pypa/gh-action-pypi-publish@release/v1 was a branch — it moves by design — on the step that publishes to PyPI.

The tag stays as a trailing comment, which is the form Dependabot maintains: it raises the commit and the comment together. github-actions is already in this repository's dependabot.yml.

Done with scripts/pin_actions.py in the .github repository. Every commit resolved through the API rather than typed, and all 23 distinct references re-checked against it afterwards — zero mismatches.

Proven first on DrobyshevDev/stadion#8, where the full matrix went green on pinned actions across five interpreters and three operating systems.

Why it matters beyond hygiene: Pinned-Dependencies is scoring 0 on the OpenSSF Scorecard badge these READMEs now carry, and it is the heaviest single check. mlango, for example, sits at 6.3 with that at zero.

A tag is a label somebody else can move. `actions/checkout@v7` means whatever
the owner of that repository decides v7 points at, at the moment the workflow
runs, and these workflows run with a token that can write here.
`pypa/gh-action-pypi-publish@release/v1` was worse: a branch, which moves by
design, on the step that publishes to PyPI.

Pinning fixes what runs. The tag stays on the line as a comment, so the file
still reads, and Dependabot understands this form -- it raises the commit and
rewrites the comment together, which is what keeps this from becoming a snapshot
that rots.

Every commit was resolved through the API rather than typed, and all twenty-three
distinct references were checked against it again afterwards. The rewrite is
idempotent: a second run reports nothing to do.
@DenisDrobyshev
DenisDrobyshev merged commit 54cddff into main Sep 18, 2026
6 checks passed
@DenisDrobyshev
DenisDrobyshev deleted the harden/pin-actions branch September 18, 2026 20:02
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