How do you prevent a compromised GitHub Action from stealing secrets in your pipelines?
IntermediateProductionSupply Chain Security at Scale
Answer
- Pin third-party actions to a full commit SHA (
uses: actions/checkout@<40-char-sha> # v4.2.2) and let Renovate/Dependabot update the pins. - Org setting: allow only GitHub-owned, verified-creator and an explicit allow list.
- Default
permissions: contents: readat workflow level; grant more per job. - Keep secrets out of jobs that run third-party actions where possible; use environments with required reviewers for deploy secrets.
- Prefer OIDC to static secrets so there is less to steal.
The tj-actions/changed-files compromise in March 2025 hit repos using mutable tags; SHA pins were unaffected.
More on Supply Chain Security at Scale
How do you design an end-to-end supply-chain security architecture for 200 services?AdvancedWhat does it take to reach SLSA Build Level 3 in practice?AdvancedHow do you use GitHub artifact attestations for build provenance, and how do consumers verify them?IntermediateWhere and how do you store SBOMs at scale?IntermediateWhat does "sign everything" mean in a mature supply chain?IntermediateHow do you write an admission policy that verifies both the signer identity and an SBOM attestation?Advanced