Skip to content

Commit 2a829f4

Browse files
committed
Pin GitHub Actions to commit SHAs, drop unmaintained coverage comment
OSSF Scorecard's pinned-dependencies check was at 1/10. Out of 14 GitHub-owned action references only 3 were SHA-pinned (all in scorecard.yml from PR #138); the rest were on floating tags like @v4 or, in one third-party case, on a branch ref (@main). Floating refs are mutable; supply-chain attacks on actions become silent on push. Pinning every reference to a full-length commit SHA with the human- readable version as a trailing comment. Dependabot already runs on the github-actions ecosystem (added earlier in this PR) so the version comments stay fresh as bumps land. Workflow-by-workflow: - bandit.yml: pin actions/checkout v6.0.2, PyCQA/bandit-action v1.0.1 - codeql.yml: pin actions/checkout v6.0.2 and all three github/codeql-action sub-paths (init, autobuild, analyze) to v4.35.3 - publish.yml: pin actions/checkout v6.0.2, actions/setup-python v6.2.0, actions/upload-artifact v4.6.2, actions/download-artifact v4.3.0, and pypa/gh-action-pypi-publish v1.14.0 (was @release/v1 branch) - python.yml: pin actions/checkout v6.0.2, actions/setup-python v6.2.0; drop MishaKav/pytest-coverage-comment@main step entirely. It was the only third-party action on a moving branch ref and the only reason the build job needed pull-requests: write. Coverage still gets printed to the workflow log via pytest --cov-report term-missing. The pip-install commands in these workflows are still unpinned. That's a follow-up PR -- requires generating a hash-pinned requirements.txt with pip-tools and reworking the install steps.
1 parent 8410499 commit 2a829f4

4 files changed

Lines changed: 13 additions & 22 deletions

File tree

.github/workflows/bandit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@v6.0.2
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2525

2626
- name: Perform Bandit Analysis
27-
uses: PyCQA/bandit-action@v1
27+
uses: PyCQA/bandit-action@ca64e96d362b1764a98d841aaf3a4b1e2d690c7b # v1.0.1
2828
with:
2929
targets: "bitmath/ tests/"

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ jobs:
2323

2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@v6.0.2
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2727

2828
- name: Initialize CodeQL
29-
uses: github/codeql-action/init@v4
29+
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
3030
with:
3131
languages: python
3232

3333
- name: Autobuild
34-
uses: github/codeql-action/autobuild@v4
34+
uses: github/codeql-action/autobuild@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
3535

3636
- name: Perform CodeQL Analysis
37-
uses: github/codeql-action/analyze@v4
37+
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
3838
with:
3939
category: "/language:python"

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
env:
1313
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1414
steps:
15-
- uses: actions/checkout@v6.0.2
16-
- uses: actions/setup-python@v6.2.0
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1717
with:
1818
python-version: "3.12"
1919
- name: Build package
2020
run: pip install build && python -m build
2121
- name: Upload dist artifacts
22-
uses: actions/upload-artifact@v4
22+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2323
with:
2424
name: dist
2525
path: dist/
@@ -32,9 +32,9 @@ jobs:
3232
id-token: write
3333
steps:
3434
- name: Download dist artifacts
35-
uses: actions/download-artifact@v4
35+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
3636
with:
3737
name: dist
3838
path: dist/
3939
- name: Publish to PyPI
40-
uses: pypa/gh-action-pypi-publish@release/v1
40+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/python.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ permissions: read-all
66

77
jobs:
88
build:
9-
permissions:
10-
pull-requests: write
119
env:
1210
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1311
strategy:
@@ -17,10 +15,10 @@ jobs:
1715
runs-on: ${{ matrix.os }}
1816
steps:
1917
- name: "GitHub Checks it out :sunglasses-face:"
20-
uses: actions/checkout@v6.0.2
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2119

2220
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v6.2.0
21+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2422
with:
2523
python-version: ${{ matrix.python-version }}
2624
cache: 'pip'
@@ -47,10 +45,3 @@ jobs:
4745
- name: Run Unit Tests
4846
run: |
4947
pytest -v --cov=bitmath --cov-report term-missing --cov-report term:skip-covered --cov-report xml:coverage.xml tests
50-
51-
- name: Coverage report on PR
52-
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
53-
uses: MishaKav/pytest-coverage-comment@main
54-
with:
55-
pytest-xml-coverage-path: ./coverage.xml
56-
title: "Test Coverage Report"

0 commit comments

Comments
 (0)