Skip to content

ci: harden GitHub Actions security - #130

Merged
kratsg merged 7 commits into
mainfrom
secure-ci
Aug 13, 2026
Merged

ci: harden GitHub Actions security#130
kratsg merged 7 commits into
mainfrom
secure-ci

Conversation

@kratsg

@kratsg kratsg commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Pinned all GitHub Actions to full-length commit SHAs with version comments (actions-up, then hand-verified against the GitHub API).
  • Added least-privilege permissions: blocks:
    • deploy.yml: workflow-level permissions: {} (the dispatch step uses a dedicated PAT, not GITHUB_TOKEN).
    • docs.yml: workflow-level permissions: {}, build job scoped to contents: read, deploy job keeps its existing documented pages: write / id-token: write.
  • Set persist-credentials: false on the docs.yml checkout step (it never pushes).
  • Added a concurrency group to deploy.yml (docs.yml and semantic-pr-check.yml already had one).
  • Named the previously-anonymous trigger-gitops, build, and deploy jobs.
  • Added the zizmor pre-commit hook (^\.github only, --persona=pedantic) so these checks run locally and in CI.
  • Dependabot: switched the github-actions group's Dependabot config to the modern github-actions alias (was actions), monthly grouped updates (was weekly), and a 7-day cooldown.
  • Froze every existing pre-commit hook rev to its commit SHA (no version bumps — all hooks stay on the same tag they were already pinned to).
  • Added exclude-newer = "7d" to pixi.toml so newly published conda-forge/PyPI releases get a 7-day cooldown before pixi will pick them up.

Major version changes

None. actions-up resolved every action to the same tag it was already on (just newly SHA-pinned), and prek auto-update --freeze kept every pre-commit hook at its current tag.

Held-back items

None. Nothing needed to be held back at an older version.

zizmor ignores

  • dangerous-triggers on semantic-pr-check.yml's pull_request_target trigger: the job never checks out the PR head and only reads the PR title via the GitHub API (amannn/action-semantic-pull-request); pull_request_target is required so statuses: write works for PRs opened from forks (a plain pull_request trigger from a fork gets a read-only token and can't set a commit status). Documented inline as a # zizmor: ignore[dangerous-triggers] comment with rationale.

Verification

  • uvx zizmor --persona=pedantic .github → clean (No findings to report, 1 ignored/documented as above).
  • uvx prek run --all-files → all hooks pass except shellcheck, which fails on docs/slac/SLACuser_setups.txt (pre-existing warnings unrelated to this change set — confirmed identical failure on origin/main before any of these edits, and the shellcheck hook version was not bumped). Out of scope per CI-security-only scope guard; flagging for a separate fix.
  • All uses: refs in .github/workflows/ are pinned to full 40-character SHAs (spot-checked against gh api repos/<owner>/<repo>/git/refs/tags/<tag>).

kratsg added 3 commits August 13, 2026 13:12
Pin all actions to full-length commit SHAs with version comments
(actions-up), add explicit least-privilege permissions blocks,
set persist-credentials: false on checkout, add a concurrency group
to deploy.yml, and name previously-anonymous jobs to clear zizmor
findings.

Assisted-by: Claude (Anthropic)
Add the zizmor pre-commit hook to catch GitHub Actions security
issues locally, switch Dependabot to monthly grouped updates under
the modern "github-actions" ecosystem alias with a 7-day cooldown,
and freeze all existing pre-commit hook revs to their commit SHAs.

Assisted-by: Claude (Anthropic)
Delay pulling brand-new conda-forge/PyPI releases into the pixi
environment for 7 days, matching the Dependabot/actions-up cooldown
used elsewhere in this change set.

Assisted-by: Claude (Anthropic)
@kratsg
kratsg marked this pull request as ready for review August 13, 2026 18:33
@kratsg
kratsg requested a review from a team as a code owner August 13, 2026 18:33
@kratsg
kratsg requested a review from a team as a code owner August 13, 2026 19:09
@kratsg
kratsg merged commit cc95b09 into main Aug 13, 2026
4 checks passed
@kratsg
kratsg deleted the secure-ci branch August 13, 2026 19:12
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.

1 participant