Asset identity is the name, not the digest
For a container image, the thing being protected is “the production build of this service”, not one immutable blob. Identity is thereforeregistry/repository:tag. A tag that names a commit is left out, so every commit
of an image is one asset:
One asset per image.
myapp:staging and
myapp:production are separately protected things, and alpine:3.18 and
alpine:3.21 are separately remediable. A digest-pinned reference carrying no
tag falls back to registry/repository, the most specific durable name
available.
The digest is still recorded: it is what a given scan actually examined, and
it is on the scan record.
Upsert, not create
The full key is(organisation, kind, identity), with a database uniqueness
constraint behind it. Requesting a scan of an image TRUSTIVAN has seen before
resolves to the existing asset rather than creating a second one.
The constraint is in PostgreSQL rather than in an application check because
two concurrent requests can both pass a SELECT before either INSERTs. A
webhook redelivery racing a user’s click is not hypothetical, and the result
would be two assets for one image with its history split permanently in half.
Identity carries no tenant
Two organisations scanningalpine:3.21 get two asset rows carrying the same
identity string, and therefore the same fingerprints for the same CVE.
That is intentional. Isolation is enforced by org_id and scoped queries, never
by making identity unguessable. See Tenancy and isolation.
Keeping identity portable is what makes “how many customers are affected by this
CVE” a query rather than a project.
Image references are untrusted input
A scan makes outbound network requests on the caller’s behalf, so the reference is validated as a security boundary rather than formatted as a convenience.
Private and loopback registries can be permitted, but only by a deployment
setting. It cannot be requested per scan, because the caller is the untrusted
party.
Images are pulled from the registry over the network. TRUSTIVAN does not consult
a local image store, use a Docker socket, or need a container runtime on the
worker at all. A reference matching an image the worker happened to have
locally would otherwise resolve to that image (possibly another tenant’s) and
report its contents to whoever asked.
Registries requiring authentication are supported on Pro and Enterprise: store
a credential against the registry host and scans of images from that host
present it. The scan carries a reference to the credential rather than the
secret itself, so no registry password enters a job payload or a log line, and
a reference that cannot be resolved fails the scan rather than quietly
downgrading to an anonymous pull.
A scan is an async, durable job
202 means work accepted, not work done. Pulling and unpacking an image
takes seconds to minutes. 200 instead means an existing scan was returned, so
a client can tell a deduplicated retry from a new scan.
The scan row is committed before the response is written. The queue message
that follows is an optimisation for latency, not a step that can lose work: a
scan that was accepted is durable even if the queue drops the wakeup entirely.
Idempotency keys are scoped per organisation, never globally: a shared key
space would let one tenant’s key suppress another tenant’s scan.
The per-tenant limit is a throttle, not a quota. Work beyond it stays queued
and is dispatched as that tenant’s running scans finish, so a tenant queueing
ten thousand images delays only themselves.
Poll
GET /api/v1/scans/{id} until the status is terminal.
Freshness is reported, and past a point it is enforced
A scan run against a stale advisory database reports “no vulnerabilities” with exactly the same confidence as a correct one. There is no worse outcome for a vulnerability scanner than a clean exit code and an empty report. So the scan record carriesdatabase_state and the database’s age, rather than
presenting a degraded result as a complete one. A moderately stale database
attaches a warning to the scan; a sufficiently old one fails the scan
outright.
Failing is the safe behaviour precisely because of reconciliation. A scan that
succeeded against unusable data would find nothing, and “found nothing” is how
TRUSTIVAN resolves findings, so a stale database would quietly close the entire
backlog. Refusing to produce that result is cheaper than repairing it.
What a scan does to the findings
A completed scan is reconciled against what already exists on the asset, in one transaction:- A finding seen again keeps its row, its fingerprint and every decision recorded against it.
- A finding not seen, whose kind actually ran, is resolved by absence.
- A resolved finding seen again is reopened.
- A suppressed finding is never resolved by absence: the acceptance stands until its expiry returns it to the backlog.
Scope, stated plainly
TRUSTIVAN scans for known vulnerabilities in three kinds of target:- Container images, pulled from a registry: public, or private with a stored credential on Pro and Enterprise. This is the default and the one every deployment can do.
- Git repositories, named by URL. The host must be on the deployment’s allow-list.
- Filesystem paths and SBOM documents, and only inside a directory the
operator has explicitly listed. A deployment that lists none refuses both
outright, which is the correct default rather than a limitation: a
filesystem target names a path on the worker, so accepting an arbitrary one
would let any authenticated caller read the worker’s own disk (its
configuration, its credentials, other tenants’ working directories) and
receive the contents back as findings, because a secret scanner reports what
it finds. There is deliberately no “unrestricted” setting. Each organization
reaches only its own directory under a listed root,
<root>/<organization id>/…, and the worker re-checks every path with its symlinks resolved before reading it, so a link out of that directory (to the worker’s disk or to another organization’s) fails the scan.
vm and cloud_account exist in the scan contract and
are not scannable by any shipped engine: the contract is wider than the
capability on purpose, so an engine can be added without reshaping the API.
Collecting a cloud account or a cluster is a separate subsystem, and it
ships. It is not a scan and does not appear here: there is no scan row, no
target and no engine involved. POST /api/v1/cloud/accounts and
POST /api/v1/kubernetes/clusters connect one, and a six-hourly sweep re-reads
it. See Cloud and Kubernetes.
It reads an SBOM as a scan target where one is permitted, and it also
writes one: GET /api/v1/assets/{id}/sbom renders an asset’s inventory as
CycloneDX 1.5 or SPDX 2.3, and POST to the same path imports one. Reading an
SBOM as a target and rendering an asset as an SBOM are genuinely different
features, and both now ship. See
Import and export SBOMs and
Find where a package is used.
Where to go next
- Findings and identity: what a scan produces and how it stays recognisable.
- The finding lifecycle: the states reconciliation moves findings between.
- Quickstart: the calls above, end to end.