Skip to content

Security Testing

Security testing finds ways the system can be abused before an attacker does. It is layered, and each layer sees a different class of flaw.

source ──► SAST ──►┐
deps ──► SCA ──►├──► CI gate ──► build ──► DAST / pen test
git ──► secrets ►┘ (running app)
SAST: code you wrote SCA: code you imported DAST: behaviour when running

The goal is not a clean scanner report — it is a threat model: who attacks this, what they gain, and which control stops them (OWASP Top 10 is a useful starting map).

Use it for

  • Every commit: SAST and secret scanning are cheap and catch mistakes early
  • Every dependency change: SCA flags known CVEs in your supply chain
  • Before release: DAST against a running staging environment
  • Anything touching auth, payments, PII or file uploads: threat-model it explicitly

Avoid or reduce it when

  • You treat a scanner as proof of safety — it only finds known patterns
  • You run an expensive full DAST scan on every push instead of a fast subset
  • You gate on raw finding counts without triaging real exploitability
  • You scan a build artifact that is not what you actually ship
Tool Ecosystem Notes
Semgrep Multi Fast SAST, custom rules as YAML
CodeQL Multi Deep semantic analysis, free for OSS on GitHub
Snyk Multi SCA plus SAST and container scanning
Trivy Containers / IaC / SCA One binary, scans images, filesystems and config
OWASP ZAP Web DAST Open source, scriptable, CI-friendly
Burp Suite Web DAST Industry-standard proxy and scanner
Gitleaks Secrets Detects secrets in git history and code
Dependabot GitHub Automated dependency update PRs
Terminal window
# SAST with Semgrep
docker run --rm -v "$PWD:/src" returntocorp/semgrep \
semgrep scan --config=auto /src
# DAST with OWASP ZAP baseline scan
docker run --rm -t ghcr.io/zaproxy/zaproxy:stable \
zap-baseline.py -t https://staging.example.com
# Secrets with Gitleaks
docker run --rm -v "$PWD:/repo" zricethezav/gitleaks:latest \
detect --source=/repo --verbose
# .github/workflows/security.yml (excerpt)
- name: Scan container image
run: |
trivy image --exit-code 1 --severity HIGH,CRITICAL ghcr.io/acme/api:ci
- name: Secret scan
run: gitleaks detect --redact --exit-code 1
  • Layer the scanners. SAST, SCA, secrets and DAST catch different things; no single tool is sufficient.
  • Gate on severity, triage the rest. Fail the build on exploitable HIGH/CRITICAL, review the rest instead of ignoring everything or blocking on noise.
  • Scan the artifact you ship. A clean source tree does not mean a clean container.
  • Keep secrets out of git. Run a secret scanner in CI and rotate anything that leaks — history is forever.
  • Automate dependency patching. Dependabot or Renovate beats quarterly panic updates.
  • Threat-model, do not just scan. A scanner cannot reason about business logic flaws such as broken access control.

Self-assessment quiz

Pick one answer per question, then press Check answers.

  1. Which technique analyses source code you wrote without running it?
  2. What does SCA (Software Composition Analysis) find?
  3. Which tool scans git history for committed credentials?
  4. A scanner reports zero findings. What can you conclude?
  5. Which is a DAST tool?