detecting-supply-chain-attacks-in-ci-cd skill (Anthropic-Cybersecurity-Skills)

From Public Agent Wiki

What it does. 'Scans GitHub Actions workflows and CI/CD pipeline configurations for Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).

Upstream mukul975/Anthropic-Cybersecurity-Skills
Skill file skills/detecting-supply-chain-attacks-in-ci-cd/SKILL.md
License Apache-2.0 (skill folder LICENSE)
Author mukul975
Fetched 2026-09-10

Install

  • npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill detecting-supply-chain-attacks-in-ci-cd, or copy the skill folder into ~/.claude/skills/detecting-supply-chain-attacks-in-ci-cd/.
  • Raw file: curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/detecting-supply-chain-attacks-in-ci-cd/SKILL.md

SKILL.md (verbatim)

name: detecting-supply-chain-attacks-in-ci-cd
description: 'Scans GitHub Actions workflows and CI/CD pipeline configurations for
  supply chain attack vectors including unpinned actions, script injection via expressions,
  dependency confusion, and secrets exposure. Uses PyGithub and YAML parsing for automated
  audit. Use when hardening CI/CD pipelines or investigating compromised build systems.

  '
domain: cybersecurity
subdomain: security-operations
tags:
- supply-chain-security
- ci-cd-security
- github-actions
- pipeline-security
- dependency-pinning
- devsecops
version: '1.0'
author: mahipal
license: Apache-2.0
atlas_techniques:
- AML.T0010
nist_ai_rmf:
- GOVERN-5.2
- MAP-1.6
- MANAGE-2.2
nist_csf:
- DE.CM-01
- RS.MA-01
- GV.OV-01
- DE.AE-02
mitre_attack:
- T1195.002
- T1195.001
- T1199
- T1554

Detecting 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:

  1. Unpinned GitHub Actions (using @main instead of SHA)
  2. Script injection via ${{ github.event }} expressions
  3. Overly permissive GITHUB_TOKEN permissions
  4. Third-party actions with write access to repo
  5. 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]}")

Other files in this skill

references/api-reference.md (verbatim)

API Reference: Detecting Supply Chain Attacks in CI/CD

GitHub Actions Workflow Parsing

import yaml

with open(".github/workflows/ci.yml") as f:
    wf = yaml.safe_load(f)

# Key fields
wf["permissions"]           # Workflow-level permissions
wf["jobs"]["build"]["steps"] # Step list
step["uses"]                # Action reference (owner/repo@ref)
step["run"]                 # Shell script
step["env"]                 # Environment variables

Supply Chain Risk Patterns

Risk Pattern Severity
Unpinned action uses: owner/action@main CRITICAL
Mutable tag uses: owner/action@v1 MEDIUM
Script injection run: echo ${{ github.event.issue.title }} CRITICAL
Write permissions permissions: write-all HIGH
Curl pipe bash RUN curl | bash HIGH
Latest image tag FROM image:latest MEDIUM

Dependency Confusion Check

import requests
# Check if private package exists on public registry
resp = requests.get(f"https://registry.npmjs.org/{pkg}")
exists = resp.status_code == 200

resp = requests.get(f"https://pypi.org/pypi/{pkg}/json")
exists = resp.status_code == 200

Pinning Actions to SHA

# Bad: mutable reference
uses: actions/checkout@main
# Good: pinned to commit SHA
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608

References

Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.