OpsCanary
Back to daily brief
securityscanningPractitioner

Filesystem Scanning: Uncovering Vulnerabilities and Secrets with Trivy

5 min read Official DocsApr 27, 2026
Share
PractitionerHands-on experience recommended

Filesystem scanning is crucial for maintaining security in your applications. With the rise of complex dependencies, vulnerabilities and misconfigurations can easily slip through the cracks. Trivy addresses this by scanning local projects for vulnerabilities, misconfigurations, secrets, and licenses, helping you catch these issues before they become a problem.

Trivy operates with a simple command: $trivy fs/path/to/project. By default, it scans for vulnerabilities and secrets, while misconfigurations and licenses are disabled. If you want to enable misconfiguration scanning, you can do so with the parameter --scanners misconfig. Similarly, to check for licenses, use --scanners license/path/to/project. Trivy also supports caching; however, it doesn't use the cache by default unless your local project is a git repository with a clean status and a cache backend other than memory is enabled.

In production, remember that while Trivy's vulnerability and secret scanning is enabled by default, you must actively enable misconfigurations and licenses. A common gotcha is that if the OS isn't detected, vulnerabilities in OS packages won't be identified. Always ensure your environment is properly configured to get the most out of Trivy's scanning capabilities.

Key takeaways

  • Enable misconfiguration scanning with `--scanners misconfig` to catch potential issues.
  • Use `$trivy fs/path/to/project` to initiate a full filesystem scan.
  • Check for licenses by using `--scanners license/path/to/project`.
  • Be aware that OS detection issues can lead to missed vulnerabilities.
  • Utilize caching effectively by setting a proper cache backend for git repositories.

Why it matters

In production, unaddressed vulnerabilities and misconfigurations can lead to severe security breaches. Regularly scanning your filesystem helps mitigate these risks and ensures compliance with licensing requirements.

Code examples

Bash
$trivy fs/path/to/project
Bash
$ trivy fs ~/src/github.com/aquasecurity/trivy-ci-test/Pipfile.lock
Bash
$trivy fs --scanners misconfig/path/to/project

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.