security-scan

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

9 stars

Best use case

security-scan is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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

Teams using security-scan should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/security-scan/SKILL.md --create-dirs "https://raw.githubusercontent.com/j7-dev/everything-github-copilot/main/docs/ja-JP/skills/security-scan/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/security-scan/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How security-scan Compares

Feature / Agentsecurity-scanStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Security Scan Skill

[AgentShield](https://github.com/affaan-m/agentshield) を使用して、Copilot CLI の設定のセキュリティ問題を監査します。

## 起動タイミング

- 新しい Copilot CLI プロジェクトのセットアップ時
- `.copilot/settings.json`、`CLAUDE.md`、または MCP 設定の変更後
- 設定変更をコミットする前
- 既存の Copilot CLI 設定を持つ新しいリポジトリにオンボーディングする際
- 定期的なセキュリティ衛生チェック

## スキャン対象

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

## 前提条件

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

```bash
# インストール済みか確認
npx ecc-agentshield --version

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

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

## 使用方法

### 基本スキャン

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

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

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

# 最小深刻度フィルタでスキャン
npx ecc-agentshield scan --min-severity medium
```

### 出力フォーマット

```bash
# ターミナル出力(デフォルト) — グレード付きのカラーレポート
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
```

### 自動修正

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

```bash
npx ecc-agentshield scan --fix
```

これにより以下が実行されます:
- ハードコードされたシークレットを環境変数参照に置き換え
- ワイルドカード権限をスコープ付き代替に厳格化
- 手動のみの提案は変更しない

### Opus 4.6 ディープ分析

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

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

これにより以下が実行されます:
1. **攻撃者(レッドチーム)** — 攻撃ベクトルを発見
2. **防御者(ブルーチーム)** — 強化を推奨
3. **監査人(最終判定)** — 両方の観点を統合

### 安全な設定の初期化

新しい安全な `.copilot/` 設定をゼロから構築します:

```bash
npx ecc-agentshield init
```

作成されるもの:
- スコープ付き権限と拒否リストを持つ `settings.json`
- セキュリティベストプラクティスを含む `CLAUDE.md`
- `mcp.json` プレースホルダー

### GitHub Action

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

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

## 深刻度レベル

| グレード | スコア | 意味 |
|-------|-------|---------|
| A | 90-100 | 安全な設定 |
| B | 75-89 | 軽微な問題 |
| C | 60-74 | 注意が必要 |
| D | 40-59 | 重大なリスク |
| F | 0-39 | クリティカルな脆弱性 |

## 結果の解釈

### クリティカルな発見(即座に修正)
- 設定ファイル内のハードコードされた API キーまたはトークン
- 許可リスト内の `Bash(*)`(無制限のシェルアクセス)
- `${file}` 補間によるフック内のコマンドインジェクション
- シェルを実行する MCP サーバー

### 高い発見(本番前に修正)
- CLAUDE.md 内の自動実行命令(プロンプトインジェクションベクトル)
- 権限内の欠落した拒否リスト
- 不要な Bash アクセスを持つエージェント

### 中程度の発見(推奨)
- フック内のサイレントエラー抑制(`2>/dev/null`、`|| true`)
- 欠落した PreToolUse セキュリティフック
- MCP サーバー設定内の `npx -y` 自動インストール

### 情報の発見(認識)
- MCP サーバーの欠落した説明
- 正しくフラグ付けされた禁止命令(グッドプラクティス)

## リンク

- **GitHub**: [github.com/affaan-m/agentshield](https://github.com/affaan-m/agentshield)
- **npm**: [npmjs.com/package/ecc-agentshield](https://www.npmjs.com/package/ecc-agentshield)

Related Skills

springboot-security

9
from j7-dev/everything-github-copilot

Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.

django-security

9
from j7-dev/everything-github-copilot

Django security best practices, authentication, authorization, CSRF protection, SQL injection prevention, XSS prevention, and secure deployment configurations.

wpds

9
from j7-dev/everything-github-copilot

Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc.

wp-wpcli-and-ops

9
from j7-dev/everything-github-copilot

Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml.

wp-rest-api

9
from j7-dev/everything-github-copilot

Use when building, extending, or debugging WordPress REST API endpoints/routes: register_rest_route, WP_REST_Controller/controller classes, schema/argument validation, permission_callback/authentication, response shaping, register_rest_field/register_meta, or exposing CPTs/taxonomies via show_in_rest.

wp-project-triage

9
from j7-dev/everything-github-copilot

Use when you need a deterministic inspection of a WordPress repository (plugin/theme/block theme/WP core/Gutenberg/full site) including tooling/tests/version hints, and a structured JSON report to guide workflows and guardrails.

wp-plugin-development

9
from j7-dev/everything-github-copilot

Use when developing WordPress plugins: architecture and hooks, activation/deactivation/uninstall, admin UI and Settings API, data storage, cron/tasks, security (nonces/capabilities/sanitization/escaping), and release packaging.

wp-playground

9
from j7-dev/everything-github-copilot

Use for WordPress Playground workflows: fast disposable WP instances in the browser or locally via @wp-playground/cli (server, run-blueprint, build-snapshot), auto-mounting plugins/themes, switching WP/PHP versions, blueprints, and debugging (Xdebug).

wp-phpstan

9
from j7-dev/everything-github-copilot

Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins/themes/sites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes.

wp-performance

9
from j7-dev/everything-github-copilot

Use when investigating or improving WordPress performance (backend-only agent): profiling and measurement (WP-CLI profile/doctor, Server-Timing, Query Monitor via REST headers), database/query optimization, autoloaded options, object caching, cron, HTTP API calls, and safe verification.

wp-interactivity-api

9
from j7-dev/everything-github-copilot

Use when building or debugging WordPress Interactivity API features (data-wp-* directives, @wordpress/interactivity store/state/actions, block viewScriptModule integration, wp_interactivity_*()) including performance, hydration, and directive behavior.

wp-block-themes

9
from j7-dev/everything-github-copilot

Use when developing WordPress block themes: theme.json (global settings/styles), templates and template parts, patterns, style variations, and Site Editor troubleshooting (style hierarchy, overrides, caching).