src/skills/x-run-dynamic-pentest/SKILL.md
DAST gate: ZAP + Nuclei (passive/active); SARIF + Markdown; blocks on HIGH/CRITICAL.
npx skillsauth add edercnj/ia-dev-environment x-run-dynamic-pentestInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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:
/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)| 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. |
Read quality.dast from project YAML. Validate:
enabled: true — if false, emit WARN: DAST gate disabled and exit 0.target != production — enforced by DastConfig constructor; if somehow reached here, exit 2 DAST_TARGET_PRODUCTION_FORBIDDEN.zap.enabled: true: docker pull ghcr.io/zaproxy/zaproxy:stable or local zap.sh.nuclei.enabled: true: nuclei --version.templates-version pinned format (vN.x or vN.M.P) — validated by NucleiConfig constructor; exit 2 NUCLEI_VERSION_UNPINNED if reached.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.
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 payloadscustom-pci — PCI-DSS scope (SQLi, XSS, auth bypass emphasis)custom-lgpd — LGPD scope (data exposure, access control)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).
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 .aikittools/features/feature-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.
| 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. |
x-implement-story Phase 3.Q when quality.dast.enabled=true (conditional gate — Rule 24)..aikittools/features/feature-XXXX/reports/dast-report-STORY-ID.md (Rule 24 §Mandatory Evidence Artifacts).results/security/dast/dast-{smoke|full}-YYYY-MM-DD.sarif (SARIF 2.1.0).knowledge/shared/security-knowledge/dast-playbook/knowledge.md for finding remediation guidance, Nuclei curation policy, and ZAP active scan policy tuning.development
Documentation freshness gate: validates 6 dimensions (readme, api, adr, etc.) per PR.
testing
Conditional dep-policy gate: CVEs, licenses, versions, freshness; SARIF + report.
documentation
Incrementally updates the service or system architecture document; never regenerative.
development
Scans code and git history for leaked credentials, API keys, and tokens; SARIF output.