Communitygithub.com

セキュリティスキャン

AgentShield を使用して、Claude Code の構成(.claude/ ディレクトリ)のセキュリティ脆弱性、設定ミス、インジェクションリスクをスキャンします。CLAUDE.md、settings.json、MCP サーバー、フック、エージェント定義をチェックします。.claude/ ディレクトリ(CLAUDE.md、settings.json、MCP サーバー、フック、エージェント定義)を監査する際に使用します。

セキュリティスキャン とは?

このスキルは、Claude Code プロジェクトのセキュリティ構成を監査するために設計されています。[AgentShield](https://github.com/affaan-m/agentshield) を使用して、.claude/ ディレクトリ内の CLAUDE.md、settings.json、mcp.json、フック、エージェント定義などのファイルをスキャンし、ハードコードされたシークレット、プロンプトインジェクションパターン、過度に寛容な許可リスト、危険なバイパスフラグ、コマンドインジェクション、データ流出などの脆弱性を検出します。 このスキルは、新しいプロジェクトのセットアップ時や構成変更後、コミット前、既存リポジトリへのオンボーディング時など、さまざまな場面で役立ちます。基本的なスキャンに加え、AI を活用した Opus 4.6 ディープ分析(レッドチーム/ブルーチーム/監査人の3エージェントパイプライン)、自動修正機能、JSON/Markdown/HTML 形式でのレポート出力、GitHub Actions との統合をサポートしています。また、安全な構成をゼロからスキャフォールディングする `init` コマンドも提供します。 スキルは、A(90-100)から F(0-39)までのグレードで結果を評価し、重大度レベル(Critical、High、Medium、Info)ごとに具体的な調査結果とその意味を説明します。これにより、開発者は迅速に優先順位を付けて修正できます。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/security-scan

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

セキュリティスキャンスキル

AgentShield を使用して、Claude Code の構成のセキュリティ問題を監査します。

アクティブ化するタイミング

  • 新しい Claude Code プロジェクトをセットアップするとき
  • .claude/settings.json、CLAUDE.md、または MCP 設定を変更した後
  • 構成の変更をコミットする前
  • 既存の Claude Code 設定がある新しいリポジトリにオンボーディングするとき
  • 定期的なセキュリティ衛生チェック

スキャン対象

ファイルチェック項目
CLAUDE.mdハードコードされたシークレット、自動実行命令、プロンプトインジェクションパターン
settings.json過度に寛容な許可リスト、欠落している拒否リスト、危険なバイパスフラグ
mcp.jsonリスクのある MCP サーバー、ハードコードされた環境シークレット、npx サプライチェーンリスク
hooks/補間によるコマンドインジェクション、データ流出、サイレントエラー抑制
agents/*.md制限なしのツールアクセス、プロンプトインジェクション面、欠落しているモデル仕様

前提条件

AgentShield がインストールされている必要があります。必要に応じて確認し、インストールします。

# インストールされているか確認
npx ecc-agentshield --version

# グローバルにインストール(推奨)
npm install -g ecc-agentshield

# または npx 経由で直接実行(インストール不要)
npx ecc-agentshield scan .

使用方法

基本スキャン

現在のプロジェクトの .claude/ ディレクトリに対して実行します。

# 現在のプロジェクトをスキャン
npx ecc-agentshield scan

# 特定のパスをスキャン
npx ecc-agentshield scan --path /path/to/.claude

# 最小重大度フィルターでスキャン
npx ecc-agentshield scan --min-severity medium

出力形式

# ターミナル出力(デフォルト)— 色付きレポートとグレード
npx ecc-agentshield scan

# JSON — CI/CD 統合用
npx ecc-agentshield scan --format json

# Markdown — ドキュメント用
npx ecc-agentshield scan --format markdown

# HTML — 自己完結型ダークテーマレポート
npx ecc-agentshield scan --format html > security-report.html

自動修正

安全な修正を自動的に適用します(自動修正可能とマークされた修正のみ)。

npx ecc-agentshield scan --fix

これにより以下が行われます。

  • ハードコードされたシークレットを環境変数参照に置き換え
  • ワイルドカード権限をスコープ付きの代替案に制限
  • 手動のみの提案は決して変更しません

Opus 4.6 ディープ分析

より深い分析のために、敵対的な3エージェントパイプラインを実行します。

# ANTHROPIC_API_KEY が必要
export ANTHROPIC_API_KEY=your-key
npx ecc-agentshield scan --opus --stream

これにより以下が実行されます。

  1. 攻撃者(レッドチーム) — 攻撃ベクトルを発見
  2. 防御者(ブルーチーム) — 堅牢化を推奨
  3. 監査人(最終評決) — 両方の視点を統合

安全な構成の初期化

安全な .claude/ 構成をゼロからスキャフォールディングします。

npx ecc-agentshield init

作成されるもの:

  • スコープ付き権限と拒否リストを含む settings.json
  • セキュリティのベストプラクティスを含む CLAUDE.md
  • mcp.json プレースホルダー

GitHub Action

CI パイプラインに追加します。

- uses: affaan-m/agentshield@v1
  with:
    path: '.'
    min-severity: 'medium'
    fail-on-findings: true

重大度レベル

グレードスコア意味
A90-100安全な構成
B75-89軽微な問題
C60-74注意が必要
D40-59重大なリスク
F0-39クリティカルな脆弱性

結果の解釈

クリティカルな発見(すぐに修正)

  • 構成ファイル内のハードコードされた API キーまたはトークン
  • 許可リスト内の Bash(*)(無制限のシェルアクセス)
  • ${file} 補間によるフック内のコマンドインジェクション
  • シェルを実行する MCP サーバー

高重要度の発見(本番環境の前に修正)

  • CLAUDE.md 内の自動実行命令(プロンプトインジェクションベクター)
  • 権限内の拒否リストの欠落
  • 不要な Bash アクセス権限を持つエージェント

中重要度の発見(推奨)

  • フック内のサイレントエラー抑制(2>/dev/null、|| true)
  • PreToolUse セキュリティフックの欠落
  • MCP サーバー設定内の npx -y 自動インストール

情報レベルの発見(認識用)

  • MCP サーバーの説明の欠落
  • 禁止命令が適切にベストプラクティスとしてフラグされているか

リンク

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

関連スキル