trustivan CLI, a single static binary, and runs
trustivan gate. The gate requests a scan, waits for it, asks for a verdict and
exits 1 when the policy blocks the build.
Prerequisites
- An API key with
scans:create,scans:readandverdicts:request, plusfindings:readfor the SARIF file. Put it in a CircleCI context namedtrustivanas the environment variableTRUSTIVAN_API_KEY, and restrict the context to the security group that may use it. See Scopes. - An enabled policy in the organization, or a policy id to pass with
--policy. Without one the verdict request answers409. See Gate a pipeline on a policy. - The image already pushed to a registry TRUSTIVAN can pull from. TRUSTIVAN pulls it itself; a private registry needs a credential stored in TRUSTIVAN first. See Scan a private registry image.
The config
.circleci/config.yml
CIRCLE_WORKFLOW_ID is the idempotency key, so a retried request inside one
workflow reuses its scan instead of queueing a second one. when: always keeps
the SARIF file on a blocked build, which is the build it matters for. To pin a
CLI release, replace latest/download with download/<tag>. On an arm
resource class, use trustivan-linux-arm64 in all four places.
What it gates on
CircleCI fails the job on both. A failed scan is never treated as a pass. The
default wait is 20 minutes; change it with
--timeout 30m.
See the results
- The step output has the verdict, the policy and version, the scan id and
every rule, with
!beside the ones that fired. - The job’s Artifacts tab has
trustivan.sarif, which any SARIF 2.1.0 viewer opens. - The dashboard has the scan and its findings under the asset.
Report without blocking
Accept exit1 and nothing else, so an outage still fails the job:
Troubleshooting
See also
trustivanCLI reference: every flag- CI pipelines: the same gate with
curl, and a certificate check withtls-check - Jenkins, Azure Pipelines, Bitbucket Pipelines, Buildkite