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
| xgrep | Trivy | |
|---|---|---|
| Packaging | single local binary | single local binary |
| Account required to scan | no for SAST and secrets; dependency vulnerability matching needs a Mondoo account | no |
| Application SAST (taint / dataflow) | yes, traces untrusted input to sinks | no, not a code taint engine |
| Dependency (SCA) vuln matching | yes, SBOM matched against Mondoo Vulnerability Intelligence; needs a Mondoo account | yes, local vulnerability DB |
| Reachability ranking | yes, is the vulnerable code actually reachable | reports known CVEs in the manifest |
| Secrets | yes (with validation) | yes |
| SBOM | yes (CycloneDX / SPDX) | yes |
| CBOM / AIBOM from source | yes (CycloneDX 1.6) | no |
| Container image / OS-package scanning | not xgrep; covered by cnspec (images, registries, running containers) | yes, a core strength |
| IaC misconfiguration | xgrep: GitHub Actions, Terraform/HCL, Dockerfile · cnspec: Terraform, CloudFormation, Bicep/ARM, Ansible, Helm | yes, broad |
| Kubernetes manifests | not xgrep; covered by cnspec | yes |
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 vulnsSee code scanning and reachability.
Last updated on
vs Snyk
How xgrep compares to Snyk. A single local binary whose analysis finishes on your machine and never uploads your source, versus a cloud service that analyzes your code server-side.
vs gitleaks
How xgrep compares to gitleaks. Both are local single binaries for finding secrets, but xgrep validates secrets to cut false positives and folds secret scanning into one pass with SAST and dependency analysis.