Skip to content

Harden GitHub Actions workflows and add zizmor audit#242

Merged
Kludex merged 2 commits intomasterfrom
harden-github-workflows
Apr 5, 2026
Merged

Harden GitHub Actions workflows and add zizmor audit#242
Kludex merged 2 commits intomasterfrom
harden-github-workflows

Conversation

@Kludex
Copy link
Copy Markdown
Owner

@Kludex Kludex commented Apr 5, 2026

Summary

  • Pin all third-party actions to full commit SHAs with version comments.
  • Add least-privilege permissions blocks at the workflow and job level.
  • Set persist-credentials: false on checkouts that don't push to git (the docs.yml deploy job keeps credentials because mkdocs gh-deploy pushes to gh-pages; the artipacked finding is suppressed inline).
  • Disable the uv cache in the release/publish and docs workflows to avoid cache-poisoning risk in tag-triggered jobs.
  • Add a new zizmor.yml workflow that runs the zizmor security audit on every push to master and on every pull request.

Modeled after Kludex/uvicorn@042ffeb.

Test plan

  • zizmor .github/workflows/ reports no findings locally.
  • CI (including the new zizmor job) passes on this PR.

- Pin all third-party actions to full commit SHAs with version comments
- Add least-privilege `permissions` blocks at workflow and job level
- Set `persist-credentials: false` on checkouts that don't push to git
- Disable uv cache in release workflows to avoid cache-poisoning risk
- Add a `zizmor.yml` workflow that runs the zizmor security audit on push and PR
Comment on lines +17 to +18
contents: read # Only needed for private repos. Needed to clone the repo.
actions: read # Only needed for private repos. Needed for upload-sarif to read workflow run info.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Are those necessary here?

@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

- Pin pypa/gh-action-pypi-publish to the actual commit SHA for v1.13.0
  (the previous value was the annotated tag object SHA, which zizmor
  flagged as having no history in the referenced repository)
- Drop contents/actions read permissions from the zizmor job since this
  repository is public and zizmor-action only needs them for private or
  internal repos
@Kludex Kludex merged commit 8f1dbed into master Apr 5, 2026
8 checks passed
@Kludex Kludex deleted the harden-github-workflows branch April 5, 2026 20:28
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