CI/CD & GitHub Actions (50 Qs)•Part 2: Advanced Workflows, Security & Containerization (Mid-Level)
How do you protect CI pipelines against Supply-Chain Attacks?
mid LevelPipesSecurity & AuthDocker & Containers
In Simple Words:
Third-party actions can be compromised or hijacked (e.g. tag mutation of @v1).
Security Hardening Measures:
- Commit SHA Pinning: Reference actions by immutable Git commit SHA instead of mutable tags (
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1). - Dependabot for Actions: Automatically create PRs to update pinned SHAs when upstream releases new versions.
- Audit Code with StepSecurity: Restrict outbound network egress on runners to prevent compromised actions from exfiltrating environment variables.
- CodeQL & Static Security Analysis: Automated SAST scans to catch insecure code patterns before merging.