Skip to content

Harden scheduled/downstream build workflows against zizmor findings - #6544

Merged
bmribler merged 4 commits into
HDFGroup:developfrom
mkitti:mkitti/harden-build-test-workflows
Aug 4, 2026
Merged

Harden scheduled/downstream build workflows against zizmor findings#6544
bmribler merged 4 commits into
HDFGroup:developfrom
mkitti:mkitti/harden-build-test-workflows

Conversation

@mkitti

@mkitti mkitti commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Hardens the scheduled/downstream build workflows against all zizmor v1.25.2 static-analysis findings. No behavioral change: ${{ }} expressions moved out of run: bodies are referenced identically via shell env vars, and persist-credentials: false only prevents the checkout token from being written to the git config (none of these jobs push to git).

Findings fixed per file

File template-injection artipacked excessive-permissions
cve.yml 2 1 -
daily-build.yml 3 - -
daily-schedule.yml 2 1 -
hdfeos5.yml 2 1 -
linkchecker.yml 2 1 -
macos-26-matrix.yml 2 1 1
netcdf.yml 2 2 -

Remediation patterns

  • template-injection: expressions such as ${{ runner.workspace }}, ${{ steps.*.outputs.* }}, ${{ inputs.use_ignore }}, ${{ needs.*.outputs.* }}, ${{ steps.lychee.outcome }}, and ${{ secrets.AWS_S3_BUCKET }} were moved into step-level env: blocks and referenced as $NAME in the scripts.
  • artipacked: persist-credentials: false added to each flagged actions/checkout step. No job in these files pushes to git, so all were safe to harden.
  • excessive-permissions: only macos-26-matrix.yml lacked a top-level permissions: block; added permissions: contents: read. The other six files already restrict permissions.

Verified: zizmor reports zero findings across all seven files, and all files pass YAML validation.

🤖 Generated with Claude Code

Fix all zizmor static-analysis findings in the scheduled/downstream build
workflows without changing behavior:

- template-injection: move ${{ }} expressions out of run: script bodies
  into step-level env: blocks referenced as shell variables
- artipacked: add persist-credentials: false to actions/checkout steps
  (none of these jobs push to git)
- excessive-permissions: add top-level 'permissions: contents: read' to
  macos-26-matrix.yml (other files already restrict permissions)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 21:33
@github-project-automation github-project-automation Bot moved this to To be triaged in HDF5 - TRIAGE & TRACK Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 several scheduled/downstream GitHub Actions workflows to address zizmor findings (template injection, artipacked, and excessive permissions) without changing behavior.

Changes:

  • Moves ${{ ... }} expressions out of run: bodies into step env: and references via shell vars.
  • Adds persist-credentials: false to flagged actions/checkout steps.
  • Adds a top-level permissions: contents: read to the macOS matrix workflow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/netcdf.yml Adds persist-credentials: false to checkouts; switches ${{ runner.workspace }} usage to env var.
.github/workflows/macos-26-matrix.yml Adds top-level reduced permissions; hardens checkout and ${{ runner.workspace }} usage via env.
.github/workflows/linkchecker.yml Hardens checkout; moves step outcome expression to env var for job summary publishing.
.github/workflows/hdfeos5.yml Adds persist-credentials: false; uses RUNNER_WORKSPACE env var in build steps.
.github/workflows/daily-schedule.yml Moves needs/steps/secrets expressions into env vars; uses them in shell.
.github/workflows/daily-build.yml Moves input/output expressions into env vars for run: echo steps.
.github/workflows/cve.yml Uses RUNNER_WORKSPACE env var for build dir; adds persist-credentials: false to repo checkout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/daily-schedule.yml Outdated
Comment on lines +30 to +33
env:
DAILY_BUILD_FILE_BASE: ${{ needs.daily-build.outputs.file_base }}
run: |
FILE_NAME_BASE=$(echo "${{ needs.daily-build.outputs.file_base }}")
FILE_NAME_BASE=$(echo "$DAILY_BUILD_FILE_BASE")
Comment thread .github/workflows/daily-build.yml Outdated
Comment on lines +57 to +59
- env:
HDF5_NAME_BASE: ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }}
run: echo "hdf5 base name is $HDF5_NAME_BASE."
Comment thread .github/workflows/daily-build.yml Outdated
INPUTS_USE_IGNORE: ${{ inputs.use_ignore }}
run: |
echo "INPUTS_IGNORE=${{ inputs.use_ignore }}" >> $GITHUB_OUTPUT
echo "INPUTS_IGNORE=$INPUTS_USE_IGNORE" >> $GITHUB_OUTPUT
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

This PR touches the following areas. Each needs a sign-off
from its listed owners before merging.

- Drop unnecessary command substitution in daily-schedule.yml's
  FILE_NAME_BASE assignment
- Name the two env-block steps in daily-build.yml that previously ran
  unnamed (easier to scan in logs)
- Quote $GITHUB_OUTPUT in the getinputs step

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mkitti

mkitti commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the 3 Copilot review comments in db8ea95:

  • Dropped the unnecessary $(echo ...) command substitution in daily-schedule.yml's FILE_NAME_BASE assignment.
  • Named the two steps in daily-build.yml that gained env: blocks but were previously unnamed.
  • Quoted "$GITHUB_OUTPUT" in the getinputs step.

hyoklee
hyoklee previously approved these changes Jul 23, 2026
@bmribler bmribler self-assigned this Aug 4, 2026
@bmribler
bmribler merged commit 00af100 into HDFGroup:develop Aug 4, 2026
132 checks passed
@github-project-automation github-project-automation Bot moved this from To be triaged to Done in HDF5 - TRIAGE & TRACK Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants