D
detecting-supply-chain-attacks-in-ci-cd
About detecting-supply-chain-attacks-in-ci-cd
A security-analysis skill for SOC analysts and security engineers investigating supply-chain risks in CI/CD. It focuses on reviewing GitHub Actions workflows for unsafe dependencies, injection paths, and excessive permissions.
Key features
- 01Parse GitHub Actions YAML
- 02Find unpinned actions
- 03Detect expression-based script injection
- 04Review token permissions and secrets
Use cases
- 01Investigating a CI/CD supply-chain incident
- 02Creating threat-hunting rules
- 03Checking monitoring coverage for workflow risks
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill detecting-supply-chain-attacks-in-ci-cdAfter installing, type/detecting-supply-chain-attacks-in-ci-cdin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
LICENSEreferences/api-reference.mdscripts/agent.pyDetails
From the project READMEDetecting Supply Chain Attacks in CI/CD
When to Use
- When investigating security incidents that require detecting supply chain attacks in ci cd
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
Scan CI/CD workflow files for supply chain risks by parsing GitHub Actions YAML, checking for unpinned dependencies, script injection vectors, and secrets exposure.
import yaml
from pathlib import Path
for wf in Path(".github/workflows").glob("*.yml"):
with open(wf) as f:
workflow = yaml.safe_load(f)
for job_name, job in workflow.get("jobs", {}).items():
for step in job.get("steps", []):
uses = step.get("uses", "")
if uses and "@" in uses and not uses.split("@")[1].startswith("sha"):
print(f"Unpinned action: {uses} in {wf.name}")
Key supply chain risks:
- Unpinned GitHub Actions (using @main instead of SHA)
- Script injection via ${{ github.event }} expressions
- Overly permissive GITHUB_TOKEN permissions
- Third-party actions with write access to repo
- Dependency confusion via public/private package name collision
Examples
# Check for script injection in run steps
for step in job.get("steps", []):
run_cmd = step.get("run", "")
if "${{" in run_cmd and "github.event" in run_cmd:
print(f"Script injection risk: {run_cmd[:80]}")
Comments
Markdown supported