Continuous Security Testing: DAST and SAST Integration

Static Application Security Testing (SAST) analyzes source code, while Dynamic Application Security Testing (DAST) tests running applications. Combining both provides comprehensive security coverage.

SAST with Semgrep

# Run Semgrep
semgrep --config auto --json -o results.json .

# GitHub Action
- uses: returntocorp/semgrep-action@v1
  with:
    config: p/default p/security-audit

DAST with OWASP ZAP

# ZAP baseline scan
docker run -t owasp/zap2docker-stable zap-baseline.py \
  -t https://myapp.com -r report.html

# Full scan
docker run -t owasp/zap2docker-stable zap-full-scan.py \
  -t https://myapp.com -r report.html

CI/CD Integration

security-test:
  stage: test
  script:
    - semgrep --config auto --error
    - zap-baseline.py -t $APP_URL

Run SAST on every commit and DAST against staging environments before production deployment.