skills/devops-pipeline-security-gates/SKILL.md
CI/CD Pipeline 安全閘門設計指南。提供 SAST/DAST/SCA/Container Scan/Secret Detection 的掃描工具選擇、Gate 位置策略、閾值設定與漏洞分類標準。適用於「安全閘門」、「SAST」、「DAST」、「SCA」、「Container 掃描」、「Secret 偵測」、「漏洞閾值」等 Pipeline 安全整合任務。強化 security-scanner 的設計能力。注意:實際掃描執行與漏洞修復不在此技能範圍內。
npx skillsauth add vincent119/ai-rules-kit devops-pipeline-security-gatesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
security-scanner 在設計 Pipeline 安全時使用的掃描工具選擇、Gate 位置與閾值設定參考。
devops-cicd-pipeline 技能使用| 類型 | 全名 | 掃描目標 | 執行時機 | 成本 | |------|------|---------|---------|------| | SAST | Static Application Security Testing | 原始碼 | Commit/PR | 低 | | SCA | Software Composition Analysis | 依賴套件/函式庫 | Build 前 | 低 | | Secret | Secret Detection | 程式碼中的敏感資料 | Commit/PR | 低 | | Container | Container Image Scanning | Docker 映像 | Build 後 | 中 | | DAST | Dynamic Application Security Testing | 執行中的應用程式 | Staging | 高 | | IaC | Infrastructure as Code Scanning | Terraform/K8s | PR | 低 | | License | License Compliance | 開源授權 | Build | 低 |
| 工具 | 語言支援 | 開源 | 特點 | |------|---------|------|------| | Semgrep | 20+ 語言 | 是 | 自訂規則容易、速度快 | | CodeQL | 10+ 語言 | 是(GitHub) | GitHub 原生、深度分析 | | SonarQube | 25+ 語言 | 部分 | 品質 + 安全整合 | | Bandit | 僅 Python | 是 | Python 專用 | | ESLint Security | 僅 JS/TS | 是 | ESLint Plugin |
| 工具 | 特點 | |------|------| | Dependabot | GitHub 原生、自動 PR | | Snyk | 最大漏洞資料庫、自動修復建議 | | OWASP Dependency-Check | OWASP 官方、開源 | | Trivy | Container + SCA 整合 | | npm audit / pip-audit | 語言原生工具 |
| 工具 | 特點 | |------|------| | Gitleaks | 完整 Git 歷史掃描、速度快 | | TruffleHog | Entropy + Pattern 雙重偵測 | | detect-secrets | Yelp 開發、支援 pre-commit hook | | GitHub Secret Scanning | GitHub 原生、Partner Pattern |
| 工具 | 特點 | |------|------| | Trivy | 最全面、OS + App 套件 | | Grype | Anchore 開源、速度快 | | Docker Scout | Docker 官方 | | Snyk Container | 含修復指引 |
| 工具 | 目標 | |------|------| | tfsec | Terraform | | Checkov | Terraform、K8s、CloudFormation | | KICS | 多 IaC 支援 | | kubescape | 僅 Kubernetes |
[1. Pre-Commit]
├── Secret Detection(Gitleaks pre-commit hook)
└── Lint Security Rules
[2. PR / Commit]
├── SAST(Semgrep / CodeQL)
├── SCA(Dependabot / Snyk)
├── Secret Detection(完整掃描)
├── License Check
└── IaC Scan(若適用)
[3. Build]
├── Container Image Scan(Trivy)
└── SBOM 產生(Software Bill of Materials)
[4. Staging]
├── DAST(選用)
└── 整合安全測試
[5. Production 部署]
└── 最終審核 Gate(安全報告審查)
| 掃描類型 | Critical | High | Medium | Low | |---------|----------|------|--------|-----| | SAST | Block | Block | Warn | Ignore | | SCA(CVE) | Block | Block | Warn | Ignore | | Secret | Block | Block | Block | Warn | | Container | Block | Warn | Ignore | Ignore | | IaC | Block | Warn | Ignore | Ignore | | License(GPL) | Block | Warn | Ignore | Ignore |
| 等級 | CVSS 分數 | 修復 SLA | Gate 行動 | |------|---------|---------|---------| | Critical | 9.0~10.0 | 24 小時內 | Block 部署 | | High | 7.0~8.9 | 7 天內 | Block 部署 | | Medium | 4.0~6.9 | 30 天內 | Warn,允許部署 | | Low | 0.1~3.9 | 90 天內 | Ignore |
- name: Semgrep SAST
uses: semgrep/semgrep-action@v1
with:
config: >-
p/security-audit
p/owasp-top-ten
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
- name: Trivy Container Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.IMAGE_TAG }}
format: sarif
exit-code: 1
severity: CRITICAL,HIGH
- name: Gitleaks Secret Detection
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
建議在 Build 階段產生 SBOM,記錄所有依賴套件:
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
image: ${{ env.IMAGE_TAG }}
format: spdx-json
output-file: sbom.spdx.json
tools
基於 SLA/SLO 量化評估事故影響的計算模型與業務影響矩陣。適用於「SLA 影響」、「SLO 違反」、「影響評估」、「營收損失估算」、「Error Budget」、「可用性計算」、「事故成本評估」等量化事故業務影響的任務。強化 impact-assessor 的評估能力。注意:事故原因分析與改善規劃不在此技能範圍內。
research
根因分析(RCA)方法論詳細指南。提供 5 Whys、Fishbone 圖、Fault Tree Analysis、變更分析等結構化 RCA 技術,以及認知偏誤防範清單。適用於「根因分析」、「RCA」、「5 Whys」、「魚骨圖」、「Fault Tree」、「原因分析方法論」、「變更分析」等事故原因分析任務。強化 root-cause-investigator 的分析能力。注意:時間軸重建與改善規劃不在此技能範圍內。
testing
事故事後分析(Postmortem)完整流程。協調 7 個執行階段:資訊收集 → 時間軸重建 → 根因分析 → 影響評估 → 改善規劃 → 報告審查 → 整合報告,最終產出完整的 Postmortem 報告。適用於「寫事故報告」、「post-incident 分析」、「RCA 報告」、「事故時間軸整理」、「建立改善措施」等請求。注意:即時 Incident Response(on-call)、監控系統設定、告警配置不在此技能範圍內。
content-media
投影片版面模式庫。提供 20 種投影片類型的最佳版面配置、格線系統、色彩與字型設計 Token。適用於「投影片版面」、「Slide Layout」、「設計系統」、「格線」、「字型」、「色彩規範」等投影片視覺設計任務。強化 visual-designer 的設計能力。注意:PPT/Keynote 檔案直接輸出不在此技能範圍內。