{"id":120743,"date":"2022-09-25T18:05:47","date_gmt":"2022-09-25T15:05:47","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=120743"},"modified":"2026-03-24T15:16:05","modified_gmt":"2026-03-24T12:16:05","slug":"scan-container-images-git-vulnerabilities-using-trivy","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/scan-container-images-git-vulnerabilities-using-trivy\/","title":{"rendered":"Scan for Docker Image and Git vulnerabilities using Trivy"},"content":{"rendered":"\n<p>Docker images play the biggest role in spinning containers. This serves as the perfect way to deploy an application. This can be really flawless depending on the strategy used to build your container image. Container images with vulnerabilities can cause a security threat to the application. Usually, a docker image is built from a Dockerfile with at least one layer of a base image then other layers pilled as captioned in the Dockerfile. Once build, from the Dockerfile, it then becomes entrenched.<\/p>\n\n\n\n<p>A vulnerability can be defined as a point of weakness that can be exploited and cause security threats. To be able to scan these vulnerabilities, we can use <strong>Trivy<\/strong>. This is a simple and comprehensive tool that can be used to scan for <strong>vulnerabilities<\/strong> in file systems, git repositories, container images as well as <strong><em>misconfigurations<\/em><\/strong>. This open-source tool was developed by <strong>Aqua Security<\/strong> in 2019. It detects vulnerabilities of Alpine, RHEL, CentOS, etc packages as well as language-specific bundlers such as Bundler, Composer, npm, yarn, etc. Moreso, it can be used to scan <em>Infrastructure as Code <\/em>(IaC) files example on Kubernetes and Terraform and detect configuration issues. You can also use Trivy to scan hardcoded secrets such as passwords, API keys, and tokens.<\/p>\n\n\n\n<p>The amazing features brought by Trivy are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Simple<\/strong>: using Trivy only involves specifying an image name, a directory containing IaC configs, or an artifact name<\/li><li><strong>Easy installation<\/strong>: It can be installed easily from apt, yum, brew, or docker hub. Also, no prerequisites such as database, system libraries e.t.c are required.<\/li><li><strong>High accuracy:<\/strong> It offers high accuracy, especially on Alpine Linux and RHEL\/CentOS, other OSes are also high.<\/li><li><strong>Support multiple targets:<\/strong> it can be used to scan container images, local filesystem, and remote git repository<\/li><li><strong>Fast<\/strong>: Its first scan takes less than 10 seconds depending on your internet speed. Then the other scans finish in a single second.<\/li><li><strong>Detect IaC misconfigurations<\/strong>: It has a wide variety of built-in policies that can be used to detect misconfigurations on Kubernetes, Terraform, Docker e.t.c<\/li><\/ul>\n\n\n\n<p>In this guide, we will learn how to scan for Docker Image and Git vulnerabilities using Trivy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Trivy on Your System<\/h2>\n\n\n\n<p>Trivy can be installed on different platforms. This involves adding the Trivy repositories to the system and then installing it via the package manager.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Install Trivy on RHEL\/CentOS \/ Rocky<\/h3>\n\n\n\n<p>Add the repository using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RELEASE_VERSION=$(grep -Po '(?&lt;=VERSION_ID=\")&#91;0-9]' \/etc\/os-release)\ncat &lt;&lt; EOF | sudo tee -a \/etc\/yum.repos.d\/trivy.repo\n&#91;trivy]\nname=Trivy repository\nbaseurl=https:\/\/aquasecurity.github.io\/trivy-repo\/rpm\/releases\/$RELEASE_VERSION\/\\$basearch\/\ngpgcheck=0\nenabled=1\nEOF<\/code><\/pre>\n\n\n\n<p>Once added, install Trivy using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum -y install trivy<\/code><\/pre>\n\n\n\n<p>Alternatively, you can install Trivy using an RPM package obtained from the <a href=\"https:\/\/github.com\/aquasecurity\/trivy\/releases\/tag\/v0.29.2\" target=\"_blank\" rel=\"noreferrer noopener\">Github Release page<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum -y install wget curl\nVER=$(curl -s https:\/\/api.github.com\/repos\/aquasecurity\/trivy\/releases\/latest|grep tag_name|cut -d '\"' -f 4|sed 's\/v\/\/')\nwget https:\/\/github.com\/aquasecurity\/trivy\/releases\/download\/v${VER}\/trivy_${VER}_Linux-64bit.rpm\nsudo rpm -Uvh .\/trivy_${VER}_Linux-64bit.rpm<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Install Trivy on Debian\/Ubuntu<\/h3>\n\n\n\n<p>The Trivy repository can be added to Debian\/Ubuntu systems using the commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install wget apt-transport-https gnupg lsb-release\nwget -qO - https:\/\/aquasecurity.github.io\/trivy-repo\/deb\/public.key | sudo apt-key add -\necho deb https:\/\/aquasecurity.github.io\/trivy-repo\/deb $(lsb_release -sc) main | sudo tee \/etc\/apt\/sources.list.d\/trivy.list<\/code><\/pre>\n\n\n\n<p>Now update the APT package index and install Trivy:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install trivy<\/code><\/pre>\n\n\n\n<p>You can also use a DEB package obtained from the <a href=\"https:\/\/github.com\/aquasecurity\/trivy\/releases\/tag\/v0.29.2\" target=\"_blank\" rel=\"noreferrer noopener\">Github Release page<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>VER=$(curl -s https:\/\/api.github.com\/repos\/aquasecurity\/trivy\/releases\/latest|grep tag_name|cut -d '\"' -f 4|sed 's\/v\/\/')\nwget https:\/\/github.com\/aquasecurity\/trivy\/releases\/download\/v${VER}\/trivy_${VER}_Linux-64bit.deb\nsudo dpkg -i trivy_${VER}_Linux-64bit.deb<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Install Trivy on Arch Linux<\/h3>\n\n\n\n<p>Trivy can be installed on Arch Linux from the Arch User Repository as shown:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>yay<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>yay -Sy trivy-bin<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>pikaur<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>pikaur -Sy trivy-bin<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Homebrew<\/h3>\n\n\n\n<p>Homebrew provided Trivy packages for installation on both macOS and Linux systems. You can use the command below to install Trivy from Homebrew:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew install aquasecurity\/trivy\/trivy<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Scanning For Vulnerabilities using Trivy<\/h2>\n\n\n\n<p>Once Trivy has been installed, it can be used to perform vulnerability scanning on:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Container Images<\/li><li>Filesystem<\/li><li>Git Repositories<\/li><\/ul>\n\n\n\n<p>The below steps can be used to perform any of the mentioned scans.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">A. Scanning Container Images Vulnerabilities using Trivy<\/h3>\n\n\n\n<p>Trivy Can be used to scan container images using a simple command bearing the below syntax.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy image &#91;YOUR_IMAGE_NAME]<\/code><\/pre>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy image python:3.4-alpine<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"559\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1024x559.png\" alt=\"\" class=\"wp-image-120751\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1024x559.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-300x164.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-768x419.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-696x380.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1068x583.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-769x420.png 769w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy.png 1273w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can also use TAR files for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker pull ruby:3.1-alpine3.15\ndocker save ruby:3.1-alpine3.15 -o ruby-3.1.tar\ntrivy image --input ruby-3.1.tar<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"533\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-1024x533.png\" alt=\"\" class=\"wp-image-120752\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-1024x533.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-300x156.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-768x400.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-696x362.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-1068x556.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1-807x420.png 807w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-1.png 1264w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">B. Scanning Filesystem Vulnerabilities using Trivy<\/h3>\n\n\n\n<p>The command used for this has the syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy fs \/path\/to\/project<\/code><\/pre>\n\n\n\n<p>For example, scanning a local project with language-specific files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/aquasecurity\/trivy-ci-test.git \ntrivy fs trivy-ci-test<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"571\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-1024x571.png\" alt=\"\" class=\"wp-image-120753\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-1024x571.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-300x167.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-768x428.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-696x388.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-1068x595.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2-754x420.png 754w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-2.png 1272w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can also scan a single file in the project, say <strong>Pipfile.lock<\/strong> using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy fs trivy-ci-test\/Pipfile.lock<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Scanning for Git Repository Vulnerabilities using Trivy<\/h3>\n\n\n\n<p>To scan vulnerabilities on a Git Repository, the command with the below syntax is used:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy repo <em>https:\/\/github.com\/knqyf263\/trivy-ci-test<\/em><\/code><\/pre>\n\n\n\n<p>Replace <em><strong>https:\/\/github.com\/knqyf263\/trivy-ci-test<\/strong><\/em> with the Git repo name. <\/p>\n\n\n\n<p>Execution output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"559\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-1024x559.png\" alt=\"\" class=\"wp-image-120754\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-1024x559.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-300x164.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-768x420.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-696x380.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-1068x583.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3-769x420.png 769w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-3.png 1274w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To be able to scan a private Git repo, you need to specify your <em><strong>GITHUB_TOKEN<\/strong><\/em> or <strong><em>GITLAB_TOKEN<\/em> <\/strong>environment variables. This token must be valid to be able to access and scan the repository:<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##For GITHUB##\n<\/mark><\/em>export GITHUB_TOKEN=\"<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\"><em>your_private_github_token<\/em><\/mark>\"\ntrivy repo <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">&lt;your private GitHub repo URL><\/mark><\/em>\n\n<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##For GITLAB##\n<\/mark><\/em>export GITLAB_TOKEN=\"<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\"><em>your_private_gitlab_token<\/em><\/mark>\"\ntrivy repo <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">&lt;your private GitLab repo URL><\/mark><\/em><\/code><\/pre>\n\n\n\n<p>Once exported, you will realize that the command to scan the repo is similar to the one above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Misconfiguration Scanning with Trivy<\/h2>\n\n\n\n<p>Aside from scanning vulnerabilities, you can use Trivy to scan misconfigurations in Docker, Kubernetes, Terraform, and CloudFormation. It is also possible to write your own policies in&nbsp;<a href=\"https:\/\/www.openpolicyagent.org\/docs\/latest\/policy-language\/\" target=\"_blank\" rel=\"noreferrer noopener\">Rego<\/a>&nbsp;that will be used to scan your JSON, YAML  e.t.c files<\/p>\n\n\n\n<p>The command with the below syntax is used here:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy config <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">&#91;YOUR_IaC_DIRECTORY]<\/mark><\/em><\/code><\/pre>\n\n\n\n<p>For example, scanning a Dockerfile:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir iac \nvim iac\/Dockerfile<\/code><\/pre>\n\n\n\n<p>Add the below lines to the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FROM composer:1.7.2\nCOPY composer_laravel.lock \/php-app\/composer.lock\nCOPY Gemfile_rails.lock \/ruby-app\/Gemfile.lock\nCOPY package-lock_react.json \/node-app\/package-lock.json\nCOPY Pipfile.lock \/python-app\/Pipfile.lock\nCOPY Cargo.lock \/rust-app\/Cargo.lock<\/code><\/pre>\n\n\n\n<p>Save and scan the file using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> trivy config .\/iac<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"287\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4-1024x287.png\" alt=\"\" class=\"wp-image-120755\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4-1024x287.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4-300x84.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4-768x216.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4-696x195.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4-1068x300.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/07\/Scan-for-Docker-Image-and-Git-vulnerabilities-using-Trivy-4.png 1268w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Also, Trivy offers type detection if your directory contains mixed <em>IaC<\/em> files for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\"> ls iac\/<\/mark>\nDockerfile  deployment.yaml  main.tf mysql-8.8.26.tar<\/code><\/pre>\n\n\n\n<p>Perform the scan:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trivy conf --severity HIGH,CRITICAL .\/iac<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>Dockerfile (dockerfile)\n<\/em>=======================\nTests: 23 (SUCCESSES: 22, FAILURES: 1, EXCEPTIONS: 0)\nFailures: 1 (HIGH: 1, CRITICAL: 0)\n...\n\n<em>deployment.yaml (kubernetes)\n<\/em>============================\nTests: 28 (SUCCESSES: 15, FAILURES: 13, EXCEPTIONS: 0)\nFailures: 13 (MEDIUM: 4, HIGH: 1, CRITICAL: 0)\n\n...\n\n<em>main.tf (terraform)\n<\/em>===================\nTests: 23 (SUCCESSES: 14, FAILURES: 9, EXCEPTIONS: 0)\nFailures: 9 (HIGH: 6, CRITICAL: 1)\n...\n\n<em>bucket.yaml (cloudformation)\n<\/em>============================\nTests: 9 (SUCCESSES: 3, FAILURES: 6, EXCEPTIONS: 0)\nFailures: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 2, HIGH: 4, CRITICAL: 0)\n...\n\n<em>mysql-8.8.26.tar:templates\/primary\/statefulset.yaml (helm)\n<\/em>==========================================================\nTests: 20 (SUCCESSES: 18, FAILURES: 2, EXCEPTIONS: 0)\nFailures: 2 (MEDIUM: 2, HIGH: 0, CRITICAL: 0)\n....<\/code><\/pre>\n\n\n\n<p>It is possible to enable misconfiguration detection in a container image, filesystem, and git repository scans by adding the <strong><em>&#8211;security-checks<\/em><\/strong> config flag. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##For container images\n<\/mark><\/em>trivy image --security-checks config <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">IMAGE_NAME<\/mark><\/em>\n\n<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##For filesystems\n<\/mark><\/em>trivy fs --security-checks config <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">\/path\/to\/dir<\/mark><\/em><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Closing Thoughts<\/h2>\n\n\n\n<p>We have triumphantly walked through how to scan for vulnerabilities in Docker images, filesystems, and Git repositories using Trivy. I hope this was fancy.<\/p>\n\n\n\n<p>Related posts:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/computingforgeeks.com\/install-nessus-vulnerability-scanner-on-debian\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Nessus Vulnerability Scanner on Debian<\/a><\/li><li><a href=\"https:\/\/computingforgeeks.com\/install-wpscan-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Use WPScan &#8211; WordPress security scanner<\/a><\/li><li><a href=\"https:\/\/computingforgeeks.com\/scan-php-javascript-csharp-html-using-sonar-scanner-and-jenkins\/\" target=\"_blank\" rel=\"noreferrer noopener\">Scan PHP|JavaScript|C#|HTML using Sonar Scanner and Jenkins<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Docker images play the biggest role in spinning containers. This serves as the perfect way to deploy an application. This can be really flawless depending on the strategy used to build your container image. Container images with vulnerabilities can cause a security threat to the application. Usually, a docker image is built from a Dockerfile &#8230; <a title=\"Scan for Docker Image and Git vulnerabilities using Trivy\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/scan-container-images-git-vulnerabilities-using-trivy\/\" aria-label=\"Read more about Scan for Docker Image and Git vulnerabilities using Trivy\">Read more<\/a><\/p>\n","protected":false},"author":21,"featured_media":77804,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[316,299,50,75],"tags":[37864,37865],"class_list":["post-120743","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-containers","category-how-to","category-linux-tutorials","category-security","tag-trivy","tag-vulnerabilities-using-trivy"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/120743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=120743"}],"version-history":[{"count":1,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/120743\/revisions"}],"predecessor-version":[{"id":164235,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/120743\/revisions\/164235"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/77804"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=120743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=120743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=120743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}