Skip to content

sec: Harden GitHub workflows with Zizmor#353

Merged
lowlydba merged 9 commits into
mainfrom
zizmor
Apr 11, 2026
Merged

sec: Harden GitHub workflows with Zizmor#353
lowlydba merged 9 commits into
mainfrom
zizmor

Conversation

@lowlydba
Copy link
Copy Markdown
Owner

@lowlydba lowlydba commented Apr 11, 2026

Description

Times, they are a changin'. And this repo needs to be prepared.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue) - Fixes #
  • New feature (non-breaking change which adds functionality)

Checklist:

Pin several GitHub Actions and third-party workflow refs to specific SHAs/digests for reproducible runs; add permissions (contents/id-token/pages) where required for coverage uploads, OIDC and docs publishing; set persist-credentials: false on checkouts and adjust run images/digests. Also add a 7-day Dependabot cooldown and minor CI tweaks (ubuntu-slim for docs comment, curl env fix for release input). These changes improve security, stability and reduce noisy Dependabot updates.
Tighten and standardize GitHub Actions across workflows:

- ansible-test-windows.yml: deny workflow-level permissions (scope per job), add job env (NAMESPACE, COLLECTION_NAME, GHWS, CODECOV_TOKEN), and switch pip invocations to python3 (remove matrix.python usage). Keep id-token and other required permissions per job.
- ansible-test.yml: restrict default permissions (contents: read), expose CODECOV_TOKEN as job env for Sanity and Integration jobs, and remove duplicated env on codecov steps.
- docs-pr.yml: change trigger from pull_request_target to pull_request to avoid elevated token scope for PRs.
- release.yml: add concurrency and restrict default permissions (contents: read), expose VERSION, GALAXY_API_KEY, and GITHUB_TOKEN to the release job, and fix the Galaxy validation curl to use the VERSION env var.

Overall these changes improve security (reduce default permissions), ensure required secrets/envs are available to jobs, and fix platform-specific command usage and release validation.
Add zizmor ignore annotations and comments to GitHub Actions workflows, tighten workflow-level permissions (set to {} to scope per-job), and propagate environment variables into relevant steps. Replace inline matrix/github workspace usages with step env vars (e.g. ANSIBLE, GHWS, NAMESPACE, COLLECTION_NAME, GROUP) for pip installs, ansible-test invocations, and coverage/reporting steps; adjust WSL path conversion to use WORKSPACE env. Add explanatory comments for CODECOV_TOKEN and secrets usage. In release workflow, switch to using env.VERSION/GHP_BASE_URL/GALAXY_API_KEY/GITHUB_TOKEN, fix curl quoting, update Python release description to reference env variables, and annotate the release action usage. These changes improve lint suppression, environment scoping, and consistency across jobs.
@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.

Comment thread .github/workflows/ansible-test-windows.yml Fixed
Comment thread .github/workflows/ansible-test.yml Fixed
Comment thread .github/workflows/ansible-test.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/ansible-test.yml Fixed
Comment thread .github/workflows/ansible-test.yml Fixed
Comment thread .github/workflows/docs-pr.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Bump pinned action commit SHAs across CI workflows to use newer/stable revisions and add a note for docs action:

- .github/workflows/ansible-test-windows.yml: Vampire/setup-wsl pinned to v6.1.0
- .github/workflows/ansible-test.yml: ansible-community/ansible-test-gh-action updated to a newer SHA for both sanity and integration jobs
- .github/workflows/docs-pr.yml: ansible-docs-build-comment usage kept on the same SHA but annotated to ignore stale-action-refs
- .github/workflows/release.yml: actions/setup-python pinned to v6.2.0 and artis3n/ansible_galaxy_collection SHA updated

These changes refresh action references to pick up fixes/updates and clarify the docs action pin.
Add inline zizmor ignore comments to .github/workflows/ansible-test.yml to suppress lint warnings: mark CODECOV_TOKEN env usages with secrets-outside-env (Codecov token required for uploading coverage, used only with workflow_dispatch) and mark the mcr.microsoft.com/mssql/server image with unpinned-images (trusted publisher for this CI use case). These comments silence false positives from security/lint tooling while preserving intended CI behavior.
Update GitHub Actions concurrency group expressions to use github.event.pull_request.number || github.ref (or for docs-pr, replace head_ref) so workflows create stable, per-PR concurrency groups. This prevents runs for different pull requests (or branches with the same name) from canceling each other. Applied to ansible-test-windows.yml, ansible-test.yml, docs-pr.yml, and zizmor.yml.
@lowlydba lowlydba merged commit 9bb50f0 into main Apr 11, 2026
11 of 12 checks passed
@lowlydba lowlydba deleted the zizmor branch April 11, 2026 18:30
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