Skip to content

ci: pin every workflow action to a commit SHA - #619

Merged
gloryfromca merged 2 commits into
mainfrom
ci/pin-actions-to-sha
Nov 23, 2026
Merged

gloryfromca merged 2 commits into
mainfrom
ci/pin-actions-to-sha

Conversation

@gloryfromca

Copy link
Copy Markdown
Member

Summary

Workflow actions were referenced by tag (actions/checkout@v7, astral-sh/setup-uv@v10.3.3) or by branch (pypa/gh-action-pypi-publish@release/v1). The owner of a tag or branch can point it at other code, and the release job holds the PyPI Trusted Publishing token. A compromised upstream ref would therefore run inside our release.

Each uses: now names the commit those refs point to today, with the exact version in a trailing comment. Dependabot updates the SHA and the comment together. No action version changes:

Action Was Now
actions/checkout @v7 @3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 (same commit as v7)
astral-sh/setup-uv @v10.3.3 @68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
pypa/gh-action-pypi-publish @release/v1 @7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 (current head of release/v1)

docs/engineering.md states the rule. docs/github-sync.md had a stale checkout@v6 note, now fixed. Once this merges, the repository setting "Require actions to be pinned to a full-length commit SHA" gets turned on. It has to come after the merge, because with tag references every workflow would fail.

Area

  • Architecture method
  • Benchmark
  • Use case
  • Documentation
  • Developer experience
  • CI, build, or release

Verification

SHAs resolved with the GitHub API (git/ref + tag listing); each one equals the commit
the old reference points to now: checkout v7 = v7.0.1, setup-uv v10.3.3,
pypi-publish release/v1 = v1.14.3.

Scripted replacement with expected counts asserted: checkout 13, setup-uv 9, pypi-publish 1;
no unpinned `uses:` left. All four workflows parse as YAML.

make lint        pass
make docs-check  pass
This PR's own CI runs the pinned checkout / setup-uv. release.yml runs only on a version tag;
its publish step is the same commit as release/v1 today.

Checklist

  • I kept the change scoped to the relevant area.
  • I am opening this from a separate branch, not pushing directly to main.
  • I updated docs, examples, or setup notes when behavior changed.
  • I added or updated tests when the change affects behavior.
  • I did not commit secrets, .env files, dependency folders, or generated output.
  • Active relative links in Markdown files resolve.

Notes for Reviewers

  • release.yml cannot be exercised before the next tag. Its pinned commits are the ones the previous references resolve to today, so the next release runs the same code it would have run with the old references.

By submitting this pull request, I agree that my contribution is licensed under
the Apache License 2.0.

🤖 Generated with Claude Code

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: enable the documented SHA-pinning guard or stop claiming that the repository enforces it.

Reviewed the full origin/main...HEAD diff, repository guidance (CLAUDE.md), all workflow callers and uses: entries, Dependabot configuration, and relevant workflow history. I also checked backward compatibility: each current external action is pinned to 40 hex characters, and the three SHAs resolve to the documented upstream versions (actions/checkout v7.0.1, astral-sh/setup-uv v10.3.3, and the peeled pypa/gh-action-pypi-publish v1.14.3 commit). No tests or gates were weakened; none were changed.

Validation: git diff --check, scripts/check_docs.py, and scripts/check_github_contributor_docs.py passed; a static scan found no current unpinned external uses: entry. GitHub currently reports passing lint, docs, commit-message/title, and package checks; the unit and integration jobs are still pending. The local make docs-check wrapper could not run because this environment lacks make and Ruby, so its two Python checks were run directly; GitHub's links job passed the complete target. One enforcement defect remains inline.

Comment thread docs/engineering.md Resolved
gloryfromca and others added 2 commits November 20, 2026 18:10
Actions were referenced by tag (actions/checkout@v7,
astral-sh/setup-uv@v10.3.3) or by branch
(pypa/gh-action-pypi-publish@release/v1). A tag or branch can be moved
to other code, and the publish job holds the PyPI upload token, so a
compromised upstream ref would run in our release. Each uses: now names
the commit those refs point to today, with the version in a trailing
comment that Dependabot updates together with the SHA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repository setting that refuses unpinned actions is turned on only
after this branch lands; until then the docs must not say it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gloryfromca
gloryfromca force-pushed the ci/pin-actions-to-sha branch from b85fc27 to 28fbeaf Compare November 20, 2026 10:10

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers; this can merge as far as I am concerned.

The range comparison shows the original pinning patch is unchanged after the rebase; the new commit only removes the unsupported enforcement claim, which settles the prior finding. Reviewed the full origin/main...HEAD diff and revision delta against the project guidance, workflow callers, Dependabot/history, backward compatibility, and test impact. Architecture constraints are not implicated, and no tests or gates were weakened.

Validation: git diff --check, scripts/check_docs.py, and scripts/check_github_contributor_docs.py passed, and every current external uses: reference matches a full 40-character SHA. GitHub's lint, docs, commit checks, and package build pass; unit and integration jobs are still pending. The settled thread was replied to and resolved.

@Kendrick-Song Kendrick-Song left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Each pinned SHA was checked with the GitHub API against the reference it replaces:

  • actions/checkout: v7 and v7.0.1 both resolve to 3d3c42e5aac5ba805825da76410c181273ba90b1
  • astral-sh/setup-uv: v10.3.3 resolves to 68559e99cc807c1eb7e9238fd43a15bba460eec2
  • pypa/gh-action-pypi-publish: the head of release/v1 and the annotated tag v1.14.3 (dereferenced) both resolve to 7245906fb61fa33a13554f9d5fb856fe61758086

No unpinned uses: is left in the four workflows, and .github/dependabot.yml already covers github-actions. After merge, the repository setting that requires full-length SHA pins still has to be turned on by an admin.

@gloryfromca
gloryfromca merged commit aa44f91 into main Nov 23, 2026
11 checks passed
@gloryfromca
gloryfromca deleted the ci/pin-actions-to-sha branch November 23, 2026 02:34
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.

2 participants