Skip to content

ci: harden GitHub Actions workflows - #55

Merged
guillaume-sainthillier merged 3 commits into
mainfrom
ci/harden-github-actions
Oct 2, 2026
Merged

guillaume-sainthillier merged 3 commits into
mainfrom
ci/harden-github-actions

Conversation

@guillaume-sainthillier

Copy link
Copy Markdown
Member

GitHub Actions hardening from a workflow audit across the SILARHI / personal repositories. One commit per change:

  • ci: restrict the default GITHUB_TOKEN to read-only: Workflows without a permissions: block now get contents: read; jobs that push, comment or publish keep their explicit job-level grants. The repository default token is also read-only now, and Actions can no longer approve pull requests (already applied in the repo settings).
  • ci: detect changed image paths with git diff instead of tj-actions: tj-actions/changed-files (compromised in March 2025, CVE-2025-30066) is replaced by a plain git diff HEAD^1 HEAD against the PR merge commit.
  • ci: bound job run times and cancel superseded pull request runs: Every job gets a timeout-minutes sized from observed run times (CI 5-15 min, image builds 30-90 min, deploys 20 min) instead of the 6-hour default, and pull request workflows cancel the previous run of the same PR (push runs are never cancelled).

Declare `permissions: contents: read` at the workflow level so jobs that
don't need more get a read-only token. Jobs that push, comment or publish
keep their explicit job-level grants.

The repository default is now read-only too, with Actions no longer allowed
to approve pull requests.
tj-actions/changed-files was compromised in March 2025 (CVE-2025-30066)
and runs on same-repo Renovate PRs, where the Docker Hub token is
available. A plain `git diff` against the merge commit's base parent does
the same job without a third-party action.
Every job now has a timeout-minutes sized from observed run times (CI
jobs 5-15 min, image builds 30-90 min, deploys 20 min) instead of the
6-hour default. Pull request workflows cancel the previous run of the same
PR when a new commit is pushed; runs on push are never cancelled.
@guillaume-sainthillier
guillaume-sainthillier merged commit 5b12952 into main Oct 2, 2026
25 checks passed
@guillaume-sainthillier
guillaume-sainthillier deleted the ci/harden-github-actions branch October 2, 2026 08:31
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