critical severitysecurity

    GitHub Actions Unpinned Tag Supply-Chain Risk (Rule S2) — Pin to 40-Char SHA

    Security Fail (S2): Workflow references third-party actions via mutable tags (@v4 / @main) instead of immutable commit SHAs.

    Direct-Answer Fix Summary

    58% of audited open-source AI repositories leave GitHub Actions on floating version tags. Because Git tags can be silently force-pushed if an upstream action is compromised, every third-party uses: line should be pinned to a full 40-character commit SHA with a human-readable version comment (# v4), paired with minimal top-level permissions: contents: read.

    Broken vs. Fixed Configuration

    Vulnerable: Floating tags + default broad token permissions
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
          - uses: 0xmariowu/AgentLint@v1
    Hardened: Immutable 40-char SHAs + least-privilege permissions
    permissions:
      contents: read
    
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
          - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
          - uses: 0xmariowu/AgentLint@6cf433c4092ee10a3162c2f4ddd68ff13b5d4aff # v1

    Why This Happens

    Starter templates default to actions/checkout@v4 for brevity. When AI coding agents open PRs automatically, compromised third-party actions execute with full CI runner network and secret access.

    Step-by-Step Fix

    1. 01
      Paste your workflow into the AgentLint SHA Pinner

      Automatically resolve 46+ popular actions offline or query the live GitHub API for any custom action.

    2. 02
      Keep version comments next to each 40-char SHA

      Append # v4 so Dependabot or Renovate can still propose safe SHA bumps automatically.

    3. 03
      Add minimal top-level permissions and avoid pull_request_target

      Declare permissions: contents: read (Rule S5) and avoid checking out untrusted fork code under pull_request_target (Rule S8).

    Automated AgentLint Checks That Catch This

    Frequently Asked Questions

    Will Dependabot still update my GitHub Actions if I pin to a commit SHA?

    Yes. Both Dependabot and Renovate recognize trailing # v4 version comments and open automated PRs updating both the SHA and comment.

    Should local ./ actions also be pinned to a SHA?

    No — local workspace actions are already locked to the repository commit being tested.

    Related Troubleshooting Guides