chore: increase security level in workflows and README#246
Conversation
…nSSF badge Agent-Logs-Url: https://github.com/fabiocaccamo/python-fontbro/sessions/8da9bd64-323d-497f-9423-a47c9f8792fa Co-authored-by: fabiocaccamo <1035294+fabiocaccamo@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #246 +/- ##
=======================================
Coverage 99.18% 99.18%
=======================================
Files 8 8
Lines 986 986
=======================================
Hits 978 978
Misses 8 8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR hardens the repository’s CI/CD supply chain security by pinning GitHub Actions to immutable commit SHAs, tightening default GITHUB_TOKEN permissions (notably for the release workflow), and adding an OpenSSF Scorecard badge to the README.
Changes:
- Pin third-party GitHub Actions to commit SHAs in all workflows (while retaining the original version/branch as an inline comment).
- Add explicit workflow/job
permissionsincreate-release.ymlto avoid inheriting broad default token scopes. - Add an OpenSSF Scorecard badge to
README.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Adds OpenSSF Scorecard badge alongside existing project badges. |
.github/workflows/update-data.yml |
Pins actions (checkout, setup-python, action-update-file) to SHAs. |
.github/workflows/test-package.yml |
Pins actions (checkout, setup-python, codecov-action) to SHAs. |
.github/workflows/pre-commit-autoupdate.yml |
Pins actions (checkout, setup-python, autoupdate, create-pull-request) to SHAs. |
.github/workflows/create-release.yml |
Deny-by-default workflow permissions and pins all actions to SHAs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| runs-on: ubuntu-latest | ||
| # environment: release | ||
| permissions: | ||
| contents: write |
There was a problem hiding this comment.
The job sets contents: write, but the release creation uses WORKFLOWS_CREATE_RELEASE_TOKEN and checkout only needs read access. To keep the hardened permissions: {} approach least-privilege, consider changing this to contents: read unless there's a specific need for write via GITHUB_TOKEN.
| contents: write | |
| contents: read |
| steps: | ||
|
|
||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 |
There was a problem hiding this comment.
The steps: list items appear to be indented at the same level as the steps: key (e.g., - uses: ...), which will make the workflow YAML invalid. Indent each step item under steps: so the list is nested correctly.
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | ||
| with: |
There was a problem hiding this comment.
This workflow is currently granted contents: write at the workflow level, but the only write operation appears to use a dedicated token (WORKFLOWS_UPDATE_DATA_TOKEN). Consider reducing the workflow/job GITHUB_TOKEN permissions to contents: read (or permissions: {} plus job-level contents: read) to follow least-privilege.
Hardens CI/CD supply chain security by pinning actions to immutable commit SHAs, restricting GITHUB_TOKEN permissions, and adding an OpenSSF Scorecard badge.
Changes
test-package.yml,pre-commit-autoupdate.yml,update-data.yml,create-release.yml) — version tag preserved as inline comment:create-release.ymlpermissions — no top-levelpermissionsblock meant the job inherited repo-default token scopes (potentiallywrite-all). Now:README.mdafter the ruff badge.Related issue
?
Checklist before requesting a review