Files
integraci-dagger-modules/dast-scan/README.md
T

75 lines
2.5 KiB
Markdown

# Dagger module: `dast-scan`
Dynamic Application Security Testing (DAST) — runs against a **deployed**
HTTP target (typically the ephemeral preview environment from a PR
deploy). Distinct from `security-scan` (SAST/SCA: scans source).
## Tools
| Function | Tool | Speed | Intrusiveness | When to run |
|----------------|---------------------|--------|---------------|----------------------------------|
| `zap-baseline` | OWASP ZAP baseline | 1-3min | Passive | Every PR + nightly against prod |
| `zap-full` | OWASP ZAP active | 10-60m | Intrusive | PR preview env only |
| `nuclei` | ProjectDiscovery | 1-5min | Passive | Every PR + nightly against prod |
> **Never run `zap-full` or destructive Nuclei templates against
> production.** Use it only on the ephemeral env that the deploy pipeline
> spins up for the PR. The CI workflow in `.github/workflows/security.yml`
> only runs `zap-baseline` and `nuclei` against the public canary URL.
## Usage
### From CI (GitHub Actions)
The `dast` job in `.github/workflows/security.yml` calls:
```bash
dagger call -m dagger/dast-scan zap-baseline \
--target https://canary.integraci.co \
--auth-header "Bearer $CANARY_TOKEN" \
--fail-on high
```
Findings → SARIF → `github/codeql-action/upload-sarif` → Security tab.
### From IntegraCI golden path pipelines
Add a step to `template.yaml` to run DAST against the per-PR
ephemeral env after the deploy stage completes:
```yaml
- id: dast
name: DAST scan
action: integraci:dagger:exec
input:
module: dast-scan
function: zap-baseline
args:
target: ${{ steps.deploy-preview.output.url }}
auth-header: "Bearer ${{ secrets.PREVIEW_TOKEN }}"
fail-on: high
```
### Locally (dev)
```bash
dagger call -m dagger/dast-scan zap-baseline --target http://localhost:8000
dagger call -m dagger/dast-scan nuclei --target http://localhost:8000 --severity critical,high
```
## Failure thresholds
`fail-on` accepts `info` | `low` | `medium` | `high` | `critical`.
Default is `high` — the run fails when **any** Critical or High
finding is present.
## False positive workflow
1. Triage in the SARIF Security tab.
2. If a finding is a true FP, add the rule ID to:
- ZAP: `--ignore-rules 10038,10054`
- Nuclei: built-in `-exclude-id` flag
3. Document the rationale in `docs/security/dast-suppressions.md`
(referenced by the OPA `golden_standard` policy — every suppression
needs a docs entry or the self-audit fails).