Skip to content

Pin the workflow actions to full commit SHAs - #2467

Open
Totara-thib wants to merge 1 commit into
wger-project:masterfrom
Totara-thib:ci-hardening
Open

Pin the workflow actions to full commit SHAs#2467
Totara-thib wants to merge 1 commit into
wger-project:masterfrom
Totara-thib:ci-hardening

Conversation

@Totara-thib

Copy link
Copy Markdown

Proposed Changes

  • Pin every action reference in the seven workflows to a full commit SHA, with the exact version kept as a comment on each line. One commit, 33 lines changed, no behavior change.

A version tag like docker/login-action@v4 is a movable pointer. Anyone with push access to one of those action repos can retag, and the next run executes the new code. For this repo the exposed path is concrete: docker-base.yml and docker-demo.yml run on a schedule and log into DockerHub with the credentials in secrets, and docker.yml pushes the production images. A moved tag on any of the docker actions runs with those credentials in reach. This is not hypothetical, the tj-actions/changed-files incident (CVE-2025-30066) rewrote existing tags on a widely used action to leak CI secrets.

A commit SHA cannot be moved after the fact. Each pinned line keeps the version as a comment, so every SHA can be cross-checked against the tag on the action's releases page.

Dependabot understands this format and your daily github-actions updates keep working, it bumps the SHA and the comment together, the same flow as the recent setup-python bump (#2438). Nothing changes in how updates arrive.

One heads-up: if the organization ever restricts allowed actions in the repo settings with tag patterns like owner/action@v4, those patterns stop matching SHA refs and workflows fail at startup. The fix is owner/action@* in that setting. Nothing to do if no such restriction is configured.

Related Issue(s)

None.

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features) (not applicable, workflow-only change)
  • Code has been formatted to avoid unnecessary diffs (ruff format && isort .) (not applicable, no Python touched)
  • If the feature is big enough or if there are manual steps needed (deployment changes etc.), write a small writeup in CHANGELOG.md (not applicable, no feature and no deployment change)

Found and fixed by Plumber's analysis, reviewed and submitted by me.

Version tags like docker/login-action@v4 are movable pointers. Anyone
with push access to one of those action repos can retag and the next
scheduled docker-base or docker run executes the new code with the
DockerHub credentials in reach. A commit SHA cannot be moved after the
fact.

Dependabot understands these pins and keeps updating them, bumping the
SHA and the version comment together, so the daily github-actions
updates continue to work as before.
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