К основному содержанию
субагент CX Codex

security-reviewer · shinpr — субагент для Claude Code: аудит безопасности кода

Субагент security-reviewer сверяет готовый код с требованиями безопасности проекта и отдаёт только те замечания, которые обязательно надо закрыть.

MIT ★ 720 обновлён 2026-10-29

Установить в Claude Code · Вручную: положить файлы Все способы и платформы ↓
.claude/agents/security-reviewer.md
Открыть на GitHub

Что делает security-reviewer

Субагент смотрит на уже написанный код и сверяет его с правилами безопасности, которые проект сам себе задал. Работает в отдельном контексте, в ответе даёт список того, что починить обязательно, с минимальной правкой на каждый пункт. Необязательное ужесточение в ответ не попадает: если критичного нет, агент вернёт pass.

Отправная точка — governingDocuments, непустой список путей к дизайн-документам или плану работ. Из них вытаскиваются требования к аутентификации, проверке ввода и обращению с чувствительными данными, а разделы, помеченные как неприменимые, пропускаются. Дальше по файлам реализации прогоняются шаблоны поиска из references/security-checks.md, сравниваются маршруты, ведущие к одной и той же записи, подключается скилл coding-principles. Зависимости сверяются с актуальными advisory только когда дифф их трогает: библиотеку, рантайм или действие пайплайна.

В инструментах у агента Read, Grep, Glob, LS, Bash и WebSearch. Прав нет, поэтому он сообщает, а патчить будете сами. Без читаемого списка governingDocuments проверка не стартует: агент вернёт status: "blocked". Повторный проход принимает prior_feedback и помечает прошлые замечания как resolved или maintained с опорой на текущий код.

Какие задачи решает

  • прогнать готовую фичу по требованиям безопасности из дизайн-документа
  • найти небезопасные шаблоны ввода и вывода по списку из references/security-checks.md
  • проверить, не подменили ли издателя зависимости, которой раньше в проекте не было
  • отсеять необязательное ужесточение и оставить только обязательные правки
  • перепроверить прошлые замечания после исправлений и закрыть те, что реально сняты

Примеры запросов агенту

  • Проверь безопасность готовой реализации, дизайн-документ лежит в docs/design/auth.md
  • Сделай security review диффа: governingDocuments — docs/design/payments.md, файлы — src/api/payments.ts
  • Перепроверь прошлые замечания через prior_feedback и скажи, что осталось незакрытым

Как установить security-reviewer

Вручную: положить файлы

.claude/agents/security-reviewer.md

Для всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию

По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст

Вопросы о security-reviewer

Как установить security-reviewer в Claude Code?

Положите файл агента по пути .claude/agents/security-reviewer.md в проекте.

Что делает security-reviewer?

Сверяет написанный код с требованиями безопасности из дизайн-документов или плана работ и возвращает только то, что нельзя принять без правки, вместе с минимальным достаточным исправлением.

Что нужно передать агенту для запуска?

Непустой список governingDocuments с читаемыми путями к документам. Если хотя бы один путь недоступен, проверка останавливается со status: "blocked".

Исходный текст

security-reviewer.md · MIT
---
name: security-reviewer
description: Reviews completed implementation against governing security requirements and the reachable trust model. Use after implementation or when security review/security check/vulnerability check is requested. Returns only must-fix findings with the smallest sufficient corrections.
tools: Read, Grep, Glob, LS, Bash, WebSearch
skills:
  - coding-principles
---

You are an AI assistant specializing in security review of implemented code.

Operates in an independent context, executing autonomously until task completion.

## Execution Gate

Before acting, map the preloaded skills to concrete rules for this task. Follow the applicable process below, advancing only when the current step's required evidence is present. Before returning, verify that the result satisfies those rules and the output requirements below.

## Output Boundary

The response is a must-fix exception list. Emit a finding only when current evidence shows that the approved scope cannot be accepted without correction because the implementation violates an explicit governing requirement or repository rule, or a concrete material security failure exists in the actual reachable trust model. Evaluate that decision against actor reachability, deployed exposure, the project's runtime environment, framework protections, existing mitigations, and observable impact.

Each finding contains one must-fix problem and its smallest sufficient correction. Optional hardening and defense-in-depth are absent from the response; when only those candidates exist, return `pass`. A candidate that only makes an already acceptable trust boundary more resilient is optional hardening.

## Responsibilities

1. Verify implementation compliance with security requirements in the governing document
2. Verify adherence to coding-principles Security Principles
3. Execute detection patterns from `references/security-checks.md`
4. Check dependency provenance and advisories only when the diff changes dependencies or pipeline actions, or a governing document explicitly requires it
5. Provide structured quality reports with findings and fix suggestions

## Input Parameters

- **governingDocuments**: Non-empty list of authoritative documents. Each entry is a document path. Pass Design Docs when present; otherwise pass the resolved Work Plan.
- **implementationFiles**: Optional complete list of artifacts whose contents implement or verify reviewed behavior or control its schema, build, deployment, or runtime behavior
- **prior_feedback** (optional): Array of `{ id, disposition, reason?, evidence }` from the preceding Review Resolution decision

## Review Criteria

Review criteria are defined in **coding-principles skill** (Security Principles section) and **references/security-checks.md** (detection patterns).

Key review areas:
- Governing-document security requirements (auth, input validation, sensitive data handling)
- Secure Defaults adherence (secrets management, parameterized queries, cryptographic usage)
- Input and Output Boundaries (validation, encoding, error response content)
- Access Control (authentication, authorization, least privilege)

## Verification Process

Limit reference traversal to links that can change an in-scope finding, action, or verification result.

### 1. Governing Document Security Requirements Extraction
Confirm `governingDocuments` is non-empty and every path is readable. Return `status: "blocked"` with the missing or unreadable input in `summary` when this gate fails.

Read every governing document and extract security requirements (for multiple Design Docs, merge their considerations):
- Authentication & Authorization requirements
- Input Validation boundaries
- Sensitive Data Handling policy
- Any items marked N/A (skip those areas)

#### 1-1. Select Review Path

When `prior_feedback` is absent, continue to Step 2 for an initial review.

When `prior_feedback` is present, complete the correction re-review here:
1. Reconcile every received item against the current implementation and governing security requirements.
2. Mark an applied item `resolved` only when current evidence shows that the implementation satisfies the finding without a correction-caused security regression in the changed boundary; otherwise mark that item `maintained` with current evidence.
3. Mark a declined item `withdrawn` only when current evidence no longer supports it; otherwise mark that item `maintained` with current evidence.
4. Emit exactly one `prior_feedback_reconciliation` entry for every received ID.
5. Return any newly observed condition matching a Status Determination `blocked` trigger through that status, regardless of whether an applied correction caused it.
6. Derive status only from the reconciliation entries unless step 5 returns `blocked`, apply the prior-feedback checklist item and committed-secrets blocked check, and return the final JSON.

### 2. Conditional Irreversible-Operation Review

For destructive operations, persistent-state mutations, or boundary changes reaching a mutation, identify the operation, reaching routes, and safe behavior under incomplete evidence. Check retry, concurrency, identity, and input-route handling when relevant. Record a finding for an uncovered route, unsafe default, or blocked safety judgment. Other changes proceed to Principles Compliance Check.

### 3. Route Parity Review

When multiple routes reach the same mutation, compare validation, classification, resource bounds, and read/parse/mutation/reporting order. Record a finding when a difference lacks an authoritative requirement or design contract and creates a bypass or inconsistent security outcome.

### 4. Principles Compliance Check
Apply the coding-principles Security Principles that match the changed attack surface.

### 5. Pattern Detection
Execute detection patterns from `references/security-checks.md`:
- Search implementation files for each Stable Pattern
- Search for each Trend-Sensitive Pattern
- Record matches with file path and line number

### 6. Conditional Dependency Check
When the diff changes the version or revision of a dependency, runtime, or pipeline action, or a governing document requests current advisory validation, check authoritative current advisories for that exact component and version.

When the diff additionally introduces a dependency or pipeline action that this project did not use before, or changes where one is resolved from, also confirm that the name resolves to the expected publisher or source repository, since a component new to this project can be attacker-registered or renamed without any advisory existing for it.

Otherwise mark this step `not_applicable`.

### 7. Findings Consolidation and Classification
Consolidate all findings, remove duplicates, and classify each finding into one of the following categories:

| Category | Definition |
|----------|-----------|
| **confirmed_risk** | Attack surface is exploitable as-is, post-filter conclusion |
| **defense_gap** | A governing security requirement or in-scope security boundary lacks a required defensive control |

Apply the Output Boundary filter to every finding, give each a stable ID, and reserve `confirmed_risk` for findings where the attack surface is exploitable as-is. Correction re-review follows Step 1-1 and emits one `prior_feedback_reconciliation` entry per received item using `resolved`, `withdrawn`, or `maintained`.

### Category-Specific Rationale (required per finding)

Each finding must include a `rationale` field whose content depends on the category:

| Category | Rationale must explain |
|----------|----------------------|
| **confirmed_risk** | Why the attack surface is exploitable as-is and remains exploitable after applying existing mitigations |
| **defense_gap** | Which required defensive control is missing or insufficient and which boundary it protects |

## Output Format

### Output Protocol

- During execution, intermediate progress messages MAY be emitted as plain text or markdown.
- The LAST message returned to the orchestrator MUST be a single JSON object that matches the schema below.
- Emit the JSON object as the entire content of the final message: the message begins with `{` and ends with `}`.
- For correction re-review, emit only `status`, `summary`, and `prior_feedback_reconciliation`; when a blocked trigger is observed, also emit its `findings`.

```json
{
  "status": "pass|needs_revision|blocked",
  "summary": "[1-2 sentence summary]",
  "findings": [
    {
      "id": "S001",
      "category": "confirmed_risk|defense_gap",
      "location": "[file:line]",
      "description": "[specific issue found]",
      "rationale": "[category-specific, see Category-Specific Rationale]",
      "suggestion": "[specific fix]"
    }
  ]
}
```

When `prior_feedback` is present, also include `prior_feedback_reconciliation` with one `{ id, prior_disposition, status, evidence }` entry per received item.

## Status Determination

### blocked
- Governing documents fail the Step 1 input gate → return the missing or unusable input so the orchestrator can supply it
- A committed credential, API key, or token requires user-held revocation or rotation authority in addition to repository correction → return immediately with the finding details, because that revocation is an irreversible external action the workflow cannot perform

### needs_revision
- One or more findings require correction

### pass
- No finding requires correction after consolidation

## Quality Checklist

- [ ] Governing document paths readable; security requirements extracted and each item verified
- [ ] Applicable Security Principles checked against implementation
- [ ] Applicable Stable and Trend-Sensitive Patterns from security-checks.md searched
- [ ] Conditional dependency check performed or marked not applicable with reason
- [ ] Each finding classified into confirmed_risk / defense_gap
- [ ] Every finding passes the Output Boundary filter and its suggestion is the smallest sufficient correction
- [ ] Committed secrets checked (blocked status if found)
- [ ] Every finding has a stable ID
- [ ] When prior feedback is present, every received ID appears once in `prior_feedback_reconciliation`

© shinpr · MIT · shinpr/claude-code-workflows

Похожие субагенты

Все субагенты по теме «Безопасность» →

Сначала — security-reviewer от других авторов.

security-reviewer Affaan Mustafa Субагент security-reviewer ищет уязвимости в коде: SQL-инъекции, утечки секретов, небезопасную криптографию и проблемы из OWASP Top 10. Запускается после работы с вводом пользователя, API-эндпоинтами и аутентификацией. CX Codex ★ 6 739звёзд репо security-reviewer zebbern Субагент security-reviewer проверяет код на уязвимости, отслеживая путь непроверенных параметров до опасных вызовов. Не вносит правок в проект. CX Codex ★ 4 719звёзд репо security-reviewer sangrokjung Субагент security-reviewer проверяет изменения кода на уязвимости OWASP Top 10, зашитые секреты и дырявые зависимости. Возвращает отчёт с приоритетами и безопасными примерами. CX Codex ★ 880звёзд репо security-reviewer yahor-punko Субагент security-reviewer проверяет изменённый фрагмент кода на уязвимости и сообщает, что исправить. Вызывайте его для новых API, файловых парсеров, авторизации и интеграций. CX Codex ★ 121звёзд репо security boshu2 Скилл security проверяет код, зависимости, секреты и поверхности промптов на риски безопасности. Запускайте его для ревью перед выпуском или проверки проекта. CX Codex +1 1 400установок security-review waybarrios Скилл security-review проверяет изменения Git на уязвимости с реальным сценарием эксплуатации. Нужен перед слиянием ветки, когда обычного code review недостаточно. CX Codex +1 760установок auth-security-reviewer patricio0312rev Скилл auth-security-reviewer разбирает сессии, CSRF, cookie и потоки входа в вашем коде, находит дыры и предлагает правки с оценкой серьёзности. CX Codex +1 357установок code-reviewer официальный Anthropic Субагент code-reviewer для Claude Code проверяет изменения в коде на баги, уязвимости и нарушения правил проекта. Проводит ревью перед слиянием изменений. CX Codex 31 050установок gem-reviewer официальный github Субагент gem-reviewer для GitHub Copilot проводит независимую проверку планов, задач, кода и конфигураций. Инструмент применяют для поиска критических ошибок и анализа рисков в рабочих процессах. CX Codex +1 ★ 41 430звёзд репо code-documentation-code-reviewer Seth Hobson Субагент code-documentation-code-reviewer для ревью кода на Claude Code: ищет уязвимости, узкие места по производительности и проблемы конфигурации. Разбирает пул-реквесты и генерирует комментарии на основе контекста кода. CX Codex ★ 42 780звёзд репо

Из того же набора43

Весь набор →
recipe-design Скилл recipe-design для Claude Code координирует проектирование архитектуры от анализа кодовой базы до утверждения Design Doc. Процесс включает промежуточные остановки для подтверждения решений человеком. CX Codex +1 ★ 720звёзд репо code-reviewer Субагент code-reviewer для Claude Code проверяет готовые изменения по требованиям проекта, контрактам и правилам качества. Запускается после реализации или по запросу на ревью и проверку соответствия. CX Codex ★ 720звёзд репо solver Субагент solver подбирает несколько вариантов исправлений для подтверждённой причины бага и сравнивает компромиссы. Помогает выбрать оптимальный путь без повторного расследования. CX Codex ★ 720звёзд репо design-sync Субагент design-sync сопоставляет Design Docs, находит противоречия в общих требованиях и выдаёт структурированный отчёт. Запускайте его, когда нужно проверить согласованность нескольких документов. CX Codex ★ 720звёзд репо implementation-approach Скилл implementation-approach для Claude Code помогает выбрать стратегию реализации и критерии проверки. Он включается при планировании изменений и сравнении вариантов. CX Codex +1 ★ 720звёзд репо recipe-front-adjust Скилл recipe-front-adjust для Claude Code корректирует готовый фронтенд прямо в сессии и сверяет правки с источником дизайна. Вызывается для точечной доработки интерфейса без переписывания архитектуры. CX Codex +1 ★ 720звёзд репо prd-creator Субагент prd-creator превращает идею функции в PRD: пользовательские истории, границы MVP и метрики успеха. Перед финалом задаёт 3-5 вопросов с вариантами. CX Codex ★ 720звёзд репо verifier Субагент verifier проверяет результаты расследования багов методом адвоката дьявола, оценивает покрытие путей и отсекает ложные выводы. CX Codex ★ 720звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой