kube-owasp-zap

by simplyzee

Helm chartv0.2.1App 2.17.0Apache-2.0Verified publisher

Run OWASP ZAP security scans (baseline, full or API) against your own web apps as Kubernetes Jobs or scheduled CronJobs

About this chart

kube-owasp-zap

Runs OWASP ZAP security scans against your web apps from inside Kubernetes, as a one-off Job or on a schedule. It uses ZAP's official packaged scans and saves HTML, JSON and Markdown reports.

Only scan sites you own or have written permission to test. A full scan sends real attack traffic.

Install

helm repo add simplyzee https://charts.simplyzee.dev
helm repo update

helm install zap simplyzee/kube-owasp-zap \
  --namespace zap --create-namespace \
  --set scan.target=https://staging.example.com

Follow the scan:

kubectl logs -n zap -f job/zap-kube-owasp-zap-1

Run it again any time with helm upgrade zap simplyzee/kube-owasp-zap -n zap --reuse-values. Each upgrade creates a fresh Job, and finished Jobs are cleaned up after 7 days.

Scan types

scan.typeWhat it doesWhere to use it
baseline (default)Spiders the site and reports what it can see passively. No attacks.Anywhere, including production
fullSpiders, then runs active attacks (SQL injection, XSS and more)Test and staging environments
apiScans an API from its OpenAPI, SOAP or GraphQL definition. Set scan.target to the definition URL and scan.apiFormatAPIs you own

Scheduled scans

Set a cron schedule to scan regularly. The chart then creates a CronJob instead of a Job:

helm install zap simplyzee/kube-owasp-zap -n zap \
  --set scan.target=https://staging.example.com \
  --set schedule="0 2 * * 1" \
  --set cronJob.timeZone=Europe/London \
  --set report.persistence.enabled=true

Trigger a run straight away with kubectl create job -n zap --from=cronjob/zap-kube-owasp-zap zap-manual-$(date +%s).

Results

  • The pod log has ZAP's summary and, by default, the full Markdown report.
  • Job status tells you the outcome at a glance. The Job fails when ZAP finds FAIL alerts, so you can alert on failed Jobs. Set scan.failOnWarnings=true to fail on WARN alerts too.
  • Report files (zap-<timestamp>.html, .json, .md, .xml) are written to /zap/wrk. Enable report.persistence to keep them in a PersistentVolumeClaim. The claim is kept if you uninstall.

Tuning rules

By default every alert is a WARN. Use scan.rulesConfig to promote rules to FAIL or ignore noise. Generate a starting file with:

docker run --rm -v "$PWD:/zap/wrk" zaproxy/zap-stable zap-baseline.py -t https://staging.example.com -g rules.conf

Then pass it in with --set-file scan.rulesConfig=rules.conf.

Parameters

ParameterDescriptionDefault
scan.targetURL to scan (required). For api, the definition URL or GraphQL endpoint""
scan.typebaseline, full or apibaseline
scan.apiFormatopenapi, soap or graphql (api scans)openapi
scan.spiderMinutesMinutes to spider (baseline and full)1
scan.ajaxSpiderAlso run the Ajax spider for JavaScript-heavy appsfalse
scan.includeAlphaInclude alpha scan rulesfalse
scan.failOnWarningsFail the Job on WARN alerts as well as FAILfalse
scan.maxMinutesMax minutes for ZAP to start and finish passive scanning (0 = ZAP default)0
scan.debugZAP debug outputfalse
scan.rulesConfigRule config (tab-separated id, IGNORE/INFO/WARN/FAIL, name)""
scan.zapOptionsExtra ZAP options passed with -z""
scan.extraArgsAny other scan-script arguments[]
report.formatsAny of html, json, md, xml[html, json, md]
report.printToLogPrint the Markdown report to the logtrue
report.persistence.enabledKeep reports in a PVCfalse
report.persistence.existingClaimUse your own PVC""
report.persistence.size, .storageClass, .accessModesPVC settings1Gi, "", [ReadWriteOnce]
scheduleCron schedule; empty runs a single Job""
cronJob.timeZoneTime zone for the schedule""
cronJob.concurrencyPolicyAllow, Forbid or ReplaceForbid
cronJob.successfulJobsHistoryLimit, .failedJobsHistoryLimitFinished scans to keep3, 3
cronJob.suspendPause the schedulefalse
job.backoffLimitRetries on failure0
job.activeDeadlineSecondsStop scans that run longer than this3600
job.ttlSecondsAfterFinishedDelete finished Jobs after this many seconds (null keeps them)604800
image.repository, .tag, .pullPolicyZAP image; empty tag uses appVersionzaproxy/zap-stable, "" (2.17.0), IfNotPresent
imagePullSecretsPull secrets for private registries[]
automountServiceAccountTokenThe scanner doesn't need the Kubernetes APIfalse
podSecurityContext, securityContextRuns as non-root UID 1000, no privilege escalation, all capabilities droppedsee values.yaml
resourcesCPU and memoryrequests 250m/1Gi, limit 2Gi memory
podAnnotations, podLabelsExtra pod metadata{}
nodeSelector, tolerations, affinitySchedulingkubernetes.io/os: linux, [], {}

Upgrading from 0.1.x

  • The old zap-cli tool has been replaced by ZAP's packaged scans. zap-cli isn't included in current ZAP images, so 0.1.x can't run with them.
  • zapcli.targetHost, zapcli.image.* and zapcli.debug.enabled still work. zapcli.scanTypes, zapcli.spider and zapcli.recursive have no direct equivalent; use scan.type and scan.spiderMinutes instead.
  • No release-name trick needed. You no longer need a timestamp in the release name: install once and re-run with helm upgrade.
  • The bundled hofcicd-regcred pull secret has been removed.

Deploy kube-owasp-zap with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kube-owasp-zap on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkube-owasp-zap is pinned at v0.2.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply