How do you secure a GitHub Actions workflow that uses many third-party actions?
IntermediateScenarioPipeline Security Scanning
Answer
Situation read → A compromised action runs with your secrets. Tag references like @v3 can be moved by the owner or an attacker.
What I'd do →
- Pin third-party actions to a full commit SHA with a comment for the version:
uses: actions/checkout@<40-char-sha> # v4. - Set least-privilege
permissions:at the workflow top, for examplecontents: read. - Allow only approved actions in org settings.
- Use Dependabot or Renovate to bump the SHAs.
- Use OIDC to cloud instead of long-lived keys.
Why → A SHA is immutable, a tag is not.
Interview tip → Cite the tj-actions/changed-files incident of March 2025 as a real example.
More on Pipeline Security Scanning
You are asked to add security to an existing CI pipeline. Where do SAST, SCA, secrets scanning and DAST each go?BeginnerGitleaks flags an AWS access key in a pull request. The developer says it is a test key. What do you do?BeginnerDevelopers fear security scans will slow the pipeline from 6 to 20 minutes. How do you roll them out?BeginnerA SAST tool reports 2,000 findings on a legacy repo the first time you run it. How do you introduce it without freezing delivery?IntermediateA developer insists a scanner finding is a false positive. What is your process?BeginnerSCA flags a critical CVE in a transitive dependency and no patched version exists. What are your options?Intermediate