/ 目錄 / 演練場 / claude-code-owasp
● 社群 agamm ⚡ 即開即用

claude-code-owasp

作者 agamm · agamm/claude-code-owasp

將 OWASP 最佳實踐內建於 Claude Code — Top 10:2025、ASVS 5.0、代理式 AI 安全性,以及 20 多種語言特定的安全注意事項。

Claude Code OWASP Skill 讓 Claude 像資安審查員一樣思考。它載入了 OWASP Top 10:2025 指引、ASVS 5.0 驗證標準、全新的代理式 AI 安全指引,以及 20 多個語言特定章節(JS/TS、Python、Rust、Go、Java、Ruby 等)。適合用於提交前審查、PR 審查以及威脅建模。

為什麼要用

核心特性

即時演示

實際使用效果

claude-code-owasp-skill.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "claude-code-owasp-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/agamm/claude-code-owasp",
        "~/.claude/skills/claude-code-owasp"
      ],
      "_inferred": true
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "claude-code-owasp-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/agamm/claude-code-owasp",
        "~/.claude/skills/claude-code-owasp"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "claude-code-owasp-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/agamm/claude-code-owasp",
        "~/.claude/skills/claude-code-owasp"
      ],
      "_inferred": true
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "claude-code-owasp-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/agamm/claude-code-owasp",
        "~/.claude/skills/claude-code-owasp"
      ],
      "_inferred": true
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "claude-code-owasp-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/agamm/claude-code-owasp",
        "~/.claude/skills/claude-code-owasp"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "claude-code-owasp-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/agamm/claude-code-owasp",
          "~/.claude/skills/claude-code-owasp"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add claude-code-owasp-skill -- git clone https://github.com/agamm/claude-code-owasp ~/.claude/skills/claude-code-owasp

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: claude-code-owasp

如何以 OWASP Top 10 為基準對 PR 進行資安審查

👤 在請求他人審查前先進行自我審查的開發者 ⏱ ~20 min intermediate

何時使用: 在對涉及驗證、資料或輸入處理的 PR 點擊「準備審查」之前。

前置條件
  • Skill installed — git clone https://github.com/agamm/claude-code-owasp ~/.claude/skills/claude-code-owasp
步驟
  1. 指向差異內容
    Review the current PR against OWASP Top 10:2025. Focus on auth and input handling.✓ 已複製
    → 問題對應至 Top 10 分類並附上行號參照
  2. 排定優先順序
    Group findings into 'must-fix before merge' vs 'follow-up issue'. Cite the specific ASVS requirement.✓ 已複製
    → 附有 ASVS ID 的排序清單
  3. 產生修正方案
    For each must-fix, propose the minimal diff.✓ 已複製
    → 對應各問題的修補差異

結果: 一個在合併前已解決已知資安問題、且具備可追溯需求的 PR。

注意事項
  • 對無害模式過度警示 — 請 Claude 具體說明攻擊路徑;若無法說明,則降低嚴重性等級

對新功能執行輕量級威脅建模

👤 設計涉及使用者資料功能的工程師 ⏱ ~40 min advanced

何時使用: 設計階段,撰寫程式碼之前,此時影響範圍仍有調整空間。

步驟
  1. 描述功能
    Feature: share-by-link for customer reports. Users generate tokenized URLs valid 7 days. Threat-model with OWASP agentic AI guidance included.✓ 已複製
    → STRIDE 風格的威脅清單
  2. 選擇控制措施
    For each threat, what's the cheapest control that mitigates 80%?✓ 已複製
    → 每項威脅對應的控制措施,以及昂貴方案的棄用理由

結果: 一份可附加到設計文件的威脅建模文件。

注意事項
  • 控制措施清單過度設計 — 明確限制在依可能性 × 影響度排名的前 5 大威脅

強化 AI 代理整合以防範提示注入

👤 正在開發 Claude/LLM 驅動功能的工程師 ⏱ ~30 min advanced

何時使用: 當你即將讓 LLM 存取使用者資料或呼叫工具時。

步驟
  1. 描述代理介面
    Our agent reads support emails and can call 3 tools: refund(), tag_account(), escalate(). Review for agentic AI risks.✓ 已複製
    → 提示注入向量、工具濫用風險、資料外洩路徑
  2. 設計防護措施
    Propose a minimal guardrail set: which tools need human confirm, which inputs need sanitization, what logging is required.✓ 已複製
    → 具體的防護規格

結果: 一個附有已記錄防護措施的強化代理設計。

注意事項
  • 僅依賴基於提示的防禦措施 — 結合確定性控制 — 破壞性工具需人工確認,URL 使用允許清單

稽核語言特定的安全注意事項

👤 審查自己不熟悉語言的程式碼的審查者 ⏱ ~15 min intermediate

何時使用: 當你以 TS 背景審查 Python 程式碼,或反之亦然時。

步驟
  1. 限定語言範圍
    Review this Python module for Python-specific OWASP quirks (pickle, yaml.load, shell=True, etc.).✓ 已複製
    → 超出通用 Top 10 的語言特定問題

結果: 捕捉到語言無關審查會遺漏的問題。

組合

與其他 MCP 搭配,撬動十倍槓桿

claude-code-owasp-skill + claude-code-skill-factory-skill

Skill Factory 將 OWASP 檢查作為 PreToolUse 鉤子進行自動把關

Use skill-factory /build hook to run OWASP review on every Write tool call in our repo.✓ 已複製
claude-code-owasp-skill + seo-audit-skill

在安全性標頭方面有重疊

Run seo-audit security category, then deeper OWASP review on the hits.✓ 已複製
claude-code-owasp-skill + robotics-agent-skill

保護 ROS 網路(rosbridge、Zenoh)

Robotics skill produced a rosbridge websocket — run OWASP review on it.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
Top 10:2025 review diff or files PR 自我審查 Claude tokens
ASVS requirement check feature spec 合規作業 Claude tokens
Agentic AI threat model agent design 發布 LLM 功能時 Claude tokens
Language-specific audit language, files 跨語言審查 Claude tokens
Threat model (STRIDE) feature description 設計階段 Claude tokens

成本與限制

運行它的成本

API 配額
None
每次呼叫 Token 數
依程式碼大小,每次審查約 5-20k
費用
Free
提示
將審查範圍限定在變更的檔案,而非整個專案。

安全

權限、密鑰、影響範圍

憑證儲存: 不需要憑證
資料出站: 程式碼會傳送至 Claude 進行推論

故障排查

常見錯誤與修復

Claude ignores OWASP context and gives generic advice

明確指定指引名稱:'Apply OWASP Top 10:2025 category A03:2025 Injection here.'

Too many false positives

在接受問題前,要求提供攻擊情境的完整說明

替代方案

claude-code-owasp 對比其他方案

替代方案何時用它替代權衡
Semgrep / Snyk當你需要在 CI 中執行確定性靜態分析時各有不同強項;建議兩者並用

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills