Skip to Content
Comparisons

xgrep vs Trivy

How xgrep compares to Trivy. Both are single local binaries, but xgrep adds taint-based application SAST and reachability-ranked dependency vulnerabilities, while Trivy focuses on container, OS-package, and known-CVE scanning.

Trivy is a popular open-source scanner for container images, filesystems, and repositories. Like xgrep, it is a single Go binary that runs locally, so the usual "one binary, runs locally" points apply to both. The real difference is what each one looks at, and the two are more complementary than competing.

At a glance

xgrepTrivy
Packagingsingle local binarysingle local binary
Account required to scanno for SAST and secrets; dependency vulnerability matching needs a Mondoo accountno
Application SAST (taint / dataflow)yes, traces untrusted input to sinksno, not a code taint engine
Dependency (SCA) vuln matchingyes, SBOM matched against Mondoo Vulnerability Intelligence; needs a Mondoo accountyes, local vulnerability DB
Reachability rankingyes, is the vulnerable code actually reachablereports known CVEs in the manifest
Secretsyes (with validation)yes
SBOMyes (CycloneDX / SPDX)yes
CBOM / AIBOM from sourceyes (CycloneDX 1.6)no
Container image / OS-package scanningnot xgrep; covered by cnspec (images, registries, running containers)yes, a core strength
IaC misconfigurationxgrep: GitHub Actions, Terraform/HCL, Dockerfile · cnspec: Terraform, CloudFormation, Bicep/ARM, Ansible, Helmyes, broad
Kubernetes manifestsnot xgrep; covered by cnspecyes

Different core question

Trivy answers "what known vulnerabilities are in my images, packages and manifests?" It matches versions against vulnerability databases and scans container layers, OS packages and IaC configuration. That is a strong, well-covered job, and xgrep does not do it. xgrep is not a container or OS-package scanner.

xgrep answers "is my code vulnerable, and is a dependency CVE actually reachable?" It runs taint and dataflow analysis over your application source, tracing untrusted input to dangerous sinks, which Trivy does not do. And it ranks dependency vulnerabilities by whether your first-party code can reach the vulnerable package, instead of listing every CVE in the lockfile.

Accuracy

xgrep's accuracy is measured on public, labeled corpora rather than asserted. On the OWASP Benchmark it finds every planted vulnerability with zero false positives, in Java and in Python. The full tables, including head-to-head results on real vulnerable applications, are on the Semgrep comparison.

There is no head-to-head with Trivy here, because the two are not answering the same question. Scoring a taint engine and a CVE matcher on one corpus would measure the corpus, not the tools.

When Trivy is the better fit

If the question is what sits inside a built image, meaning OS packages, base-layer CVEs and container configuration, xgrep does not answer it and Trivy does. cnspec does too: container images, registries and running containers, scanned for CVEs and misconfiguration, plus Kubernetes, Helm and the wider IaC formats. On that ground the comparison is really Trivy against cnspec rather than against xgrep.

What picks Trivy by itself is the shape of it. One free binary, matching against a local vulnerability database, no account, works offline. If that is what you want for images and you are not otherwise on a platform, Trivy covers it. Plenty of teams run it alongside xgrep: Trivy for the image, xgrep for the code and for dependency findings cut down to what that code can reach.

When Mondoo is the better fit

There are two ways to read this comparison, and they point the same way.

If code scanning is the goal, xgrep is the better tool, and by some distance, because Trivy is not a taint engine. xgrep traces untrusted input to the sink it reaches, ranks dependency vulnerabilities by whether your code can reach the vulnerable function, and is measured on labeled corpora. "Which CVEs appear in my manifests" is a shallower question about your code than "is my code exploitable".

If coverage is the goal, xgrep and cnspec together go further. Application code, secrets and dependencies from xgrep; container images, registries, running containers, Kubernetes, IaC, cloud accounts and hosts from cnspec, checked against policy and compliance frameworks. Both report to Mondoo Platform and land on the same asset, with risk scoring, exceptions and fix status. That is code, build and runtime in one view, where an image scanner is one layer of it. See Mondoo.

Try it

xgrep scan --graph .    # taint SAST + reachability-ranked dependency vulns

See code scanning and reachability.

Last updated on

On this page