Skip to content

ci: add Zizmor - #5234

Merged
apoelstra merged 7 commits into
rust-bitcoin:masterfrom
storopoli:zizmor
Nov 6, 2025
Merged

ci: add Zizmor#5234
apoelstra merged 7 commits into
rust-bitcoin:masterfrom
storopoli:zizmor

Conversation

@storopoli

Copy link
Copy Markdown
Contributor

This PR integrates zizmor
for automated GitHub Actions security analysis and implements several
workflow security improvements.

zizmor Integration

New workflows that runs zizmor:

  • Added .github/workflows/cron-zizmor.yml:
    • Currently configured to run daily at midnight UTC
    • Results are uploaded to the repository's Security tab in SARIF format
  • Added .github/workflows/zizmor.yml that runs zizmor on every PR that fails CI if zizmor fails.

These are the suggested ways to integrate zizmor to a repository using GitHub Actions in the documentation.

CI Security Hardening

All workflows were updated with zizmor's security best practices:

  • Action pinning: All GitHub Actions are now pinned to specific commit hashes instead of tags that provide mmutability and protection against supply chain attacks

    • Example: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 instead of @v5
  • Permissions: Added explicit permissions blocks to all workflows

    • Implements least-privilege principle
    • Each job only requests the minimum permissions needed
  • Credential persistence: Set persist-credentials: false on all actions/checkout steps

    • Prevents accidental credential leaks
    • Reduces attack surface

Dangerous Triggers Whitelist

zizmor flagged the use of pull_request_target and workflow_run
in as dangerous trigger patterns. Hence, I've added # zizmor: ignore[dangerous-triggers] annotations to whitelist these patterns.

Dependabot Enhancements

  • Cooldown feature: Added cooldown.default-days: 5 to .github/dependabot.yml.

    • Enables a "cooldown" period for automated dependabot updates, which restricts dependencies to be updated only if they are more than 5 days old.
    • Good for supply chain attacks/vulnerabilities.
  • Tagged hash support: Dependabot can work correctly with pinned action versions (commit hashes) and will update them accordingly by pinning a new hash (and changing the commented version accordingly as well).

Closes #5209.

@apoelstra

Copy link
Copy Markdown
Member
  • Cooldown feature: Added cooldown.default-days: 5 to .github/dependabot.yml.

I'm kinda bikeshedding here but can you change this from 5 to 60? We basically never want to update except that old versions eventually get deleted and then our CI breaks. So we might as well drag our feet for a couple months, which should shake out even accidental security vulns.

@storopoli

storopoli commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author
  • Cooldown feature: Added cooldown.default-days: 5 to .github/dependabot.yml.

I'm kinda bikeshedding here but can you change this from 5 to 60? We basically never want to update except that old versions eventually get deleted and then our CI breaks. So we might as well drag our feet for a couple months, which should shake out even accidental security vulns.

Makes total sense.
I think I might revisit 5 days at Alpen's repo and in my personal projects as well...

Ok, moved from 5 to 60 in 73e866e

EDIT: and rebased (because it is always good to rebase)

tcharding
tcharding previously approved these changes Nov 3, 2025

@tcharding tcharding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK 25ae73c


jobs:
zizmor:
name: zizmor latest via PyPI

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this mean that zimor only gives github actions attack protection until the project on PyPI gets pwned?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tcharding

Copy link
Copy Markdown
Member

Do we really want to run this on every PR?

@storopoli

storopoli commented Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

Do we really want to run this on every PR?

I can do a custom trigger only if the PR touches the .github/ folder...

EDIT: just saw this #5237

@storopoli

Copy link
Copy Markdown
Contributor Author

Do we really want to run this on every PR?

I can do a custom trigger only if the PR touches the .github/ folder...

EDIT: just saw this #5237

Done in d8c8da4

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK 25ae73c; successfully ran local tests

tcharding
tcharding previously approved these changes Nov 3, 2025

@tcharding tcharding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK d8c8da4

@tcharding

Copy link
Copy Markdown
Member

Cool! I didn't realize it was so easy to gate jobs on paths.

apoelstra
apoelstra previously approved these changes Nov 3, 2025

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK d8c8da4; successfully ran local tests

@storopoli
storopoli dismissed stale reviews from apoelstra and tcharding via a198114 November 3, 2025 23:19
@storopoli

Copy link
Copy Markdown
Contributor Author

rebased

@storopoli

Copy link
Copy Markdown
Contributor Author

f*** annoying rebase sorry about the spam...

@tcharding tcharding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK 275c262

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK 275c262; successfully ran local tests

@apoelstra
apoelstra merged commit fe5c504 into rust-bitcoin:master Nov 6, 2025
27 checks passed
@storopoli
storopoli deleted the zizmor branch November 6, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: Harden GitHub Actions with Zizmor

3 participants