Skip to content

Add zizmor workflow and fix GitHub Actions security findings - #16

Open
antoine-olivier wants to merge 2 commits into
ipython:mainfrom
antoine-olivier:ci/add-zizmor
Open

antoine-olivier wants to merge 2 commits into
ipython:mainfrom
antoine-olivier:ci/add-zizmor

Conversation

@antoine-olivier

Copy link
Copy Markdown

Refs jupyter/security#141

Breakage risks & untested paths

  • publish job (.github/workflows/test.yml) only runs on refs/tags/* pushes (not exercised by PR CI): actions/checkout now sets persist-credentials: false, and job permissions explicitly declares contents: read alongside id-token: write.
  • actions/cache step (tests job) now sets lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }} to address cache-poisoning on tag pushes while keeping normal caching active on branches and pull requests.
  • No .github/zizmor.yml ignores were needed (12/12 baseline findings fixed directly).

Summary (2 commits for easier review)

  1. Commit 1 — mechanical pinning & cooldown (zero behavior change):
    • Pin all 6 action references in .github/workflows/test.yml to immutable commit SHAs resolved via git ls-remote (keeping current major versions: actions/checkout@v4.4.0, actions/setup-python@v6.3.0, actions/cache@v4.3.0, pypa/gh-action-pypi-publish@v1.14.3).
    • Add a 7-day cooldown in .github/dependabot.yml.
  2. Commit 2 — zizmor workflow & security hardening:
    • Add .github/workflows/zizmor.yml using SHA-pinned zizmorcore/zizmor-action@v0.9.2 with advanced-security: ${{ github.event.pull_request.head.repo.fork != true }} so fork PRs do not fail on SARIF upload (same pattern as jupyter/nbclient#345).
    • Scope permissions to least privilege (permissions: {} at workflow level, contents: read on tests, contents: read + id-token: write on publish).
    • Add persist-credentials: false on both actions/checkout steps (no subsequent git push/write in either job).
    • Guard actions/cache with lookup-only on tag pushes (cache-poisoning).

Verification

  • zizmor 1.33.1 (online & offline): 0 findings.
  • actionlint: 0 errors.
  • Reverse AST diff check against main: zero residual diff outside the declared hardening changes.
  • (Prepared with local scripting and AI assistance; every diff line reviewed and verified locally.)

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