Skip to content

Commit c87c5b8

Browse files
ci: pin GitHub Actions to commit SHAs (supply-chain hardening) (#103)
Every `uses:` is pinned to a full 40-char commit SHA with a trailing `# vX.Y.Z` comment, replacing floating major tags (and the `release/v1` branch for gh-action-pypi-publish). A mutable ref can be silently repointed if an action repo or maintainer account is compromised (cf. tj-actions/changed-files, March 2025); a SHA pin cannot. Pins target the latest release of each action, all reviewed this session. Dependabot (github-actions ecosystem, already configured) updates SHA pins and bumps the version comment alongside, so security fixes still arrive as reviewable PRs. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b1308c3 commit c87c5b8

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
lint:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v6
20+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
2121
- name: Set up Python
22-
uses: actions/setup-python@v6
22+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2323
with:
2424
python-version: "3.14"
2525
- name: Install ruff
@@ -60,9 +60,9 @@ jobs:
6060
python-version: "pypy-3.11"
6161

6262
steps:
63-
- uses: actions/checkout@v6
63+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
6464
- name: Set up Python ${{ matrix.python-version }}
65-
uses: actions/setup-python@v6
65+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
6666
with:
6767
python-version: ${{ matrix.python-version }}
6868
- name: Install tools in CI venv
@@ -89,13 +89,13 @@ jobs:
8989
needs: test
9090
runs-on: ubuntu-latest
9191
steps:
92-
- uses: actions/checkout@v6
93-
- uses: actions/setup-python@v6
92+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
93+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
9494
with:
9595
python-version: "3.14"
9696
- run: pip install build
9797
- run: python -m build
98-
- uses: actions/upload-artifact@v7
98+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
9999
with:
100100
name: dist
101101
path: dist/
@@ -108,11 +108,11 @@ jobs:
108108
permissions:
109109
id-token: write
110110
steps:
111-
- uses: actions/download-artifact@v8
111+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
112112
with:
113113
name: dist
114114
path: dist/
115115

116-
- uses: pypa/gh-action-pypi-publish@release/v1
116+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
117117
with:
118118
packages-dir: dist/

‎.github/workflows/coverage.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
python-version: ["3.12"]
2020

2121
steps:
22-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v6
24+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install tools in CI virtualenv
@@ -46,7 +46,7 @@ jobs:
4646
pdm run python -m coverage run --source=. -m runtests
4747
pdm run python -m coverage xml
4848
- name: Upload coverage to Codecov
49-
uses: codecov/codecov-action@v6
49+
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
5050
with:
5151
token: ${{ secrets.CODECOV_TOKEN }}
5252
files: ./coverage.xml

0 commit comments

Comments
 (0)