Skip to content

fix: pin 1 unpinned action(s),extract 1 unsafe expression(s) to env vars#402

Open
dagecko wants to merge 1 commit intopypa:unstable/v1from
dagecko:runner-guard/fix-ci-security
Open

fix: pin 1 unpinned action(s),extract 1 unsafe expression(s) to env vars#402
dagecko wants to merge 1 commit intopypa:unstable/v1from
dagecko:runner-guard/fix-ci-security

Conversation

@dagecko
Copy link
Copy Markdown

@dagecko dagecko commented Apr 4, 2026

Summary

This PR hardens your CI/CD workflows against supply chain attacks by pinning a third-party GitHub Action to an immutable commit SHA and extracting a secret from a run: block into an env: mapping.

Why this matters

The build-and-push workflow references re-actors/alls-green@release/v1 on a mutable tag in a pipeline that has packages: write permission to your container registry.

Over the last 5 weeks I've been tracking a nation state actor targeting maintainers of high profile open source projects through social engineering campaigns designed to compromise their accounts. The attack pattern we've seen with tj-actions, Trivy, and Axios all followed the same vector: compromise a maintainer account, force-push malicious code to a mutable tag, and every downstream project silently executes the attacker's code.

If the re-actors/alls-green maintainer account were compromised, the attacker could replace what release/v1 points to. Their modified action would then execute in this workflow with write access to your package registry. Pinning to the commit SHA prevents this because a pinned hash cannot be moved even if the upstream account is compromised.

Fixes applied (in this PR)

Rule Severity File Description
RGS-007 medium build-and-push-docker-image.yml Pinned 1 action to commit SHA
RGS-008 high build-and-push-docker-image.yml Extracted secrets.GITHUB_TOKEN from docker login run block to env mapping

How to verify

Every change is mechanical and preserves workflow behavior:

  • SHA pinning: action@release/v1 becomes action@abc123 # release/v1 - original ref preserved as comment
  • Secret extraction: ${{ secrets.GITHUB_TOKEN }} moves from the run: block to an env: mapping, preventing shell interpretation
  • No workflow logic, triggers, or permissions are modified

I've had 29 merges so far. I created a tool called Runner Guard to assist in my research - it does mechanical, non-AI fixes to reduce hallucinations to zero and produce consistent fixes. If you would like to scan it yourself to validate my work, feel free.

Happy to answer any questions - I'm monitoring comms on every PR.

- Chris Nyhuis (dagecko)

Automated security fixes applied by Runner Guard (https://github.com/Vigilant-LLC/runner-guard).

Changes:
 .github/workflows/build-and-push-docker-image.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
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