The two services
zap is on a network with no route out. In Compose that is the dast
network, declared internal: true; in Kubernetes it is a NetworkPolicy that
allows the pod no egress but the gateway. It cannot reach your database, your
cache, the API, the internet or your cloud provider’s metadata address. A scan
engine parses hostile pages for a living, so it is given nothing to reach.
dast-egress is the only door. It forwards the engine’s requests to one
host and port at a time, the one the current scan is for, and refuses private,
loopback, link-local and metadata addresses when each connection is made. When
a scan’s time limit passes it stops forwarding and resets the engine, even if
the worker has died.
Resources
The engine uses about 1 GB of memory at rest and is limited to 2 GB and 2 CPUs. The gateway is limited to 256 MB. Both run read-only, with all capabilities dropped and no privilege escalation. The engine keeps its working data in memory (atmpfs in Compose, a memory-backed emptyDir in Kubernetes), so
nothing from a scan survives a restart of the container.
There is one engine and it runs one scan at a time. Other dynamic scans
wait for it. Do not scale zap or dast-egress beyond one replica: the
gateway’s single lease is what stops two organizations’ scans sharing the
engine’s session.
Settings
The worker authenticates to the gateway with a credential both derive from
TOKEN_ENCRYPTION_KEY, so there is no separate secret to create. The gateway
uses that key for nothing else: it opens no database and decrypts nothing.
Scanning applications on your own network
By default a target on a private address is refused, in the API and again at the gateway. To scan internal applications from a self-hosted deployment, setDAST_ALLOW_PRIVATE_TARGETS=true on the api, the worker and
dast-egress. Link-local addresses, which include 169.254.169.254, stay
refused.
On Kubernetes the gateway’s NetworkPolicy also denies private ranges. Add an
egress rule for the addresses you want reachable in your overlay; the variable
opens the application’s check, not the network policy.
Turning it off
SetDAST_GATEWAY_URL=off on the api and the worker and remove the two
services. The DAST page then says dynamic scanning is switched off.
If the engine is not running
Targets can still be added and verified. A scan waits for the engine and then fails with a message naming the two services. The DAST page shows a notice that the engine is not reachable. Check:dast-egress reports healthy only when it can reach the engine, which takes
about a minute after the engine starts.
Network policy enforcement
On Kubernetes the engine’s isolation is a NetworkPolicy, and a NetworkPolicy is only enforced by a CNI plugin that implements it. On a cluster whose CNI does not, the engine is held only by its proxy setting, which is not sufficient. Do not run dynamic scanning on such a cluster.Upgrading the engine
The engine image is pinned by digest ininfra/docker/docker-compose.prod.yml
and infra/k8s/base/dast.yaml. TRUSTIVAN’s own end-to-end test runs real scans
against that exact digest. Change the digest only with a TRUSTIVAN release
that names the new one.
Licence
ZAP is licensed under the Apache License 2.0 and is not redistributed with TRUSTIVAN: your deployment pulls the project’s own image. If you copy that image into a private registry for others, you are its redistributor; seeNOTICE.