Community研究與資料分析github.com

MV1-him/agent-audit-kit

掃描 AI 代理以發現安全與政策風險,透過 180 項檢查確保更安全的部署。

agent-audit-kit 是什麼?

Agent Audit Kit 是一個專為 AI 代理設計的安全與合規掃描工具,提供超過 180 項內建檢查,涵蓋常見的安全漏洞、政策違規與配置問題。它支援多種主流代理平台(如 Claude Code、Cursor、Codex 等),可透過 CLI 或 API 快速整合至 CI/CD 流程。主要功能包括靜態分析代理配置、掃描權限模型、偵測敏感資訊洩露,以及驗證自訂政策規則。該工具能產生結構化報告,協助開發者在部署前識別與修復風險,從而降低 AI 代理在生產環境中的安全隱憂。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add MV1-him/agent-audit-kit

Installed? Explore more 研究與資料分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

概述

針對 AI 代理進行安全與政策風險掃描,提供 180 項檢查,確保更安全的部署。

功能特色

  • 180+ 安全檢查:涵蓋 OWASP 十大風險、CWE 常見弱點以及自訂政策規則。
  • 多平台支援:可用於 Claude Code、Cursor、Codex 等主流 AI 代理。
  • 靜態分析:解析代理配置、提示詞模板與相依元件。
  • 敏感資訊偵測:檢查 API 金鑰、token 及其他機密資料是否意外洩露。
  • 權限審計:驗證代理的權限模型是否符合最小權限原則。
  • 自訂政策:允許使用者定義組織專屬的安全規則。
  • 結構化報告:輸出 JSON/HTML 報告,便於整合 CI/CD 流程。

安裝

npm install -g agent-audit-kit
# 或使用 npx
npx agent-audit-kit scan

使用方法

CLI

# 掃描目前目錄下的代理配置
audit-agent scan ./agent-config.yaml

# 指定輸出格式
audit-agent scan --format json --output report.json

# 執行特定檢查類別
audit-agent scan --checks security,policy,secrets

API

const { AuditKit } = require('agent-audit-kit');

const kit = new AuditKit();
const results = await kit.scan('./agent-config.yaml');
console.log(results.summary);

CI/CD 整合

GitHub Actions

name: Agent Security Audit
on: [push]
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Agent Audit
        run: npx agent-audit-kit scan --fail-on critical

配置

可以在專案根目錄建立 .auditrc.yaml 或 .auditrc.json:

# .auditrc.yaml
checks:
  - security
  - policy
  - secrets
severity:
  min: medium
output:
  format: json
  path: ./reports/
policies:
  custom:
    - id: "no-admin-role"
      description: "禁止管理員角色"
      rule: "roles[*].name != 'admin'"

環境變數

變數說明預設值
AUDIT_LOG_LEVEL日誌層級info
AUDIT_CONFIG_PATH自訂配置路徑./.auditrc.yaml
AUDIT_CI_MODECI 模式啟用false

輸出範例

{
  "summary": {
    "total_checks": 180,
    "passed": 170,
    "failed": 10,
    "errors": 0
  },
  "results": [
    {
      "id": "SEC-001",
      "severity": "high",
      "title": "API 金鑰洩露",
      "description": "在代理配置中發現內嵌的 API 金鑰。",
      "file": "./agent-config.yaml",
      "line": 12,
      "remediation": "使用環境變數或機密管理服務。"
    }
  ]
}

常見問題

如何跳過某些檢查?

使用 --skip 參數:

audit-agent scan --skip SEC-002,POL-003

支援哪些代理平台?

目前已驗證支援 Claude Code、Cursor、Codex、LangChain 及 AutoGPT 等平台。

報告如何解讀?

報告中的每個結果包含嚴重程度(critical、high、medium、low)、問題描述與建議修復方式。建議優先處理 critical 與 high 層級的問題。

授權

MIT License

貢獻

歡迎提交 Issue 或 Pull Request。請先閱讀 CONTRIBUTING.md。

相關技能