Skip to content

chore(ci): pin all GitHub Actions to commit SHAs + add concurrency to audit.yml#35

Closed
saagpatel wants to merge 1 commit into
mainfrom
chore/harden-ci-sha-pins
Closed

chore(ci): pin all GitHub Actions to commit SHAs + add concurrency to audit.yml#35
saagpatel wants to merge 1 commit into
mainfrom
chore/harden-ci-sha-pins

Conversation

@saagpatel
Copy link
Copy Markdown
Owner

What

Pins every uses: action reference across all 5 workflows to an immutable commit SHA (annotated with the resolved version), and adds a concurrency group to audit.yml.

Why

Floating major tags (@v6, @release/v1) are a supply-chain surface — a tag can be force-repointed to malicious code. Commit SHAs can't move. This is the auditor dogfooding the GitHub Actions hardening posture it reports on other repos.

Pins (resolved live against canonical's current majors)

action SHA version
actions/checkout de0fac2 v6.0.2
actions/setup-python a309ff8 v6.2.0
actions/cache (+ /save) 27d5ce7 v5.0.5
actions/upload-artifact 043fb46 v7.0.1
actions/download-artifact 37930b1 v7.0.0
github/codeql-action (init + analyze) 87557b9 v4.36.1
softprops/action-gh-release b430933 v3.0.0
pypa/gh-action-pypi-publish cef2210 v1.14.0

Concurrency

audit.yml gains group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false so overlapping scheduled audits serialize instead of racing on the history cache. ci.yml and codeql.yml already had concurrency.

Notes

  • Supersedes the stale archived PR #183 (on the private-archive remote) which targeted older v4/v5 action majors no longer used here.
  • Verified locally: all 5 workflows parse as valid YAML; zero unpinned refs remain. No Python changed — test suite unaffected.

… audit.yml

Pin every `uses:` ref across all 5 workflows (audit, ci, codeql, pypi,
release) from floating major tags to the commit SHA their current tag
resolves to, annotated with the resolved version. Removes the moving-tag
supply-chain surface: a compromised or repointed tag can no longer swap
action code into our CI silently.

Add a concurrency group to audit.yml (ci.yml and codeql.yml already had
one) with cancel-in-progress: false, so overlapping scheduled audit runs
serialize instead of racing on the history cache.

Pins are re-derived fresh against canonical's current action majors
(checkout v6, setup-python v6, upload/download-artifact v7, action-gh-release
v3); supersedes the stale archived attempt that targeted older v4/v5 majors.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94dca6df82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the PyPI workflow policy assertion

With this action reference now pinned, tests/test_distribution_policy.py still asserts the old floating string pypa/gh-action-pypi-publish@release/v1, and ci.yml runs python -m pytest tests/ -v --tb=short, so every CI run fails before reaching lint/type checks. I verified this with python -m pytest tests/test_distribution_policy.py -q; please update the policy test to accept the pinned ref or the adjacent version annotation.

Useful? React with 👍 / 👎.


- name: Initialize CodeQL
uses: github/codeql-action/init@v4
uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4.36.1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the CodeQL workflow policy assertion

Pinning CodeQL to a SHA leaves tests/test_distribution_policy.py expecting github/codeql-action/init@v4 and github/codeql-action/analyze@v4; because the CI workflow runs the full pytest suite, this makes the pipeline fail on this commit. I verified the failure with python -m pytest tests/test_distribution_policy.py -q; please update the distribution policy test to validate the pinned CodeQL refs or their version comments.

Useful? React with 👍 / 👎.

@saagpatel
Copy link
Copy Markdown
Owner Author

Superseded — canonical main already carries identical SHA pins (same commit SHAs across all 5 workflows + audit.yml concurrency + the companion test_distribution_policy.py assertion updates) as of #36. This branch was developed in parallel and converged on the exact same pins; closing as redundant. The CI failure here was only because this branch forked from #33 (pre-update policy tests) — main's version is strictly more complete.

@saagpatel saagpatel closed this Jun 3, 2026
@saagpatel saagpatel deleted the chore/harden-ci-sha-pins branch June 3, 2026 05:35
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