Skip to content

Security hardening: pin action versions and add permissions#30

Open
wadewilliams wants to merge 1 commit into
masterfrom
claude/audit-github-actions-security-rF22o
Open

Security hardening: pin action versions and add permissions#30
wadewilliams wants to merge 1 commit into
masterfrom
claude/audit-github-actions-security-rF22o

Conversation

@wadewilliams
Copy link
Copy Markdown
Member

Summary

This PR enhances the security posture of the GitHub Actions workflows by pinning all action versions to specific commit SHAs with version tags, adding explicit permission declarations, and introducing automated dependency management via Dependabot.

Key Changes

  • Action Version Pinning: Updated all GitHub Actions to use full commit SHAs instead of version tags:

    • actions/checkout@v4 → pinned to v4.2.2
    • actions/setup-python@v5 → pinned to v5.6.0
    • docker/login-action@v3 → pinned to v3.7.0
    • docker/metadata-action@v5 → pinned to v5.10.0
    • docker/build-push-action@v6 → pinned to v6.19.2
    • softprops/action-gh-release@v2 → pinned to v2.6.2
    • flowcanon/release-builder/pipeline@v3 → pinned to specific commit
    • flowcanon/deploy-action@master → pinned to specific commit
  • Explicit Permissions: Added permissions blocks to workflows:

    • Global read-only permissions in both ci.yml and release.yml
    • Job-level write permissions only where needed (release and publish jobs)
  • Dependency Management: Added .github/dependabot.yml to enable automated updates for:

    • GitHub Actions (weekly schedule)
    • Python dependencies via pip (weekly schedule)
  • Security Hardening: Added step-security/harden-runner@v2.19.1 to the publish job with audit-mode egress policy

  • Dependency Pinning: Pinned Poetry to version 1.8.5 in CI workflows for reproducible builds

Notable Details

All action version pins include comments indicating the version tag for maintainability. Dependabot will help keep these pinned versions up-to-date automatically while maintaining the security benefits of explicit version control.

https://claude.ai/code/session_01CW4Eaqpq5bR2r6mqwVKmHf

Mitigates the class of attack used by tj-actions/changed-files
(CVE-2025-30066) and the Shai-Hulud npm worm family, both of which
exploit mutable action references and over-scoped GITHUB_TOKEN.

- Pin every third-party action to a full commit SHA with a version
  comment. Replaces floating tag refs (@v4, @v5, etc.) and the
  branch ref flowcanon/deploy-action@master, which previously gave
  any push to that branch immediate access to DEPLOY_SSH_KEY,
  GHCR write, and prod host vars.
- Add top-level "permissions: contents: read" to both workflows
  and grant write scopes explicitly per-job (release, build_release,
  build_and_deploy) so GITHUB_TOKEN is least-privilege by default.
- Add step-security/harden-runner in audit mode on the deploy job
  to surface unexpected egress (the tj-actions exfiltration vector).
- Pin poetry to a specific version instead of pulling latest from
  PyPI on every CI run.
- Add Dependabot config for github-actions and pip so pinned SHAs
  stay current via PRs instead of going stale.
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