Skip to content

ci: harden GitHub Actions workflows and add zizmor scan - #169

Merged
antonwolfy merged 2 commits into
masterfrom
harden-github-actions-workflows
Sep 3, 2026
Merged

ci: harden GitHub Actions workflows and add zizmor scan#169
antonwolfy merged 2 commits into
masterfrom
harden-github-actions-workflows

Conversation

@antonwolfy

Copy link
Copy Markdown
Collaborator

Backport of IntelPython/dpctl#2374 to mkl_random.

Introduces a CI job that runs the zizmor static analyzer over the workflow files in .github/, and applies the hardening zizmor recommends across the existing workflows.

Changes

  • Narrow default permissions — replace top-level permissions: read-all with a scoped permissions:\n contents: read in build-docs.yml, build-with-clang.yml, build-with-standard-clang.yml, build_pip.yml, conda-package.yml, conda-package-cf.yml, pre-commit.yml, and openssf-scorecard.yml. Job-level permission blocks are left intact.
  • Disable credential persistence — add persist-credentials: false to every actions/checkout step that lacked it, preventing the checkout token from lingering in the local git config.
  • Dependabot cooldown — add a 7-day cooldown to both the github-actions and pre-commit update entries.
  • New zizmor.yml workflow — runs the zizmor scanner on pushes to master and on pull requests, with empty top-level permissions and a scoped contents: read job permission. min-severity: medium, so low/informational template-injection notes from internally-defined values are surfaced as annotations but do not gate CI.

Notes

The template-injection fix and the mshick/add-pr-comment version-comment fix from the upstream PR are not applicable here: mkl_random has no workflow interpolating user-controllable dispatch inputs into a run: block, and it does not use mshick/add-pr-comment.

CI/configuration-only change; no library code, tests, or documentation are affected.

Backport of IntelPython/dpctl#2374.

- Narrow top-level `permissions: read-all` to `contents: read`.
- Add `persist-credentials: false` to all actions/checkout steps.
- Add a 7-day cooldown to the dependabot update entries.
- Add a zizmor workflow that scans .github/ for supply-chain and
  privilege-escalation issues in GitHub Actions workflows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zizmor's stale-action-refs audit flagged the styfle/cancel-workflow-action
pins: the SHA is correct, but its tag is `0.13.1` (no `v` prefix), so the
`# v0.13.1` comment resolved to an unknown ref. Drop the `v` to match the
actual tag and let the zizmor scan pass.

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
Thank you @antonwolfy

@antonwolfy
antonwolfy merged commit ab42a8e into master Sep 3, 2026
128 of 134 checks passed
@antonwolfy
antonwolfy deleted the harden-github-actions-workflows branch September 3, 2026 13: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.

2 participants