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}")
关键供应链风险:
未固定到 SHA 的 GitHub Actions(使用 @main 而非提交哈希)
通过 ${{ github.event }} 表达式的脚本注入
GITHUB_TOKEN 权限过于宽松
对仓库有写入权限的第三方 Action
通过公有/私有包名冲突的依赖混淆
示例
# 检查 run 步骤中的脚本注入
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]}")
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: killvxk-cybersecurity-skills-zh-detecting-supply-chain-attac3description: 检测 CI/CD 中的供应链攻击4---56# 检测 CI/CD 中的供应链攻击78## 使用说明910通过解析 GitHub Actions YAML 文件,检查未固定的依赖、脚本注入向量和密钥泄露,扫描 CI/CD 工作流文件中的供应链风险。1112```python13import yaml14from pathlib import Path1516for wf in Path(".github/workflows").glob("*.yml"):17 with open(wf) as f:18 workflow = yaml.safe_load(f)19 for job_name, job in workflow.get("jobs", {}).items():20 for step in job.get("steps", []):21 uses = step.get("uses", "")22 if uses and "@" in uses and not uses.split("@")[1].startswith("sha"):23 print(f"Unpinned action: {uses} in {wf.name}")24```2526关键供应链风险:271. 未固定到 SHA 的 GitHub Actions(使用 @main 而非提交哈希)282. 通过 `${{ github.event }}` 表达式的脚本注入293. GITHUB_TOKEN 权限过于宽松304. 对仓库有写入权限的第三方 Action315. 通过公有/私有包名冲突的依赖混淆3233## 示例3435```python36# 检查 run 步骤中的脚本注入37for step in job.get("steps", []):38 run_cmd = step.get("run", "")39 if "${{" in run_cmd and "github.event" in run_cmd:40 print(f"Script injection risk: {run_cmd[:80]}")41```4243---44> Converted and distributed by [TomeVault](https://tomevault.io/claim/killvxk) — claim your Tome and manage your conversions.45<!-- tomevault:4.0:skill_md:2026-04-16 -->
Run npx skillmds@latest add tomevault-io/killvxk-cybersecurity-skills-zh-detecting-supply-chain-attac in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
检测 CI/CD 中的供应链攻击 It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.