AGENT SKILL

x-run-dynamic-pentest

DAST gate: reads QualityConfig.dast, dispatches OWASP ZAP (passive smoke tier / active full tier) and Nuclei, produces SARIF 2.1.0 + Markdown report, blocks merge on HIGH/CRITICAL findings.

License 许可
MIT
最近更新
2026-10-27
Stars
★ 0
Forks
1

01 前言 Front Matter

name
x-run-dynamic-pentest
model
sonnet
visibility
public
description
DAST gate: reads QualityConfig.dast, dispatches OWASP ZAP (passive smoke tier / active full tier) and Nuclei, produces SARIF 2.1.0 + Markdown report, blocks merge on HIGH/CRITICAL findings.
requires-any
[ "quality.dast.zap-passive", "quality.dast.zap-active", "quality.dast.nuclei" ]
allowed-tools
Read, Write, Edit, Bash, Grep, Glob
argument-hint
<STORY-ID> [--tier smoke|full] [--target local-container|preview-env|staging] [--zap-only] [--nuclei-only]
context-budget
light
user-invocable
true
requires-capabilities
[]

03 SKILL.md 正文

Global Output Policy

  • Language: English ONLY.
  • Tone: Technical, Direct, and Concise.
  • Efficiency: Remove all conversational fillers and greetings to save tokens.

Skill: x-run-dynamic-pentest

Dynamic Application Security Testing (DAST) gate. Reads QualityConfig.dast, selects the appropriate scan tier, and dispatches OWASP ZAP and/or Nuclei against the configured target environment. Produces a SARIF 2.1.0 report + Markdown summary.

Production target is explicitly forbidden. The gate rejects target=production at parse time (enforced by DastConfig constructor — DAST_TARGET_PRODUCTION_FORBIDDEN).

Two tiers:

  • smoke (PR gate) — ZAP passive scan (read-only spider) + Nuclei top-50 lightweight templates. ~10 min.
  • full (nightly) — ZAP active scan (injection payloads: SQLi, XSS, path traversal) + complete Nuclei template set. ~35 min.

Triggers

  • /x-run-dynamic-pentest story-0073-0003 — auto-detects tier from quality.dast.tier-pr (smoke) or CI env (full)
  • /x-run-dynamic-pentest story-0073-0003 --tier smoke — force smoke tier
  • /x-run-dynamic-pentest story-0073-0003 --tier full — force full tier
  • /x-run-dynamic-pentest story-0073-0003 --zap-only — run ZAP only (skip Nuclei)
  • /x-run-dynamic-pentest story-0073-0003 --nuclei-only — run Nuclei only (skip ZAP)

Parameters

Flag Type Default Description
STORY-ID String — Required. Story being gated.
--tier Enum from config Override tier (smoke or full).
--target Enum from config Override target environment. Production rejected.
--zap-only Boolean false Skip Nuclei; run ZAP only.
--nuclei-only Boolean false Skip ZAP; run Nuclei only.
--compliance String from config Override compliance frameworks (comma-separated: pci,lgpd).
--report String auto Output SARIF report path.

Phase 1 — Parse & Validate

<!-- TELEMETRY: phase.start --> Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-run-dynamic-pentest Phase-1-Parse

Read quality.dast from project YAML. Validate:

  1. enabled: true — if false, emit WARN: DAST gate disabled and exit 0.
  2. target != production — enforced by DastConfig constructor; if somehow reached here, exit 2 DAST_TARGET_PRODUCTION_FORBIDDEN.
  3. ZAP binary present when zap.enabled: true: docker pull ghcr.io/zaproxy/zaproxy:stable or local zap.sh.
  4. Nuclei binary present when nuclei.enabled: true: nuclei --version.
  5. templates-version pinned format (vN.x or vN.M.P) — validated by NucleiConfig constructor; exit 2 NUCLEI_VERSION_UNPINNED if reached.

<!-- TELEMETRY: phase.end --> Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-run-dynamic-pentest Phase-1-Parse ok

Phase 2 — Execute Scans

<!-- TELEMETRY: phase.start --> Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-run-dynamic-pentest Phase-2-Scan

ZAP Passive (smoke tier)

docker run --rm ghcr.io/zaproxy/zaproxy:stable \
  zap-baseline.py \
  -t <TARGET_URL> \
  -r /zap/wrk/zap-report.html \
  -x /zap/wrk/zap-report.xml \
  --autooff \
  -I                   # informational only — does not fail on alerts

Convert ZAP XML output to SARIF 2.1.0 via zap2sarif or inline jq transformation.

ZAP Active (full tier)

docker run --rm ghcr.io/zaproxy/zaproxy:stable \
  zap-full-scan.py \
  -t <TARGET_URL> \
  -r /zap/wrk/zap-active-report.html \
  -x /zap/wrk/zap-active-report.xml \
  -z "-config scanner.attackStrength=HIGH" \
  -l HIGH              # fail on HIGH+ findings

Active scan policy applied from zap.active-scan-policy:

  • default — standard OWASP Top 10 payloads
  • custom-pci — PCI-DSS scope (SQLi, XSS, auth bypass emphasis)
  • custom-lgpd — LGPD scope (data exposure, access control)

Nuclei Scan

nuclei \
  -t community-nuclei-templates \
  -u <TARGET_URL> \
  -severity medium,high,critical \
  -json-export /tmp/nuclei-results.json \
  -silent

For smoke tier: -tags top-50 (lightweight template subset, 2-3 min). For full tier: full template set (10+ min).

<!-- TELEMETRY: phase.end --> Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-run-dynamic-pentest Phase-2-Scan ok

Phase 3 — Consolidate & Report

<!-- TELEMETRY: phase.start --> Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-run-dynamic-pentest Phase-3-Report

Merge ZAP + Nuclei SARIF outputs into a single results/security/dast/dast-<tier>-<date>.sarif conformant with SARIF 2.1.0 schema.

Produce Markdown report at ai/epics/epic-XXXX/reports/dast-report-STORY-ID.md using _TEMPLATE-PENTEST-PLAN.md as base structure.

Gate decision:

Tier Blocks on
smoke (PR gate) CRITICAL findings only
full (nightly) HIGH or CRITICAL findings

When blocked: exit 1 DAST_FINDINGS_CRITICAL (smoke) or DAST_FINDINGS_HIGH (full). When compliance flag set (--compliance pci): additional PCI-specific checks applied.

<!-- TELEMETRY: phase.end --> Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-run-dynamic-pentest Phase-3-Report ok

Exit Codes

Exit Code Condition
0 OK No blocking findings (or gate disabled).
1 DAST_FINDINGS_HIGH HIGH/CRITICAL findings above threshold.
2 OPERATIONAL_ERROR Tool missing, target unreachable, or binary absent.
3 DAST_TARGET_PRODUCTION_FORBIDDEN target=production attempted.

Integration Notes

  • Invoked by x-implement-story Phase 3.Q when quality.dast.enabled=true (conditional gate — EPIC-0073, Rule 24).
  • Evidence artifact: ai/epics/epic-XXXX/reports/dast-report-STORY-ID.md (Rule 24 §Mandatory Evidence Artifacts).
  • SARIF output: results/security/dast/dast-{smoke|full}-YYYY-MM-DD.sarif (SARIF 2.1.0).
  • See KP knowledge/security/dast-playbook.md for finding remediation guidance, Nuclei curation policy, and ZAP active scan policy tuning.

04 同仓库更多 Skills

review-bench
review-bench/edercnj_ia-dev-environment

x-parallel-eval

Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan / x-story-plan, applies the parallelism-heuristics knowledge pack (hard / regen / soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

parallelism-heuristics

Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard / regen / soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-watch-pr-ci

Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-validate-docs

Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared/auto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-system-architecture

Incrementally updates docs/architecture/system.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component/integration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-architecture

Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.

★ 0