Harden workflow checkout credential hygiene + permissions - #6545
Conversation
Address zizmor static-analysis findings: - artipacked: add `persist-credentials: false` to actions/checkout steps in codeql.yml (2), test-binary-installation.yml (2), clang-format-check.yml, freebsd.yml, h5py.yml, openbsd.yml, signed-plugins.yml, and update-progress.yml. None of these jobs push to git, so dropping the persisted checkout credential is safe. - excessive-permissions: restrict call-workflows.yml top-level permissions to `contents: read`, and grant `packages: write` / `pull-requests: write` only on the two jobs that call the maven-staging reusable workflow (which declares those needs). No behavioral change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Hardens GitHub Actions workflows by reducing credential persistence and scoping permissions more tightly, in line with zizmor findings, without intended behavioral changes.
Changes:
- Added
persist-credentials: falseto multipleactions/checkoutsteps to avoid leaving git credentials on disk. - Reduced top-level workflow permissions in
call-workflows.ymland scoped elevated permissions to only the jobs that require them.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/update-progress.yml | Disables persisted checkout credentials for the workflow checkout. |
| .github/workflows/test-binary-installation.yml | Disables persisted checkout credentials for external example repo checkouts. |
| .github/workflows/signed-plugins.yml | Disables persisted checkout credentials for the workflow checkout. |
| .github/workflows/openbsd.yml | Disables persisted checkout credentials for the workflow checkout. |
| .github/workflows/h5py.yml | Disables persisted checkout credentials for the Spack checkout. |
| .github/workflows/freebsd.yml | Disables persisted checkout credentials for the workflow checkout. |
| .github/workflows/codeql.yml | Disables persisted checkout credentials in both CodeQL jobs’ checkouts. |
| .github/workflows/clang-format-check.yml | Disables persisted checkout credentials for the workflow checkout. |
| .github/workflows/call-workflows.yml | Narrows default permissions and adds job-level permissions only where needed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python |
| call-maven-staging: | ||
| name: "Maven Staging Tests" | ||
| needs: call-release-cmake | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| pull-requests: write | ||
| uses: ./.github/workflows/maven-staging.yml |
| call-maven-ffm-staging: | ||
| name: "Maven Staging Tests" | ||
| needs: call-ffm-latest-java | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| pull-requests: write | ||
| uses: ./.github/workflows/maven-staging.yml |
Note: interaction with #6546 (Maven/Java hardening)This PR re-grants #6546 reduces Both PRs are correct and zizmor-clean independently. The fully least-privilege end state (dropping these two job-level grants to |
Review ChecklistThis PR touches the following areas. Each needs a sign-off
|
|
Checked both Copilot comments:
Separately, the one real CI failure ( |
Addresses
zizmor(v1.25.2) static-analysis findings in a set of workflow files. No behavioral change.artipacked —
persist-credentials: falseadded toactions/checkoutNone of these jobs push to git (verified: no
git push/git commit/gh-pages/peaceiris/auto-commit/EndBug), so dropping the persisted checkout credential is safe.excessive-permissions — call-workflows.yml (2 findings)
The top-level
permissionspreviously grantedpackages: writeandpull-requests: writeto every job. Restricted the top level tocontents: read, and movedpackages: write/pull-requests: writeto the two jobs (call-maven-staging,call-maven-ffm-staging) that call themaven-staging.ymlreusable workflow, which is the only called workflow declaring those needs. All other called workflows already declarecontents: read.Verification
zizmorre-run over all nine files: No findings to report (0 findings).yaml.safe_load.🤖 Generated with Claude Code