├── .github └── workflows │ ├── bump-trivy.yaml │ ├── sync-trivy-checks.yaml │ ├── sync-trivy-db.yaml │ ├── sync-trivy-java-db.yaml │ └── test.yaml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── action.yaml ├── docs └── images │ └── trivy-action.png ├── entrypoint.sh ├── test ├── data │ ├── config-sarif-report │ │ ├── main.tf │ │ └── report.sarif │ ├── config-scan │ │ ├── main.tf │ │ └── report.json │ ├── fs-scan │ │ └── report │ ├── github-dep-snapshot │ │ └── report.gsbom │ ├── image-scan │ │ └── report │ ├── rootfs-scan │ │ └── report │ ├── secret-scan │ │ └── report.json │ ├── with-ignore-files │ │ ├── .trivyignore1 │ │ ├── .trivyignore2 │ │ └── report │ ├── with-tf-vars │ │ ├── dev.tfvars │ │ ├── main.tf │ │ └── report.json │ └── with-trivy-yaml-cfg │ │ ├── report.json │ │ └── trivy.yaml └── test.bats └── workflow.yml /.github/workflows/bump-trivy.yaml: -------------------------------------------------------------------------------- 1 | name: Bump trivy 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | trivy_version: 7 | required: true 8 | type: string 9 | description: 'The Trivy version in x.x.x format' 10 | 11 | run-name: Bump trivy to v${{ inputs.trivy_version }} 12 | 13 | jobs: 14 | bump: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Set new version from input 20 | run: echo "NEW_VERSION=${{ inputs.trivy_version }}" >> $GITHUB_ENV 21 | 22 | - name: Update Trivy versions 23 | run: make bump-trivy 24 | 25 | - name: Create PR 26 | id: create-pr 27 | uses: peter-evans/create-pull-request@v5 28 | with: 29 | token: ${{ secrets.ORG_REPO_TOKEN }} 30 | title: "chore(deps): Update trivy to v${{ inputs.trivy_version }}" 31 | commit-message: "chore(deps): Update trivy to v${{ inputs.trivy_version }}" 32 | committer: github-actions[bot] 33 | author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> 34 | branch-suffix: timestamp 35 | branch: bump-trivy 36 | delete-branch: true 37 | 38 | - name: Check outputs 39 | run: | 40 | echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}" 41 | echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}" 42 | -------------------------------------------------------------------------------- /.github/workflows/sync-trivy-checks.yaml: -------------------------------------------------------------------------------- 1 | name: Sync Trivy Checks 2 | 3 | on: 4 | workflow_dispatch: 5 | env: 6 | IMAGE_NAME: ${{ github.repository_owner }}/trivy-checks-act 7 | REGISTRY: ghcr.io 8 | 9 | jobs: 10 | sync-trivy-checks: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - name: Login to GitHub Packages Container registry 16 | uses: docker/login-action@v3 17 | with: 18 | registry: ${{ env.REGISTRY }} 19 | username: ${{ github.actor }} 20 | password: ${{ secrets.GITHUB_TOKEN }} 21 | 22 | - name: Copy Trivy Checks 23 | run: | 24 | oras cp ghcr.io/aquasecurity/trivy-checks:1 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest -------------------------------------------------------------------------------- /.github/workflows/sync-trivy-db.yaml: -------------------------------------------------------------------------------- 1 | name: Sync Trivy DB 2 | 3 | on: 4 | workflow_dispatch: 5 | env: 6 | IMAGE_NAME: ${{ github.repository_owner }}/trivy-db-act 7 | REGISTRY: ghcr.io 8 | 9 | jobs: 10 | sync-trivy-db: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - name: Login to GitHub Packages Container registry 16 | uses: docker/login-action@v3 17 | with: 18 | registry: ${{ env.REGISTRY }} 19 | username: ${{ github.actor }} 20 | password: ${{ secrets.GITHUB_TOKEN }} 21 | 22 | - name: Copy Trivy DB 23 | run: | 24 | oras cp ghcr.io/aquasecurity/trivy-db:2 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest 25 | -------------------------------------------------------------------------------- /.github/workflows/sync-trivy-java-db.yaml: -------------------------------------------------------------------------------- 1 | name: Sync Trivy Java DB 2 | 3 | on: 4 | workflow_dispatch: 5 | env: 6 | IMAGE_NAME: ${{ github.repository_owner }}/trivy-java-db-act 7 | REGISTRY: ghcr.io 8 | 9 | jobs: 10 | sync-trivy-db: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - name: Login to GitHub Packages Container registry 16 | uses: docker/login-action@v3 17 | with: 18 | registry: ${{ env.REGISTRY }} 19 | username: ${{ github.actor }} 20 | password: ${{ secrets.GITHUB_TOKEN }} 21 | 22 | - name: Copy Trivy Java DB 23 | run: | 24 | oras cp ghcr.io/aquasecurity/trivy-java-db:1 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest 25 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | env: 9 | TRIVY_VERSION: 0.63.0 10 | BATS_LIB_PATH: '/usr/lib/' 11 | 12 | jobs: 13 | test: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - name: Setup Bats and bats libs 19 | uses: bats-core/bats-action@2.0.0 20 | 21 | - name: Install Trivy 22 | run: | 23 | curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v${{ env.TRIVY_VERSION }} 24 | trivy --version 25 | 26 | - name: Test 27 | run: bats --recursive --timing --verbose-run . 28 | env: 29 | TRIVY_CACHE_DIR: .cache 30 | TRIVY_DISABLE_VEX_NOTICE: true 31 | TRIVY_DEBUG: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.test 3 | !test/data/*.test 4 | trivyignores 5 | .vscode/ 6 | 7 | .cache -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | OS := $(shell uname) 2 | SED = sed 3 | BATS_LIB_PATH = /usr/local/lib/ 4 | 5 | ifeq ($(OS), Darwin) 6 | SED = gsed 7 | BATS_LIB_PATH = /opt/homebrew/lib 8 | endif 9 | 10 | .PHONY: test 11 | test: 12 | mkdir -p .cache 13 | BATS_LIB_PATH=$(BATS_LIB_PATH) GITHUB_REPOSITORY_OWNER=aquasecurity\ 14 | TRIVY_CACHE_DIR=.cache TRIVY_DISABLE_VEX_NOTICE=true TRIVY_DEBUG=true\ 15 | bats --recursive --timing --verbose-run . 16 | 17 | bump-trivy: 18 | @[ $$NEW_VERSION ] || ( echo "env 'NEW_VERSION' is not set"; exit 1 ) 19 | @CURRENT_VERSION=$$(grep "TRIVY_VERSION:" .github/workflows/test.yaml | awk '{print $$2}');\ 20 | echo Current version: $$CURRENT_VERSION ;\ 21 | echo New version: $$NEW_VERSION ;\ 22 | $(SED) -i -e "s/$$CURRENT_VERSION/$$NEW_VERSION/g" README.md action.yaml .github/workflows/test.yaml ;\ 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Trivy Action 2 | 3 | > [GitHub Action](https://github.com/features/actions) for [Trivy](https://github.com/aquasecurity/trivy) 4 | 5 | [![GitHub Release][release-img]][release] 6 | [![GitHub Marketplace][marketplace-img]][marketplace] 7 | [![License][license-img]][license] 8 | 9 | ![](docs/images/trivy-action.png) 10 | 11 | ## Table of Contents 12 | 13 | * [Usage](#usage) 14 | * [Scan CI Pipeline](#scan-ci-pipeline) 15 | * [Scan CI Pipeline (w/ Trivy Config)](#scan-ci-pipeline-w-trivy-config) 16 | * [Cache](#cache) 17 | * [Trivy Setup](#trivy-setup) 18 | * [Scanning a Tarball](#scanning-a-tarball) 19 | * [Using Trivy with templates](#using-trivy-with-templates) 20 | * [Using Trivy with GitHub Code Scanning](#using-trivy-with-github-code-scanning) 21 | * [Using Trivy to scan your Git repo](#using-trivy-to-scan-your-git-repo) 22 | * [Using Trivy to scan your rootfs directories](#using-trivy-to-scan-your-rootfs-directories) 23 | * [Using Trivy to scan Infrastructure as Code](#using-trivy-to-scan-infrastructure-as-code) 24 | * [Using Trivy to generate SBOM](#using-trivy-to-generate-sbom) 25 | * [Using Trivy to scan your private registry](#using-trivy-to-scan-your-private-registry) 26 | * [Using Trivy if you don't have code scanning enabled](#using-trivy-if-you-dont-have-code-scanning-enabled) 27 | * [Customizing](#customizing) 28 | * [inputs](#inputs) 29 | * [Environment variables](#environment-variables) 30 | * [Trivy config file](#trivy-config-file) 31 | 32 | ## Usage 33 | 34 | ### Scan CI Pipeline 35 | 36 | ```yaml 37 | name: build 38 | on: 39 | push: 40 | branches: 41 | - main 42 | pull_request: 43 | jobs: 44 | build: 45 | name: Build 46 | runs-on: ubuntu-24.04 47 | steps: 48 | - name: Checkout code 49 | uses: actions/checkout@v3 50 | - name: Build an image from Dockerfile 51 | run: docker build -t docker.io/my-organization/my-app:${{ github.sha }} . 52 | - name: Run Trivy vulnerability scanner 53 | uses: aquasecurity/trivy-action@0.28.0 54 | with: 55 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 56 | format: 'table' 57 | exit-code: '1' 58 | ignore-unfixed: true 59 | vuln-type: 'os,library' 60 | severity: 'CRITICAL,HIGH' 61 | ``` 62 | 63 | ### Scan CI Pipeline (w/ Trivy Config) 64 | 65 | ```yaml 66 | name: build 67 | on: 68 | push: 69 | branches: 70 | - main 71 | pull_request: 72 | jobs: 73 | build: 74 | name: Build 75 | runs-on: ubuntu-24.04 76 | steps: 77 | - name: Checkout code 78 | uses: actions/checkout@v4 79 | 80 | - name: Run Trivy vulnerability scanner in fs mode 81 | uses: aquasecurity/trivy-action@0.28.0 82 | with: 83 | scan-type: 'fs' 84 | scan-ref: '.' 85 | trivy-config: trivy.yaml 86 | ``` 87 | 88 | In this case `trivy.yaml` is a YAML configuration that is checked in as part of the repo. Detailed information is available on the Trivy website but an example is as follows: 89 | ```yaml 90 | format: json 91 | exit-code: 1 92 | severity: CRITICAL 93 | secret: 94 | config: config/trivy/secret.yaml 95 | ``` 96 | 97 | It is possible to define all options in the `trivy.yaml` file. Specifying individual options via the action are left for backward compatibility purposes. Defining the following is required as they cannot be defined with the config file: 98 | - `scan-ref`: If using `fs, repo` scans. 99 | - `image-ref`: If using `image` scan. 100 | - `scan-type`: To define the scan type, e.g. `image`, `fs`, `repo`, etc. 101 | 102 | #### Order of preference for options 103 | Trivy uses [Viper](https://github.com/spf13/viper) which has a defined precedence order for options. The order is as follows: 104 | - GitHub Action flag 105 | - Environment variable 106 | - Config file 107 | - Default 108 | 109 | ### Cache 110 | The action has a built-in functionality for caching and restoring [the vulnerability DB](https://github.com/aquasecurity/trivy-db), [the Java DB](https://github.com/aquasecurity/trivy-java-db) and [the checks bundle](https://github.com/aquasecurity/trivy-checks) if they are downloaded during the scan. 111 | The cache is stored in the `$GITHUB_WORKSPACE/.cache/trivy` directory by default. 112 | The cache is restored before the scan starts and saved after the scan finishes. 113 | 114 | It uses [actions/cache](https://github.com/actions/cache) under the hood but requires less configuration settings. 115 | The cache input is optional, and caching is turned on by default. 116 | 117 | #### Disabling caching 118 | If you want to disable caching, set the `cache` input to `false`, but we recommend keeping it enabled to avoid rate limiting issues. 119 | 120 | ```yaml 121 | - name: Run Trivy scanner without cache 122 | uses: aquasecurity/trivy-action@0.28.0 123 | with: 124 | scan-type: 'fs' 125 | scan-ref: '.' 126 | cache: 'false' 127 | ``` 128 | 129 | #### Updating caches in the default branch 130 | Please note that there are [restrictions on cache access](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) between branches in GitHub Actions. 131 | By default, a workflow can access and restore a cache created in either the current branch or the default branch (usually `main` or `master`). 132 | If you need to share caches across branches, you may need to create a cache in the default branch and restore it in the current branch. 133 | 134 | To optimize your workflow, you can set up a cron job to regularly update the cache in the default branch. 135 | This allows subsequent scans to use the cached DB without downloading it again. 136 | 137 | ```yaml 138 | # Note: This workflow only updates the cache. You should create a separate workflow for your actual Trivy scans. 139 | # In your scan workflow, set TRIVY_SKIP_DB_UPDATE=true and TRIVY_SKIP_JAVA_DB_UPDATE=true. 140 | name: Update Trivy Cache 141 | 142 | on: 143 | schedule: 144 | - cron: '0 0 * * *' # Run daily at midnight UTC 145 | workflow_dispatch: # Allow manual triggering 146 | 147 | jobs: 148 | update-trivy-db: 149 | runs-on: ubuntu-latest 150 | steps: 151 | - name: Setup oras 152 | uses: oras-project/setup-oras@v1 153 | 154 | - name: Get current date 155 | id: date 156 | run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT 157 | 158 | - name: Download and extract the vulnerability DB 159 | run: | 160 | mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db 161 | oras pull ghcr.io/aquasecurity/trivy-db:2 162 | tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db 163 | rm db.tar.gz 164 | 165 | - name: Download and extract the Java DB 166 | run: | 167 | mkdir -p $GITHUB_WORKSPACE/.cache/trivy/java-db 168 | oras pull ghcr.io/aquasecurity/trivy-java-db:1 169 | tar -xzf javadb.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/java-db 170 | rm javadb.tar.gz 171 | 172 | - name: Cache DBs 173 | uses: actions/cache/save@v4 174 | with: 175 | path: ${{ github.workspace }}/.cache/trivy 176 | key: cache-trivy-${{ steps.date.outputs.date }} 177 | ``` 178 | 179 | When running a scan, set the environment variables `TRIVY_SKIP_DB_UPDATE` and `TRIVY_SKIP_JAVA_DB_UPDATE` to skip the download process. 180 | 181 | ```yaml 182 | - name: Run Trivy scanner without downloading DBs 183 | uses: aquasecurity/trivy-action@0.28.0 184 | with: 185 | scan-type: 'image' 186 | scan-ref: 'myimage' 187 | env: 188 | TRIVY_SKIP_DB_UPDATE: true 189 | TRIVY_SKIP_JAVA_DB_UPDATE: true 190 | ``` 191 | 192 | ### Trivy Setup 193 | By default the action calls [`aquasecurity/setup-trivy`](https://github.com/aquasecurity/setup-trivy) as the first step 194 | which installs the `trivy` version specified by the `version` input. If you have already installed `trivy` by other 195 | means, e.g. calling `aquasecurity/setup-trivy` directly, or are invoking this action multiple times then you can use the 196 | `skip-setup-trivy` input to disable this step. 197 | 198 | #### Setting up Trivy Manually 199 | ```yaml 200 | name: build 201 | on: 202 | push: 203 | branches: 204 | - main 205 | pull_request: 206 | jobs: 207 | build: 208 | name: Build 209 | runs-on: ubuntu-24.04 210 | steps: 211 | - name: Checkout code 212 | uses: actions/checkout@v4 213 | 214 | - name: Manual Trivy Setup 215 | uses: aquasecurity/setup-trivy@v0.2.0 216 | with: 217 | cache: true 218 | version: v0.63.0 219 | 220 | - name: Run Trivy vulnerability scanner in repo mode 221 | uses: aquasecurity/trivy-action@master 222 | with: 223 | scan-type: 'fs' 224 | ignore-unfixed: true 225 | format: 'sarif' 226 | output: 'trivy-results.sarif' 227 | severity: 'CRITICAL' 228 | skip-setup-trivy: true 229 | ``` 230 | 231 | #### Skipping Setup when Calling Trivy Action multiple times 232 | Another common use case is when a build calls this action multiple times, in this case we can set `skip-setup-trivy` to 233 | `true` on subsequent invocations e.g. 234 | 235 | ```yaml 236 | name: build 237 | 238 | on: 239 | push: 240 | branches: 241 | - main 242 | pull_request: 243 | 244 | jobs: 245 | test: 246 | runs-on: ubuntu-latest 247 | permissions: 248 | contents: read 249 | steps: 250 | - name: Check out Git repository 251 | uses: actions/checkout@v4 252 | 253 | # The first call to the action will invoke setup-trivy and install trivy 254 | - name: Generate Trivy Vulnerability Report 255 | uses: aquasecurity/trivy-action@master 256 | with: 257 | scan-type: "fs" 258 | output: trivy-report.json 259 | format: json 260 | scan-ref: . 261 | exit-code: 0 262 | 263 | - name: Upload Vulnerability Scan Results 264 | uses: actions/upload-artifact@v4 265 | with: 266 | name: trivy-report 267 | path: trivy-report.json 268 | retention-days: 30 269 | 270 | - name: Fail build on High/Criticial Vulnerabilities 271 | uses: aquasecurity/trivy-action@master 272 | with: 273 | scan-type: "fs" 274 | format: table 275 | scan-ref: . 276 | severity: HIGH,CRITICAL 277 | ignore-unfixed: true 278 | exit-code: 1 279 | # On a subsequent call to the action we know trivy is already installed so can skip this 280 | skip-setup-trivy: true 281 | ``` 282 | 283 | #### Use non-default token to install Trivy 284 | GitHub Enterprise Server (GHES) uses an invalid `github.token` for `https://github.com` server. 285 | Therefore, you can't install `Trivy` using the `setup-trivy` action. 286 | 287 | To fix this problem, you need to overwrite the token for `setup-trivy` using `token-setup-trivy` input: 288 | ```yaml 289 | - name: Run Trivy scanner without cache 290 | uses: aquasecurity/trivy-action@0.28.0 291 | with: 292 | scan-type: 'fs' 293 | scan-ref: '.' 294 | token-setup-trivy: ${{ secrets.GITHUB_PAT }} 295 | ``` 296 | 297 | GitHub even has [create-github-app-token](https://github.com/actions/create-github-app-token) for similar cases. 298 | 299 | ### Scanning a Tarball 300 | ```yaml 301 | name: build 302 | on: 303 | push: 304 | branches: 305 | - main 306 | pull_request: 307 | jobs: 308 | build: 309 | name: Build 310 | runs-on: ubuntu-24.04 311 | steps: 312 | - name: Checkout code 313 | uses: actions/checkout@v4 314 | 315 | - name: Generate tarball from image 316 | run: | 317 | docker pull 318 | docker save -o vuln-image.tar 319 | 320 | - name: Run Trivy vulnerability scanner in tarball mode 321 | uses: aquasecurity/trivy-action@0.28.0 322 | with: 323 | input: /github/workspace/vuln-image.tar 324 | severity: 'CRITICAL,HIGH' 325 | ``` 326 | 327 | ### Using Trivy with templates 328 | The action supports [Trivy templates][trivy-templates]. 329 | 330 | Use `template` input to specify path (remember to prefix the path with `@`) to template file. 331 | 332 | ```yaml 333 | name: build 334 | on: 335 | push: 336 | branches: 337 | - main 338 | pull_request: 339 | jobs: 340 | build: 341 | name: Build 342 | runs-on: ubuntu-24.04 343 | steps: 344 | - name: Checkout code 345 | uses: actions/checkout@v3 346 | 347 | - name: Run Trivy vulnerability scanner 348 | uses: aquasecurity/trivy-action@0.28.0 349 | with: 350 | scan-type: "fs" 351 | scan-ref: . 352 | format: 'template' 353 | template: "@path/to/my_template.tpl" 354 | ``` 355 | 356 | #### Default templates 357 | Trivy has [default templates][trivy-default-templates]. 358 | 359 | By default, `setup-trivy` installs them into the `$HOME/.local/bin/trivy-bin/contrib` directory. 360 | 361 | ```yaml 362 | name: build 363 | on: 364 | push: 365 | branches: 366 | - main 367 | pull_request: 368 | jobs: 369 | build: 370 | name: Build 371 | runs-on: ubuntu-24.04 372 | steps: 373 | - name: Checkout code 374 | uses: actions/checkout@v3 375 | 376 | - name: Run Trivy vulnerability scanner 377 | uses: aquasecurity/trivy-action@0.28.0 378 | with: 379 | scan-type: "fs" 380 | scan-ref: . 381 | format: 'template' 382 | template: "@$HOME/.local/bin/trivy-bin/contrib/html.tpl" 383 | ``` 384 | 385 | ### Using Trivy with GitHub Code Scanning 386 | If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows: 387 | ```yaml 388 | name: build 389 | on: 390 | push: 391 | branches: 392 | - main 393 | pull_request: 394 | jobs: 395 | build: 396 | name: Build 397 | runs-on: ubuntu-24.04 398 | steps: 399 | - name: Checkout code 400 | uses: actions/checkout@v4 401 | 402 | - name: Build an image from Dockerfile 403 | run: | 404 | docker build -t docker.io/my-organization/my-app:${{ github.sha }} . 405 | 406 | - name: Run Trivy vulnerability scanner 407 | uses: aquasecurity/trivy-action@0.28.0 408 | with: 409 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 410 | format: 'sarif' 411 | output: 'trivy-results.sarif' 412 | 413 | - name: Upload Trivy scan results to GitHub Security tab 414 | uses: github/codeql-action/upload-sarif@v3 415 | with: 416 | sarif_file: 'trivy-results.sarif' 417 | ``` 418 | 419 | You can find a more in-depth example here: https://github.com/aquasecurity/trivy-sarif-demo/blob/master/.github/workflows/scan.yml 420 | 421 | If you would like to upload SARIF results to GitHub Code scanning even upon a non zero exit code from Trivy Scan, you can add the following to your upload step: 422 | ```yaml 423 | name: build 424 | on: 425 | push: 426 | branches: 427 | - main 428 | pull_request: 429 | jobs: 430 | build: 431 | name: Build 432 | runs-on: ubuntu-24.04 433 | steps: 434 | - name: Checkout code 435 | uses: actions/checkout@v4 436 | 437 | - name: Build an image from Dockerfile 438 | run: | 439 | docker build -t docker.io/my-organization/my-app:${{ github.sha }} . 440 | 441 | - name: Run Trivy vulnerability scanner 442 | uses: aquasecurity/trivy-action@0.28.0 443 | with: 444 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 445 | format: 'sarif' 446 | output: 'trivy-results.sarif' 447 | 448 | - name: Upload Trivy scan results to GitHub Security tab 449 | uses: github/codeql-action/upload-sarif@v3 450 | if: always() 451 | with: 452 | sarif_file: 'trivy-results.sarif' 453 | ``` 454 | 455 | See this for more details: https://docs.github.com/en/actions/learn-github-actions/expressions#always 456 | 457 | ### Using Trivy to scan your Git repo 458 | It's also possible to scan your git repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR. 459 | 460 | If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows: 461 | ```yaml 462 | name: build 463 | on: 464 | push: 465 | branches: 466 | - main 467 | pull_request: 468 | jobs: 469 | build: 470 | name: Build 471 | runs-on: ubuntu-24.04 472 | steps: 473 | - name: Checkout code 474 | uses: actions/checkout@v4 475 | 476 | - name: Run Trivy vulnerability scanner in repo mode 477 | uses: aquasecurity/trivy-action@0.28.0 478 | with: 479 | scan-type: 'fs' 480 | ignore-unfixed: true 481 | format: 'sarif' 482 | output: 'trivy-results.sarif' 483 | severity: 'CRITICAL' 484 | 485 | - name: Upload Trivy scan results to GitHub Security tab 486 | uses: github/codeql-action/upload-sarif@v3 487 | with: 488 | sarif_file: 'trivy-results.sarif' 489 | ``` 490 | 491 | ### Using Trivy to scan your rootfs directories 492 | It's also possible to scan your rootfs directories with Trivy's built-in rootfs scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR. 493 | 494 | If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows: 495 | ```yaml 496 | name: build 497 | on: 498 | push: 499 | branches: 500 | - main 501 | pull_request: 502 | jobs: 503 | build: 504 | name: Build 505 | runs-on: ubuntu-24.04 506 | steps: 507 | - name: Checkout code 508 | uses: actions/checkout@v4 509 | 510 | - name: Run Trivy vulnerability scanner with rootfs command 511 | uses: aquasecurity/trivy-action@0.28.0 512 | with: 513 | scan-type: 'rootfs' 514 | scan-ref: 'rootfs-example-binary' 515 | ignore-unfixed: true 516 | format: 'sarif' 517 | output: 'trivy-results.sarif' 518 | severity: 'CRITICAL' 519 | 520 | - name: Upload Trivy scan results to GitHub Security tab 521 | uses: github/codeql-action/upload-sarif@v3 522 | with: 523 | sarif_file: 'trivy-results.sarif' 524 | ``` 525 | 526 | ### Using Trivy to scan Infrastructure as Code 527 | It's also possible to scan your IaC repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR. 528 | 529 | If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows: 530 | ```yaml 531 | name: build 532 | on: 533 | push: 534 | branches: 535 | - main 536 | pull_request: 537 | jobs: 538 | build: 539 | name: Build 540 | runs-on: ubuntu-24.04 541 | steps: 542 | - name: Checkout code 543 | uses: actions/checkout@v4 544 | 545 | - name: Run Trivy vulnerability scanner in IaC mode 546 | uses: aquasecurity/trivy-action@0.28.0 547 | with: 548 | scan-type: 'config' 549 | hide-progress: true 550 | format: 'sarif' 551 | output: 'trivy-results.sarif' 552 | exit-code: '1' 553 | severity: 'CRITICAL,HIGH' 554 | 555 | - name: Upload Trivy scan results to GitHub Security tab 556 | uses: github/codeql-action/upload-sarif@v3 557 | with: 558 | sarif_file: 'trivy-results.sarif' 559 | ``` 560 | 561 | ### Using Trivy to generate SBOM 562 | It's possible for Trivy to generate an [SBOM](https://www.aquasec.com/cloud-native-academy/supply-chain-security/sbom/) of your dependencies and submit them to a consumer like [GitHub Dependency Graph](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph). 563 | 564 | The [sending of an SBOM to GitHub](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api) feature is only available if you currently have GitHub Dependency Graph [enabled in your repo](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph#enabling-and-disabling-the-dependency-graph-for-a-private-repository). 565 | 566 | In order to send results to GitHub Dependency Graph, you will need to create a [GitHub PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) or use the [GitHub installation access token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) (also known as `GITHUB_TOKEN`): 567 | 568 | ```yaml 569 | --- 570 | name: Generate SBOM 571 | on: 572 | push: 573 | branches: 574 | - main 575 | 576 | ## GITHUB_TOKEN authentication, add only if you're not going to use a PAT 577 | permissions: 578 | contents: write 579 | 580 | jobs: 581 | generate-sbom: 582 | runs-on: ubuntu-latest 583 | steps: 584 | - name: Checkout code 585 | uses: actions/checkout@v4 586 | 587 | - name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph 588 | uses: aquasecurity/trivy-action@0.28.0 589 | with: 590 | scan-type: 'fs' 591 | format: 'github' 592 | output: 'dependency-results.sbom.json' 593 | image-ref: '.' 594 | github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT 595 | ``` 596 | 597 | When scanning images you may want to parse the actual output JSON as Github Dependency doesn't show all details like the file path of each dependency for instance. 598 | 599 | You can upload the report as an artifact and download it, for instance using the [upload-artifact action](https://github.com/actions/upload-artifact): 600 | 601 | ```yaml 602 | --- 603 | name: Generate SBOM 604 | on: 605 | push: 606 | branches: 607 | - main 608 | 609 | ## GITHUB_TOKEN authentication, add only if you're not going to use a PAT 610 | permissions: 611 | contents: write 612 | 613 | jobs: 614 | generate-sbom: 615 | runs-on: ubuntu-latest 616 | steps: 617 | - name: Scan image in a private registry 618 | uses: aquasecurity/trivy-action@0.28.0 619 | with: 620 | image-ref: "private_image_registry/image_name:image_tag" 621 | scan-type: image 622 | format: 'github' 623 | output: 'dependency-results.sbom.json' 624 | github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT 625 | severity: "MEDIUM,HIGH,CRITICAL" 626 | scanners: "vuln" 627 | env: 628 | TRIVY_USERNAME: "image_registry_admin_username" 629 | TRIVY_PASSWORD: "image_registry_admin_password" 630 | 631 | - name: Upload trivy report as a Github artifact 632 | uses: actions/upload-artifact@v4 633 | with: 634 | name: trivy-sbom-report 635 | path: '${{ github.workspace }}/dependency-results.sbom.json' 636 | retention-days: 20 # 90 is the default 637 | ``` 638 | 639 | ### Using Trivy to scan your private registry 640 | It's also possible to scan your private registry with Trivy's built-in image scan. All you have to do is set ENV vars. 641 | 642 | #### Docker Hub registry 643 | Docker Hub needs `TRIVY_USERNAME` and `TRIVY_PASSWORD`. 644 | You don't need to set ENV vars when downloading from a public repository. 645 | ```yaml 646 | name: build 647 | on: 648 | push: 649 | branches: 650 | - main 651 | pull_request: 652 | jobs: 653 | build: 654 | name: Build 655 | runs-on: ubuntu-24.04 656 | steps: 657 | - name: Checkout code 658 | uses: actions/checkout@v4 659 | 660 | - name: Run Trivy vulnerability scanner 661 | uses: aquasecurity/trivy-action@0.28.0 662 | with: 663 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 664 | format: 'sarif' 665 | output: 'trivy-results.sarif' 666 | env: 667 | TRIVY_USERNAME: Username 668 | TRIVY_PASSWORD: Password 669 | 670 | - name: Upload Trivy scan results to GitHub Security tab 671 | uses: github/codeql-action/upload-sarif@v3 672 | with: 673 | sarif_file: 'trivy-results.sarif' 674 | ``` 675 | 676 | #### AWS ECR (Elastic Container Registry) 677 | Trivy uses AWS SDK. You don't need to install `aws` CLI tool. 678 | You can use [AWS CLI's ENV Vars][env-var]. 679 | 680 | [env-var]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html 681 | ```yaml 682 | name: build 683 | on: 684 | push: 685 | branches: 686 | - main 687 | pull_request: 688 | jobs: 689 | build: 690 | name: Build 691 | runs-on: ubuntu-24.04 692 | steps: 693 | - name: Checkout code 694 | uses: actions/checkout@v4 695 | 696 | - name: Run Trivy vulnerability scanner 697 | uses: aquasecurity/trivy-action@0.28.0 698 | with: 699 | image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}' 700 | format: 'sarif' 701 | output: 'trivy-results.sarif' 702 | env: 703 | AWS_ACCESS_KEY_ID: key_id 704 | AWS_SECRET_ACCESS_KEY: access_key 705 | AWS_DEFAULT_REGION: us-west-2 706 | 707 | - name: Upload Trivy scan results to GitHub Security tab 708 | uses: github/codeql-action/upload-sarif@v3 709 | with: 710 | sarif_file: 'trivy-results.sarif' 711 | ``` 712 | 713 | #### GCR (Google Container Registry) 714 | Trivy uses Google Cloud SDK. You don't need to install `gcloud` command. 715 | 716 | If you want to use target project's repository, you can set it via `GOOGLE_APPLICATION_CREDENTIAL`. 717 | ```yaml 718 | name: build 719 | on: 720 | push: 721 | branches: 722 | - main 723 | pull_request: 724 | jobs: 725 | build: 726 | name: Build 727 | runs-on: ubuntu-24.04 728 | steps: 729 | - name: Checkout code 730 | uses: actions/checkout@v4 731 | 732 | - name: Run Trivy vulnerability scanner 733 | uses: aquasecurity/trivy-action@0.28.0 734 | with: 735 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 736 | format: 'sarif' 737 | output: 'trivy-results.sarif' 738 | env: 739 | GOOGLE_APPLICATION_CREDENTIAL: /path/to/credential.json 740 | 741 | - name: Upload Trivy scan results to GitHub Security tab 742 | uses: github/codeql-action/upload-sarif@v3 743 | with: 744 | sarif_file: 'trivy-results.sarif' 745 | ``` 746 | 747 | #### Self-Hosted 748 | BasicAuth server needs `TRIVY_USERNAME` and `TRIVY_PASSWORD`. 749 | if you want to use 80 port, use NonSSL `TRIVY_NON_SSL=true` 750 | ```yaml 751 | name: build 752 | on: 753 | push: 754 | branches: 755 | - main 756 | pull_request: 757 | jobs: 758 | build: 759 | name: Build 760 | runs-on: ubuntu-24.04 761 | steps: 762 | - name: Checkout code 763 | uses: actions/checkout@v4 764 | 765 | - name: Run Trivy vulnerability scanner 766 | uses: aquasecurity/trivy-action@0.28.0 767 | with: 768 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 769 | format: 'sarif' 770 | output: 'trivy-results.sarif' 771 | env: 772 | TRIVY_USERNAME: Username 773 | TRIVY_PASSWORD: Password 774 | 775 | - name: Upload Trivy scan results to GitHub Security tab 776 | uses: github/codeql-action/upload-sarif@v3 777 | with: 778 | sarif_file: 'trivy-results.sarif' 779 | ``` 780 | 781 | ### Using Trivy if you don't have code scanning enabled 782 | 783 | It's also possible to browse a scan result in a workflow summary. 784 | 785 | This step is especially useful for private repositories without [GitHub Advanced Security](https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security) license. 786 | 787 | ```yaml 788 | - name: Run Trivy scanner 789 | uses: aquasecurity/trivy-action@0.28.0 790 | with: 791 | scan-type: config 792 | hide-progress: true 793 | output: trivy.txt 794 | 795 | - name: Publish Trivy Output to Summary 796 | run: | 797 | if [[ -s trivy.txt ]]; then 798 | { 799 | echo "### Security Output" 800 | echo "
Click to expand" 801 | echo "" 802 | echo '```terraform' 803 | cat trivy.txt 804 | echo '```' 805 | echo "
" 806 | } >> $GITHUB_STEP_SUMMARY 807 | fi 808 | ``` 809 | 810 | ## Customizing 811 | 812 | Configuration priority: 813 | - [Inputs](#inputs) 814 | - [Environment variables](#environment-variables) 815 | - [Trivy config file](#trivy-config-file) 816 | - Default values 817 | 818 | 819 | ### inputs 820 | 821 | Following inputs can be used as `step.with` keys: 822 | 823 | | Name | Type | Default | Description | 824 | |------------------------------|---------|------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| 825 | | `scan-type` | String | `image` | Scan type, e.g. `image` or `fs` | 826 | | `input` | String | | Tar reference, e.g. `alpine-latest.tar` | 827 | | `image-ref` | String | | Image reference, e.g. `alpine:3.10.2` | 828 | | `scan-ref` | String | `/github/workspace/` | Scan reference, e.g. `/github/workspace/` or `.` | 829 | | `format` | String | `table` | Output format (`table`, `json`, `template`, `sarif`, `cyclonedx`, `spdx`, `spdx-json`, `github`, `cosign-vuln`) | 830 | | `template` | String | | Output template (`@$HOME/.local/bin/trivy-bin/contrib/gitlab.tpl`, `@$HOME/.local/bin/trivy-bin/contrib/junit.tpl`) | 831 | | `tf-vars` | String | | path to Terraform variables file | 832 | | `output` | String | | Save results to a file | 833 | | `exit-code` | String | `0` | Exit code when specified vulnerabilities are found | 834 | | `ignore-unfixed` | Boolean | false | Ignore unpatched/unfixed vulnerabilities | 835 | | `vuln-type` | String | `os,library` | Vulnerability types (os,library) | 836 | | `severity` | String | `UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL` | Severities of vulnerabilities to scanned for and displayed | 837 | | `skip-dirs` | String | | Comma separated list of directories where traversal is skipped | 838 | | `skip-files` | String | | Comma separated list of files where traversal is skipped | 839 | | `cache-dir` | String | `$GITHUB_WORKSPACE/.cache/trivy` | Cache directory. NOTE: This value cannot be configured by `trivy.yaml`. | 840 | | `timeout` | String | `5m0s` | Scan timeout duration | 841 | | `ignore-policy` | String | | Filter vulnerabilities with OPA rego language | 842 | | `hide-progress` | String | `false` | Suppress progress bar and log output | 843 | | `list-all-pkgs` | String | | Output all packages regardless of vulnerability | 844 | | `scanners` | String | `vuln,secret` | comma-separated list of what security issues to detect (`vuln`,`secret`,`misconfig`,`license`) | 845 | | `trivyignores` | String | | comma-separated list of relative paths in repository to one or more `.trivyignore` files | 846 | | `trivy-config` | String | | Path to trivy.yaml config | 847 | | `github-pat` | String | | Authentication token to enable sending SBOM scan results to GitHub Dependency Graph. Can be either a GitHub Personal Access Token (PAT) or GITHUB_TOKEN | 848 | | `limit-severities-for-sarif` | Boolean | false | By default *SARIF* format enforces output of all vulnerabilities regardless of configured severities. To override this behavior set this parameter to **true** | 849 | | `docker-host` | String | | By default it is set to `unix://var/run/docker.sock`, but can be updated to help with containerized infrastructure values (`unix:/` or other prefix is required) | 850 | | `version` | String | `v0.63.0` | Trivy version to use, e.g. `latest` or `v0.63.0` | 851 | | `skip-setup-trivy` | Boolean | false | Skip calling the `setup-trivy` action to install `trivy` | 852 | | `token-setup-trivy` | Boolean | | Overwrite `github.token` used by `setup-trivy` to checkout the `trivy` repository | 853 | 854 | ### Environment variables 855 | You can use [Trivy environment variables][trivy-env] to set the necessary options (including flags that are not supported by [Inputs](#inputs), such as `--secret-config`). 856 | 857 | **NB** In some older versions of the Action there was a bug that caused inputs from one call to the Action to leak 858 | over to subsequent calls to the Action. This could cause workflows that call the Action multiple times e.g. to run 859 | multiple scans, or the same scans with different output formats, to not produce the desired output. You can see if this 860 | is the case by looking at the GitHub Actions step information, if the `env` section shown in your Actions output 861 | contains `TRIVY_*` environment variables you did not explicitly set then you may be affected by this bug and should 862 | upgrade to the latest Action version. 863 | 864 | ### Trivy config file 865 | When using the `trivy-config` [Input](#inputs), you can set options using the [Trivy config file][trivy-config] (including flags that are not supported by [Inputs](#inputs), such as `--secret-config`). 866 | 867 | [release]: https://github.com/aquasecurity/trivy-action/releases/latest 868 | [release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github 869 | [marketplace]: https://github.com/marketplace/actions/aqua-security-trivy 870 | [marketplace-img]: https://img.shields.io/badge/marketplace-trivy--action-blue?logo=github 871 | [license]: https://github.com/aquasecurity/trivy-action/blob/master/LICENSE 872 | [license-img]: https://img.shields.io/github/license/aquasecurity/trivy-action 873 | [trivy-env]: https://aquasecurity.github.io/trivy/latest/docs/configuration/#environment-variables 874 | [trivy-config]: https://aquasecurity.github.io/trivy/latest/docs/references/configuration/config-file/ 875 | [trivy-templates]: https://aquasecurity.github.io/trivy/latest/docs/configuration/reporting/#template 876 | [trivy-default-templates]: https://aquasecurity.github.io/trivy/latest/docs/configuration/reporting/#default-templates 877 | -------------------------------------------------------------------------------- /action.yaml: -------------------------------------------------------------------------------- 1 | name: 'Aqua Security Trivy' 2 | description: 'Scans container images for vulnerabilities with Trivy' 3 | author: 'Aqua Security' 4 | 5 | inputs: 6 | scan-type: 7 | description: 'Scan type to use for scanning vulnerability' 8 | required: false 9 | default: 'image' 10 | image-ref: 11 | description: 'image reference (for backward compatibility)' 12 | required: false 13 | input: 14 | description: 'reference of tar file to scan' 15 | required: false 16 | default: '' 17 | scan-ref: 18 | description: 'Scan reference' 19 | required: false 20 | default: '.' 21 | exit-code: 22 | description: 'exit code when vulnerabilities were found' 23 | required: false 24 | ignore-unfixed: 25 | description: 'ignore unfixed vulnerabilities' 26 | required: false 27 | default: 'false' 28 | vuln-type: # TODO: rename to pkg-types 29 | description: 'comma-separated list of vulnerability types (os,library)' 30 | required: false 31 | default: 'os,library' 32 | severity: 33 | description: 'severities of vulnerabilities to be displayed' 34 | required: false 35 | default: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL' 36 | format: 37 | description: 'output format (table, json, template)' 38 | required: false 39 | default: 'table' 40 | template: 41 | description: 'use an existing template for rendering output (@/contrib/gitlab.tpl, @/contrib/junit.tpl, @/contrib/html.tpl)' 42 | required: false 43 | default: '' 44 | output: 45 | description: 'writes results to a file with the specified file name' 46 | required: false 47 | default: '' 48 | skip-dirs: 49 | description: 'comma separated list of directories where traversal is skipped' 50 | required: false 51 | default: '' 52 | skip-files: 53 | description: 'comma separated list of files to be skipped' 54 | required: false 55 | default: '' 56 | cache-dir: 57 | description: 'specify where the cache is stored' 58 | required: false 59 | default: '${{ github.workspace }}/.cache/trivy' 60 | timeout: 61 | description: 'timeout (default 5m0s)' 62 | required: false 63 | default: '' 64 | ignore-policy: 65 | description: 'filter vulnerabilities with OPA rego language' 66 | required: false 67 | default: '' 68 | hide-progress: 69 | description: 'suppress progress bar and log output' 70 | required: false 71 | list-all-pkgs: 72 | description: 'output all packages regardless of vulnerability' 73 | required: false 74 | default: 'false' 75 | scanners: 76 | description: 'comma-separated list of what security issues to detect' 77 | required: false 78 | default: '' 79 | trivyignores: 80 | description: 'comma-separated list of relative paths in repository to one or more .trivyignore files' 81 | required: false 82 | default: '' 83 | github-pat: 84 | description: 'GitHub Personal Access Token (PAT) for submitting SBOM to GitHub Dependency Snapshot API' 85 | required: false 86 | trivy-config: 87 | description: 'path to trivy.yaml config' 88 | required: false 89 | tf-vars: 90 | description: "path to terraform tfvars file" 91 | required: false 92 | limit-severities-for-sarif: 93 | description: 'limit severities for SARIF format' 94 | required: false 95 | docker-host: 96 | description: 'unix domain socket path to use for docker scanning, ex. unix:///var/run/docker.sock' 97 | required: false 98 | version: 99 | description: 'Trivy version to use' 100 | required: false 101 | default: 'v0.63.0' 102 | cache: 103 | description: 'Used to specify whether caching is needed. Set to false, if you would like to disable caching.' 104 | required: false 105 | default: 'true' 106 | skip-setup-trivy: 107 | description: 'skip calling the setup-trivy action to install trivy' 108 | required: false 109 | default: 'false' 110 | token-setup-trivy: 111 | description: > 112 | `token-setup-trivy` is required when `github.token` in invalid for `https://github.com` server. 113 | See https://github.com/aquasecurity/setup-trivy/?tab=readme-ov-file#install-trivy-with-non-default-token for more details. 114 | `token-setup-trivy` is only used to fetch the Trivy repository in `setup-trivy` 115 | required: false 116 | ## ${{ github.token }} is default value for actions/checkout 117 | ## cf. https://github.com/actions/checkout/blob/eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871/action.yml#L24 118 | default: ${{ github.token }} 119 | 120 | runs: 121 | using: 'composite' 122 | steps: 123 | - name: Install Trivy 124 | if: ${{ inputs.skip-setup-trivy == 'false' }} 125 | # Pin to hash instead of tag for aquasecurity/setup-trivy action so that GitHub Actions 126 | # "allowing select actions" feature can be used to whitelist the dependent action by a hash. 127 | # This is needed since some organizations have a policy to only allow pinned 3rd party actions to 128 | # be used. 129 | uses: aquasecurity/setup-trivy@ff1b8b060f23b650436d419b5e13f67f5d4c3087 # equivalent to `v0.2.2` 130 | with: 131 | version: ${{ inputs.version }} 132 | cache: ${{ inputs.cache }} 133 | token: ${{ inputs.token-setup-trivy }} 134 | 135 | - name: Get current date 136 | id: date 137 | shell: bash 138 | run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT 139 | 140 | - name: Restore DB from cache 141 | if: ${{ inputs.cache == 'true' }} 142 | uses: actions/cache@v4 143 | with: 144 | path: ${{ inputs.cache-dir }} 145 | key: cache-trivy-${{ steps.date.outputs.date }} 146 | restore-keys: cache-trivy- 147 | 148 | - name: Set GitHub Path 149 | run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH 150 | shell: bash 151 | env: 152 | GITHUB_ACTION_PATH: ${{ github.action_path }} 153 | 154 | # Create and Clear Trivy Envs file 155 | # See #422 for context 156 | - name: Clear Trivy Envs file 157 | shell: bash 158 | run: | 159 | rm -f trivy_envs.txt 160 | touch trivy_envs.txt 161 | 162 | - name: Set Trivy environment variables 163 | shell: bash 164 | run: | 165 | # Note: There is currently no way to distinguish between undefined variables and empty strings in GitHub Actions. 166 | # This limitation affects how we handle default values and empty inputs. 167 | # For more information, see: https://github.com/actions/runner/issues/924 168 | 169 | # The following logic implements the configuration priority described in the README: 170 | # 171 | # Inputs 172 | # Environment Variables 173 | # Config File 174 | # Defaults 175 | # 176 | # As noted above defaults are awkward to handle as GitHub Actions will inject those values as the input 177 | # if the caller doesn't provide them, thus if the input matches the default we don't set it as we 178 | # can't tell the difference. Plus if we did set it when it was the default value then it could potentially 179 | # override an external environment variable, or something in the callers configuration file, which then wouldn't 180 | # match the configuration priority that is documented. 181 | set_env_var_if_provided() { 182 | local var_name="$1" 183 | local input_value="$2" 184 | local default_value="$3" 185 | 186 | if [ ! -z "$input_value" ] && [ "$input_value" != "$default_value" ]; then 187 | # If action was provided with explicit input by the caller set that 188 | echo "export $var_name=$input_value" >> trivy_envs.txt 189 | fi 190 | } 191 | 192 | # Set environment variables, handling those with default values 193 | # cf. https://aquasecurity.github.io/trivy/latest/docs/configuration/#environment-variables 194 | set_env_var_if_provided "TRIVY_INPUT" "${{ inputs.input }}" "" 195 | set_env_var_if_provided "TRIVY_EXIT_CODE" "${{ inputs.exit-code }}" "" 196 | set_env_var_if_provided "TRIVY_IGNORE_UNFIXED" "${{ inputs.ignore-unfixed }}" "false" 197 | set_env_var_if_provided "TRIVY_PKG_TYPES" "${{ inputs.vuln-type }}" "os,library" 198 | set_env_var_if_provided "TRIVY_SEVERITY" "${{ inputs.severity }}" "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" 199 | set_env_var_if_provided "TRIVY_FORMAT" "${{ inputs.format }}" "table" 200 | set_env_var_if_provided "TRIVY_TEMPLATE" "${{ inputs.template }}" "" 201 | set_env_var_if_provided "TRIVY_OUTPUT" "${{ inputs.output }}" "" 202 | set_env_var_if_provided "TRIVY_SKIP_DIRS" "${{ inputs.skip-dirs }}" "" 203 | set_env_var_if_provided "TRIVY_SKIP_FILES" "${{ inputs.skip-files }}" "" 204 | set_env_var_if_provided "TRIVY_TIMEOUT" "${{ inputs.timeout }}" "" 205 | set_env_var_if_provided "TRIVY_IGNORE_POLICY" "${{ inputs.ignore-policy }}" "" 206 | set_env_var_if_provided "TRIVY_QUIET" "${{ inputs.hide-progress }}" "" 207 | set_env_var_if_provided "TRIVY_LIST_ALL_PKGS" "${{ inputs.list-all-pkgs }}" "false" 208 | set_env_var_if_provided "TRIVY_SCANNERS" "${{ inputs.scanners }}" "" 209 | set_env_var_if_provided "TRIVY_CONFIG" "${{ inputs.trivy-config }}" "" 210 | set_env_var_if_provided "TRIVY_TF_VARS" "${{ inputs.tf-vars }}" "" 211 | set_env_var_if_provided "TRIVY_DOCKER_HOST" "${{ inputs.docker-host }}" "" 212 | 213 | - name: Run Trivy 214 | shell: bash 215 | run: entrypoint.sh 216 | env: 217 | # For shell script 218 | # > If the action is written using a composite, then it will not automatically get INPUT_ 219 | # cf. https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs 220 | INPUT_SCAN_TYPE: ${{ inputs.scan-type }} 221 | INPUT_IMAGE_REF: ${{ inputs.image-ref }} 222 | INPUT_SCAN_REF: ${{ inputs.scan-ref }} 223 | INPUT_TRIVYIGNORES: ${{ inputs.trivyignores }} 224 | INPUT_GITHUB_PAT: ${{ inputs.github-pat }} 225 | INPUT_LIMIT_SEVERITIES_FOR_SARIF: ${{ inputs.limit-severities-for-sarif }} 226 | 227 | # For Trivy 228 | TRIVY_CACHE_DIR: ${{ inputs.cache-dir }} # Always set 229 | 230 | # Remove Trivy envs to keep envs within this action and avoid env leaks 231 | # See #422 for context 232 | - name: Remove Trivy Envs file 233 | if: ${{ always() }} 234 | shell: bash 235 | run: | 236 | rm -f trivy_envs.txt 237 | -------------------------------------------------------------------------------- /docs/images/trivy-action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquasecurity/trivy-action/76071ef0d7ec797419534a183b498b4d6366cf37/docs/images/trivy-action.png -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | # Read TRIVY_* envs from file, previously they were written to the GITHUB_ENV file but GitHub Actions automatically 5 | # injects those into subsequent job steps which means inputs from one trivy-action invocation were leaking over to 6 | # any subsequent invocation which led to unexpected/undesireable behaviour from a user perspective 7 | # See #422 for more context around this 8 | if [ -f ./trivy_envs.txt ]; then 9 | source ./trivy_envs.txt 10 | fi 11 | 12 | # Set artifact reference 13 | scanType="${INPUT_SCAN_TYPE:-image}" 14 | scanRef="${INPUT_SCAN_REF:-.}" 15 | if [ -n "${INPUT_IMAGE_REF:-}" ]; then 16 | scanRef="${INPUT_IMAGE_REF}" # backwards compatibility 17 | fi 18 | 19 | # Handle trivy ignores 20 | if [ -n "${INPUT_TRIVYIGNORES:-}" ]; then 21 | ignorefile="./trivyignores" 22 | 23 | # Clear the ignore file if it exists, or create a new empty file 24 | : > "$ignorefile" 25 | 26 | for f in ${INPUT_TRIVYIGNORES//,/ }; do 27 | if [ -f "$f" ]; then 28 | echo "Found ignorefile '${f}':" 29 | cat "${f}" 30 | cat "${f}" >> "$ignorefile" 31 | else 32 | echo "ERROR: cannot find ignorefile '${f}'." >&2 33 | exit 1 34 | fi 35 | done 36 | export TRIVY_IGNOREFILE="$ignorefile" 37 | fi 38 | 39 | # Handle SARIF 40 | if [ "${TRIVY_FORMAT:-}" = "sarif" ]; then 41 | if [ "${INPUT_LIMIT_SEVERITIES_FOR_SARIF:-false,,}" != "true" ]; then 42 | echo "Building SARIF report with all severities" 43 | unset TRIVY_SEVERITY 44 | else 45 | echo "Building SARIF report" 46 | fi 47 | fi 48 | 49 | # Run Trivy 50 | cmd=(trivy "$scanType" "$scanRef") 51 | echo "Running Trivy with options: ${cmd[*]}" 52 | "${cmd[@]}" 53 | returnCode=$? 54 | 55 | if [ "${TRIVY_FORMAT:-}" = "github" ]; then 56 | if [ -n "${INPUT_GITHUB_PAT:-}" ]; then 57 | printf "\n Uploading GitHub Dependency Snapshot" 58 | curl -H 'Accept: application/vnd.github+json' -H "Authorization: token ${INPUT_GITHUB_PAT}" \ 59 | "https://api.github.com/repos/$GITHUB_REPOSITORY/dependency-graph/snapshots" -d @"${TRIVY_OUTPUT:-}" 60 | else 61 | printf "\n Failing GitHub Dependency Snapshot. Missing github-pat" >&2 62 | fi 63 | fi 64 | 65 | exit $returnCode 66 | -------------------------------------------------------------------------------- /test/data/config-sarif-report/main.tf: -------------------------------------------------------------------------------- 1 | # test data for trivy config with terraform variables 2 | 3 | variable "bucket_versioning_enabled" { 4 | type = string 5 | default = "Disabled" 6 | } 7 | 8 | resource "aws_s3_bucket" "bucket" { 9 | bucket = "trivy-action-bucket" 10 | } 11 | 12 | resource "aws_s3_bucket_versioning" "bucket_versioning" { 13 | bucket = aws_s3_bucket.bucket.id 14 | 15 | versioning_configuration { 16 | status = var.bucket_versioning_enabled 17 | } 18 | } -------------------------------------------------------------------------------- /test/data/config-sarif-report/report.sarif: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.1.0", 3 | "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json", 4 | "runs": [ 5 | { 6 | "tool": { 7 | "driver": { 8 | "fullName": "Trivy Vulnerability Scanner", 9 | "informationUri": "https://github.com/aquasecurity/trivy", 10 | "name": "Trivy", 11 | "rules": [ 12 | { 13 | "id": "AVD-AWS-0086", 14 | "name": "Misconfiguration", 15 | "shortDescription": { 16 | "text": "S3 Access block should block public ACL" 17 | }, 18 | "fullDescription": { 19 | "text": "S3 buckets should block public ACLs on buckets and any objects they contain. By blocking, PUTs with fail if the object has any public ACL a.\n" 20 | }, 21 | "defaultConfiguration": { 22 | "level": "error" 23 | }, 24 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0086", 25 | "help": { 26 | "text": "Misconfiguration AVD-AWS-0086\nType: Terraform Security Check\nSeverity: HIGH\nCheck: S3 Access block should block public ACL\nMessage: No public access block so not blocking public acls\nLink: [AVD-AWS-0086](https://avd.aquasec.com/misconfig/avd-aws-0086)\nS3 buckets should block public ACLs on buckets and any objects they contain. By blocking, PUTs with fail if the object has any public ACL a.\n", 27 | "markdown": "**Misconfiguration AVD-AWS-0086**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|HIGH|S3 Access block should block public ACL|No public access block so not blocking public acls|[AVD-AWS-0086](https://avd.aquasec.com/misconfig/avd-aws-0086)|\n\nS3 buckets should block public ACLs on buckets and any objects they contain. By blocking, PUTs with fail if the object has any public ACL a.\n" 28 | }, 29 | "properties": { 30 | "precision": "very-high", 31 | "security-severity": "8.0", 32 | "tags": [ 33 | "misconfiguration", 34 | "security", 35 | "HIGH" 36 | ] 37 | } 38 | }, 39 | { 40 | "id": "AVD-AWS-0087", 41 | "name": "Misconfiguration", 42 | "shortDescription": { 43 | "text": "S3 Access block should block public policy" 44 | }, 45 | "fullDescription": { 46 | "text": "S3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n" 47 | }, 48 | "defaultConfiguration": { 49 | "level": "error" 50 | }, 51 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0087", 52 | "help": { 53 | "text": "Misconfiguration AVD-AWS-0087\nType: Terraform Security Check\nSeverity: HIGH\nCheck: S3 Access block should block public policy\nMessage: No public access block so not blocking public policies\nLink: [AVD-AWS-0087](https://avd.aquasec.com/misconfig/avd-aws-0087)\nS3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n", 54 | "markdown": "**Misconfiguration AVD-AWS-0087**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|HIGH|S3 Access block should block public policy|No public access block so not blocking public policies|[AVD-AWS-0087](https://avd.aquasec.com/misconfig/avd-aws-0087)|\n\nS3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n" 55 | }, 56 | "properties": { 57 | "precision": "very-high", 58 | "security-severity": "8.0", 59 | "tags": [ 60 | "misconfiguration", 61 | "security", 62 | "HIGH" 63 | ] 64 | } 65 | }, 66 | { 67 | "id": "AVD-AWS-0088", 68 | "name": "Misconfiguration", 69 | "shortDescription": { 70 | "text": "Unencrypted S3 bucket." 71 | }, 72 | "fullDescription": { 73 | "text": "S3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.\n" 74 | }, 75 | "defaultConfiguration": { 76 | "level": "error" 77 | }, 78 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0088", 79 | "help": { 80 | "text": "Misconfiguration AVD-AWS-0088\nType: Terraform Security Check\nSeverity: HIGH\nCheck: Unencrypted S3 bucket.\nMessage: Bucket does not have encryption enabled\nLink: [AVD-AWS-0088](https://avd.aquasec.com/misconfig/avd-aws-0088)\nS3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.\n", 81 | "markdown": "**Misconfiguration AVD-AWS-0088**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|HIGH|Unencrypted S3 bucket.|Bucket does not have encryption enabled|[AVD-AWS-0088](https://avd.aquasec.com/misconfig/avd-aws-0088)|\n\nS3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.\n" 82 | }, 83 | "properties": { 84 | "precision": "very-high", 85 | "security-severity": "8.0", 86 | "tags": [ 87 | "misconfiguration", 88 | "security", 89 | "HIGH" 90 | ] 91 | } 92 | }, 93 | { 94 | "id": "s3-bucket-logging", 95 | "name": "Misconfiguration", 96 | "shortDescription": { 97 | "text": "S3 Bucket Logging" 98 | }, 99 | "fullDescription": { 100 | "text": "Ensures S3 bucket logging is enabled for S3 buckets" 101 | }, 102 | "defaultConfiguration": { 103 | "level": "note" 104 | }, 105 | "helpUri": "https://avd.aquasec.com/misconfig/s3-bucket-logging", 106 | "help": { 107 | "text": "Misconfiguration s3-bucket-logging\nType: Terraform Security Check\nSeverity: LOW\nCheck: S3 Bucket Logging\nMessage: Bucket has logging disabled\nLink: [s3-bucket-logging](https://avd.aquasec.com/misconfig/s3-bucket-logging)\nEnsures S3 bucket logging is enabled for S3 buckets", 108 | "markdown": "**Misconfiguration s3-bucket-logging**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|LOW|S3 Bucket Logging|Bucket has logging disabled|[s3-bucket-logging](https://avd.aquasec.com/misconfig/s3-bucket-logging)|\n\nEnsures S3 bucket logging is enabled for S3 buckets" 109 | }, 110 | "properties": { 111 | "precision": "very-high", 112 | "security-severity": "2.0", 113 | "tags": [ 114 | "misconfiguration", 115 | "security", 116 | "LOW" 117 | ] 118 | } 119 | }, 120 | { 121 | "id": "AVD-AWS-0090", 122 | "name": "Misconfiguration", 123 | "shortDescription": { 124 | "text": "S3 Data should be versioned" 125 | }, 126 | "fullDescription": { 127 | "text": "Versioning in Amazon S3 is a means of keeping multiple variants of an object in the same bucket.\n\nYou can use the S3 Versioning feature to preserve, retrieve, and restore every version of every object stored in your buckets.\n\nWith versioning you can recover more easily from both unintended user actions and application failures.\n" 128 | }, 129 | "defaultConfiguration": { 130 | "level": "warning" 131 | }, 132 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0090", 133 | "help": { 134 | "text": "Misconfiguration AVD-AWS-0090\nType: Terraform Security Check\nSeverity: MEDIUM\nCheck: S3 Data should be versioned\nMessage: Bucket does not have versioning enabled\nLink: [AVD-AWS-0090](https://avd.aquasec.com/misconfig/avd-aws-0090)\nVersioning in Amazon S3 is a means of keeping multiple variants of an object in the same bucket.\n\nYou can use the S3 Versioning feature to preserve, retrieve, and restore every version of every object stored in your buckets.\n\nWith versioning you can recover more easily from both unintended user actions and application failures.\n", 135 | "markdown": "**Misconfiguration AVD-AWS-0090**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|MEDIUM|S3 Data should be versioned|Bucket does not have versioning enabled|[AVD-AWS-0090](https://avd.aquasec.com/misconfig/avd-aws-0090)|\n\nVersioning in Amazon S3 is a means of keeping multiple variants of an object in the same bucket.\n\nYou can use the S3 Versioning feature to preserve, retrieve, and restore every version of every object stored in your buckets.\n\nWith versioning you can recover more easily from both unintended user actions and application failures.\n" 136 | }, 137 | "properties": { 138 | "precision": "very-high", 139 | "security-severity": "5.5", 140 | "tags": [ 141 | "misconfiguration", 142 | "security", 143 | "MEDIUM" 144 | ] 145 | } 146 | }, 147 | { 148 | "id": "AVD-AWS-0091", 149 | "name": "Misconfiguration", 150 | "shortDescription": { 151 | "text": "S3 Access Block should Ignore Public Acl" 152 | }, 153 | "fullDescription": { 154 | "text": "S3 buckets should ignore public ACLs on buckets and any objects they contain. By ignoring rather than blocking, PUT calls with public ACLs will still be applied but the ACL will be ignored.\n" 155 | }, 156 | "defaultConfiguration": { 157 | "level": "error" 158 | }, 159 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0091", 160 | "help": { 161 | "text": "Misconfiguration AVD-AWS-0091\nType: Terraform Security Check\nSeverity: HIGH\nCheck: S3 Access Block should Ignore Public Acl\nMessage: No public access block so not blocking public acls\nLink: [AVD-AWS-0091](https://avd.aquasec.com/misconfig/avd-aws-0091)\nS3 buckets should ignore public ACLs on buckets and any objects they contain. By ignoring rather than blocking, PUT calls with public ACLs will still be applied but the ACL will be ignored.\n", 162 | "markdown": "**Misconfiguration AVD-AWS-0091**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|HIGH|S3 Access Block should Ignore Public Acl|No public access block so not blocking public acls|[AVD-AWS-0091](https://avd.aquasec.com/misconfig/avd-aws-0091)|\n\nS3 buckets should ignore public ACLs on buckets and any objects they contain. By ignoring rather than blocking, PUT calls with public ACLs will still be applied but the ACL will be ignored.\n" 163 | }, 164 | "properties": { 165 | "precision": "very-high", 166 | "security-severity": "8.0", 167 | "tags": [ 168 | "misconfiguration", 169 | "security", 170 | "HIGH" 171 | ] 172 | } 173 | }, 174 | { 175 | "id": "AVD-AWS-0093", 176 | "name": "Misconfiguration", 177 | "shortDescription": { 178 | "text": "S3 Access block should restrict public bucket to limit access" 179 | }, 180 | "fullDescription": { 181 | "text": "S3 buckets should restrict public policies for the bucket. By enabling, the restrict_public_buckets, only the bucket owner and AWS Services can access if it has a public policy.\n" 182 | }, 183 | "defaultConfiguration": { 184 | "level": "error" 185 | }, 186 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0093", 187 | "help": { 188 | "text": "Misconfiguration AVD-AWS-0093\nType: Terraform Security Check\nSeverity: HIGH\nCheck: S3 Access block should restrict public bucket to limit access\nMessage: No public access block so not restricting public buckets\nLink: [AVD-AWS-0093](https://avd.aquasec.com/misconfig/avd-aws-0093)\nS3 buckets should restrict public policies for the bucket. By enabling, the restrict_public_buckets, only the bucket owner and AWS Services can access if it has a public policy.\n", 189 | "markdown": "**Misconfiguration AVD-AWS-0093**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|HIGH|S3 Access block should restrict public bucket to limit access|No public access block so not restricting public buckets|[AVD-AWS-0093](https://avd.aquasec.com/misconfig/avd-aws-0093)|\n\nS3 buckets should restrict public policies for the bucket. By enabling, the restrict_public_buckets, only the bucket owner and AWS Services can access if it has a public policy.\n" 190 | }, 191 | "properties": { 192 | "precision": "very-high", 193 | "security-severity": "8.0", 194 | "tags": [ 195 | "misconfiguration", 196 | "security", 197 | "HIGH" 198 | ] 199 | } 200 | }, 201 | { 202 | "id": "AVD-AWS-0094", 203 | "name": "Misconfiguration", 204 | "shortDescription": { 205 | "text": "S3 buckets should each define an aws_s3_bucket_public_access_block" 206 | }, 207 | "fullDescription": { 208 | "text": "The \"block public access\" settings in S3 override individual policies that apply to a given bucket, meaning that all public access can be controlled in one central types for that bucket. It is therefore good practice to define these settings for each bucket in order to clearly define the public access that can be allowed for it.\n" 209 | }, 210 | "defaultConfiguration": { 211 | "level": "note" 212 | }, 213 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0094", 214 | "help": { 215 | "text": "Misconfiguration AVD-AWS-0094\nType: Terraform Security Check\nSeverity: LOW\nCheck: S3 buckets should each define an aws_s3_bucket_public_access_block\nMessage: Bucket does not have a corresponding public access block.\nLink: [AVD-AWS-0094](https://avd.aquasec.com/misconfig/avd-aws-0094)\nThe \"block public access\" settings in S3 override individual policies that apply to a given bucket, meaning that all public access can be controlled in one central types for that bucket. It is therefore good practice to define these settings for each bucket in order to clearly define the public access that can be allowed for it.\n", 216 | "markdown": "**Misconfiguration AVD-AWS-0094**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|LOW|S3 buckets should each define an aws_s3_bucket_public_access_block|Bucket does not have a corresponding public access block.|[AVD-AWS-0094](https://avd.aquasec.com/misconfig/avd-aws-0094)|\n\nThe \"block public access\" settings in S3 override individual policies that apply to a given bucket, meaning that all public access can be controlled in one central types for that bucket. It is therefore good practice to define these settings for each bucket in order to clearly define the public access that can be allowed for it.\n" 217 | }, 218 | "properties": { 219 | "precision": "very-high", 220 | "security-severity": "2.0", 221 | "tags": [ 222 | "misconfiguration", 223 | "security", 224 | "LOW" 225 | ] 226 | } 227 | }, 228 | { 229 | "id": "AVD-AWS-0132", 230 | "name": "Misconfiguration", 231 | "shortDescription": { 232 | "text": "S3 encryption should use Customer Managed Keys" 233 | }, 234 | "fullDescription": { 235 | "text": "Encryption using AWS keys provides protection for your S3 buckets. To increase control of the encryption and manage factors like rotation use customer managed keys.\n" 236 | }, 237 | "defaultConfiguration": { 238 | "level": "error" 239 | }, 240 | "helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0132", 241 | "help": { 242 | "text": "Misconfiguration AVD-AWS-0132\nType: Terraform Security Check\nSeverity: HIGH\nCheck: S3 encryption should use Customer Managed Keys\nMessage: Bucket does not encrypt data with a customer managed key.\nLink: [AVD-AWS-0132](https://avd.aquasec.com/misconfig/avd-aws-0132)\nEncryption using AWS keys provides protection for your S3 buckets. To increase control of the encryption and manage factors like rotation use customer managed keys.\n", 243 | "markdown": "**Misconfiguration AVD-AWS-0132**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|HIGH|S3 encryption should use Customer Managed Keys|Bucket does not encrypt data with a customer managed key.|[AVD-AWS-0132](https://avd.aquasec.com/misconfig/avd-aws-0132)|\n\nEncryption using AWS keys provides protection for your S3 buckets. To increase control of the encryption and manage factors like rotation use customer managed keys.\n" 244 | }, 245 | "properties": { 246 | "precision": "very-high", 247 | "security-severity": "8.0", 248 | "tags": [ 249 | "misconfiguration", 250 | "security", 251 | "HIGH" 252 | ] 253 | } 254 | } 255 | ] 256 | } 257 | }, 258 | "results": [ 259 | { 260 | "ruleId": "AVD-AWS-0086", 261 | "ruleIndex": 0, 262 | "level": "error", 263 | "message": { 264 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0086\nSeverity: HIGH\nMessage: No public access block so not blocking public acls\nLink: [AVD-AWS-0086](https://avd.aquasec.com/misconfig/avd-aws-0086)" 265 | }, 266 | "locations": [ 267 | { 268 | "physicalLocation": { 269 | "artifactLocation": { 270 | "uri": "main.tf", 271 | "uriBaseId": "ROOTPATH" 272 | }, 273 | "region": { 274 | "startLine": 8, 275 | "startColumn": 1, 276 | "endLine": 10, 277 | "endColumn": 1 278 | } 279 | }, 280 | "message": { 281 | "text": "main.tf" 282 | } 283 | } 284 | ] 285 | }, 286 | { 287 | "ruleId": "AVD-AWS-0087", 288 | "ruleIndex": 1, 289 | "level": "error", 290 | "message": { 291 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0087\nSeverity: HIGH\nMessage: No public access block so not blocking public policies\nLink: [AVD-AWS-0087](https://avd.aquasec.com/misconfig/avd-aws-0087)" 292 | }, 293 | "locations": [ 294 | { 295 | "physicalLocation": { 296 | "artifactLocation": { 297 | "uri": "main.tf", 298 | "uriBaseId": "ROOTPATH" 299 | }, 300 | "region": { 301 | "startLine": 8, 302 | "startColumn": 1, 303 | "endLine": 10, 304 | "endColumn": 1 305 | } 306 | }, 307 | "message": { 308 | "text": "main.tf" 309 | } 310 | } 311 | ] 312 | }, 313 | { 314 | "ruleId": "AVD-AWS-0088", 315 | "ruleIndex": 2, 316 | "level": "error", 317 | "message": { 318 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0088\nSeverity: HIGH\nMessage: Bucket does not have encryption enabled\nLink: [AVD-AWS-0088](https://avd.aquasec.com/misconfig/avd-aws-0088)" 319 | }, 320 | "locations": [ 321 | { 322 | "physicalLocation": { 323 | "artifactLocation": { 324 | "uri": "main.tf", 325 | "uriBaseId": "ROOTPATH" 326 | }, 327 | "region": { 328 | "startLine": 8, 329 | "startColumn": 1, 330 | "endLine": 10, 331 | "endColumn": 1 332 | } 333 | }, 334 | "message": { 335 | "text": "main.tf" 336 | } 337 | } 338 | ] 339 | }, 340 | { 341 | "ruleId": "s3-bucket-logging", 342 | "ruleIndex": 3, 343 | "level": "note", 344 | "message": { 345 | "text": "Artifact: main.tf\nType: terraform\nVulnerability s3-bucket-logging\nSeverity: LOW\nMessage: Bucket has logging disabled\nLink: [s3-bucket-logging](https://avd.aquasec.com/misconfig/s3-bucket-logging)" 346 | }, 347 | "locations": [ 348 | { 349 | "physicalLocation": { 350 | "artifactLocation": { 351 | "uri": "main.tf", 352 | "uriBaseId": "ROOTPATH" 353 | }, 354 | "region": { 355 | "startLine": 8, 356 | "startColumn": 1, 357 | "endLine": 10, 358 | "endColumn": 1 359 | } 360 | }, 361 | "message": { 362 | "text": "main.tf" 363 | } 364 | } 365 | ] 366 | }, 367 | { 368 | "ruleId": "AVD-AWS-0090", 369 | "ruleIndex": 4, 370 | "level": "warning", 371 | "message": { 372 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0090\nSeverity: MEDIUM\nMessage: Bucket does not have versioning enabled\nLink: [AVD-AWS-0090](https://avd.aquasec.com/misconfig/avd-aws-0090)" 373 | }, 374 | "locations": [ 375 | { 376 | "physicalLocation": { 377 | "artifactLocation": { 378 | "uri": "main.tf", 379 | "uriBaseId": "ROOTPATH" 380 | }, 381 | "region": { 382 | "startLine": 16, 383 | "startColumn": 1, 384 | "endLine": 16, 385 | "endColumn": 1 386 | } 387 | }, 388 | "message": { 389 | "text": "main.tf" 390 | } 391 | } 392 | ] 393 | }, 394 | { 395 | "ruleId": "AVD-AWS-0091", 396 | "ruleIndex": 5, 397 | "level": "error", 398 | "message": { 399 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0091\nSeverity: HIGH\nMessage: No public access block so not blocking public acls\nLink: [AVD-AWS-0091](https://avd.aquasec.com/misconfig/avd-aws-0091)" 400 | }, 401 | "locations": [ 402 | { 403 | "physicalLocation": { 404 | "artifactLocation": { 405 | "uri": "main.tf", 406 | "uriBaseId": "ROOTPATH" 407 | }, 408 | "region": { 409 | "startLine": 8, 410 | "startColumn": 1, 411 | "endLine": 10, 412 | "endColumn": 1 413 | } 414 | }, 415 | "message": { 416 | "text": "main.tf" 417 | } 418 | } 419 | ] 420 | }, 421 | { 422 | "ruleId": "AVD-AWS-0093", 423 | "ruleIndex": 6, 424 | "level": "error", 425 | "message": { 426 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0093\nSeverity: HIGH\nMessage: No public access block so not restricting public buckets\nLink: [AVD-AWS-0093](https://avd.aquasec.com/misconfig/avd-aws-0093)" 427 | }, 428 | "locations": [ 429 | { 430 | "physicalLocation": { 431 | "artifactLocation": { 432 | "uri": "main.tf", 433 | "uriBaseId": "ROOTPATH" 434 | }, 435 | "region": { 436 | "startLine": 8, 437 | "startColumn": 1, 438 | "endLine": 10, 439 | "endColumn": 1 440 | } 441 | }, 442 | "message": { 443 | "text": "main.tf" 444 | } 445 | } 446 | ] 447 | }, 448 | { 449 | "ruleId": "AVD-AWS-0094", 450 | "ruleIndex": 7, 451 | "level": "note", 452 | "message": { 453 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0094\nSeverity: LOW\nMessage: Bucket does not have a corresponding public access block.\nLink: [AVD-AWS-0094](https://avd.aquasec.com/misconfig/avd-aws-0094)" 454 | }, 455 | "locations": [ 456 | { 457 | "physicalLocation": { 458 | "artifactLocation": { 459 | "uri": "main.tf", 460 | "uriBaseId": "ROOTPATH" 461 | }, 462 | "region": { 463 | "startLine": 8, 464 | "startColumn": 1, 465 | "endLine": 10, 466 | "endColumn": 1 467 | } 468 | }, 469 | "message": { 470 | "text": "main.tf" 471 | } 472 | } 473 | ] 474 | }, 475 | { 476 | "ruleId": "AVD-AWS-0132", 477 | "ruleIndex": 8, 478 | "level": "error", 479 | "message": { 480 | "text": "Artifact: main.tf\nType: terraform\nVulnerability AVD-AWS-0132\nSeverity: HIGH\nMessage: Bucket does not encrypt data with a customer managed key.\nLink: [AVD-AWS-0132](https://avd.aquasec.com/misconfig/avd-aws-0132)" 481 | }, 482 | "locations": [ 483 | { 484 | "physicalLocation": { 485 | "artifactLocation": { 486 | "uri": "main.tf", 487 | "uriBaseId": "ROOTPATH" 488 | }, 489 | "region": { 490 | "startLine": 8, 491 | "startColumn": 1, 492 | "endLine": 10, 493 | "endColumn": 1 494 | } 495 | }, 496 | "message": { 497 | "text": "main.tf" 498 | } 499 | } 500 | ] 501 | } 502 | ], 503 | "columnKind": "utf16CodeUnits" 504 | } 505 | ] 506 | } 507 | -------------------------------------------------------------------------------- /test/data/config-scan/main.tf: -------------------------------------------------------------------------------- 1 | # test data for trivy config with terraform variables 2 | 3 | variable "bucket_versioning_enabled" { 4 | type = string 5 | default = "Disabled" 6 | } 7 | 8 | resource "aws_s3_bucket" "bucket" { 9 | bucket = "trivy-action-bucket" 10 | } 11 | 12 | resource "aws_s3_bucket_versioning" "bucket_versioning" { 13 | bucket = aws_s3_bucket.bucket.id 14 | 15 | versioning_configuration { 16 | status = var.bucket_versioning_enabled 17 | } 18 | } -------------------------------------------------------------------------------- /test/data/config-scan/report.json: -------------------------------------------------------------------------------- 1 | { 2 | "SchemaVersion": 2, 3 | "ArtifactName": "test/data/config-scan", 4 | "ArtifactType": "filesystem", 5 | "Metadata": { 6 | "ImageConfig": { 7 | "architecture": "", 8 | "created": "0001-01-01T00:00:00Z", 9 | "os": "", 10 | "rootfs": { 11 | "type": "", 12 | "diff_ids": null 13 | }, 14 | "config": {} 15 | } 16 | }, 17 | "Results": [ 18 | { 19 | "Target": ".", 20 | "Class": "config", 21 | "Type": "terraform", 22 | "MisconfSummary": { 23 | "Successes": 38, 24 | "Failures": 0 25 | } 26 | }, 27 | { 28 | "Target": "main.tf", 29 | "Class": "config", 30 | "Type": "terraform", 31 | "MisconfSummary": { 32 | "Successes": 0, 33 | "Failures": 9 34 | }, 35 | "Misconfigurations": [ 36 | { 37 | "Type": "Terraform Security Check", 38 | "ID": "AVD-AWS-0086", 39 | "AVDID": "AVD-AWS-0086", 40 | "Title": "S3 Access block should block public ACL", 41 | "Description": "S3 buckets should block public ACLs on buckets and any objects they contain. By blocking, PUTs with fail if the object has any public ACL a.\n", 42 | "Message": "No public access block so not blocking public acls", 43 | "Namespace": "builtin.aws.s3.aws0086", 44 | "Query": "data.builtin.aws.s3.aws0086.deny", 45 | "Resolution": "Enable blocking any PUT calls with a public ACL specified", 46 | "Severity": "HIGH", 47 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0086", 48 | "References": [ 49 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html", 50 | "https://avd.aquasec.com/misconfig/avd-aws-0086" 51 | ], 52 | "Status": "FAIL", 53 | "Layer": {}, 54 | "CauseMetadata": { 55 | "Resource": "aws_s3_bucket.bucket", 56 | "Provider": "AWS", 57 | "Service": "s3", 58 | "StartLine": 8, 59 | "EndLine": 10, 60 | "Code": { 61 | "Lines": [ 62 | { 63 | "Number": 8, 64 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 65 | "IsCause": true, 66 | "Annotation": "", 67 | "Truncated": false, 68 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 69 | "FirstCause": true, 70 | "LastCause": false 71 | }, 72 | { 73 | "Number": 9, 74 | "Content": " bucket = \"trivy-action-bucket\"", 75 | "IsCause": true, 76 | "Annotation": "", 77 | "Truncated": false, 78 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 79 | "FirstCause": false, 80 | "LastCause": false 81 | }, 82 | { 83 | "Number": 10, 84 | "Content": "}", 85 | "IsCause": true, 86 | "Annotation": "", 87 | "Truncated": false, 88 | "Highlighted": "\u001b[0m}", 89 | "FirstCause": false, 90 | "LastCause": true 91 | } 92 | ] 93 | }, 94 | "RenderedCause": {} 95 | } 96 | }, 97 | { 98 | "Type": "Terraform Security Check", 99 | "ID": "AVD-AWS-0087", 100 | "AVDID": "AVD-AWS-0087", 101 | "Title": "S3 Access block should block public policy", 102 | "Description": "S3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n", 103 | "Message": "No public access block so not blocking public policies", 104 | "Namespace": "builtin.aws.s3.aws0087", 105 | "Query": "data.builtin.aws.s3.aws0087.deny", 106 | "Resolution": "Prevent policies that allow public access being PUT", 107 | "Severity": "HIGH", 108 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0087", 109 | "References": [ 110 | "https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/access-control-block-public-access.html", 111 | "https://avd.aquasec.com/misconfig/avd-aws-0087" 112 | ], 113 | "Status": "FAIL", 114 | "Layer": {}, 115 | "CauseMetadata": { 116 | "Resource": "aws_s3_bucket.bucket", 117 | "Provider": "AWS", 118 | "Service": "s3", 119 | "StartLine": 8, 120 | "EndLine": 10, 121 | "Code": { 122 | "Lines": [ 123 | { 124 | "Number": 8, 125 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 126 | "IsCause": true, 127 | "Annotation": "", 128 | "Truncated": false, 129 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 130 | "FirstCause": true, 131 | "LastCause": false 132 | }, 133 | { 134 | "Number": 9, 135 | "Content": " bucket = \"trivy-action-bucket\"", 136 | "IsCause": true, 137 | "Annotation": "", 138 | "Truncated": false, 139 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 140 | "FirstCause": false, 141 | "LastCause": false 142 | }, 143 | { 144 | "Number": 10, 145 | "Content": "}", 146 | "IsCause": true, 147 | "Annotation": "", 148 | "Truncated": false, 149 | "Highlighted": "\u001b[0m}", 150 | "FirstCause": false, 151 | "LastCause": true 152 | } 153 | ] 154 | }, 155 | "RenderedCause": {} 156 | } 157 | }, 158 | { 159 | "Type": "Terraform Security Check", 160 | "ID": "AVD-AWS-0088", 161 | "AVDID": "AVD-AWS-0088", 162 | "Title": "Unencrypted S3 bucket.", 163 | "Description": "S3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.\n", 164 | "Message": "Bucket does not have encryption enabled", 165 | "Namespace": "builtin.aws.s3.aws0088", 166 | "Query": "data.builtin.aws.s3.aws0088.deny", 167 | "Resolution": "Configure bucket encryption", 168 | "Severity": "HIGH", 169 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0088", 170 | "References": [ 171 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html", 172 | "https://avd.aquasec.com/misconfig/avd-aws-0088" 173 | ], 174 | "Status": "FAIL", 175 | "Layer": {}, 176 | "CauseMetadata": { 177 | "Resource": "aws_s3_bucket.bucket", 178 | "Provider": "AWS", 179 | "Service": "s3", 180 | "StartLine": 8, 181 | "EndLine": 10, 182 | "Code": { 183 | "Lines": [ 184 | { 185 | "Number": 8, 186 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 187 | "IsCause": true, 188 | "Annotation": "", 189 | "Truncated": false, 190 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 191 | "FirstCause": true, 192 | "LastCause": false 193 | }, 194 | { 195 | "Number": 9, 196 | "Content": " bucket = \"trivy-action-bucket\"", 197 | "IsCause": true, 198 | "Annotation": "", 199 | "Truncated": false, 200 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 201 | "FirstCause": false, 202 | "LastCause": false 203 | }, 204 | { 205 | "Number": 10, 206 | "Content": "}", 207 | "IsCause": true, 208 | "Annotation": "", 209 | "Truncated": false, 210 | "Highlighted": "\u001b[0m}", 211 | "FirstCause": false, 212 | "LastCause": true 213 | } 214 | ] 215 | }, 216 | "RenderedCause": {} 217 | } 218 | }, 219 | { 220 | "Type": "Terraform Security Check", 221 | "ID": "s3-bucket-logging", 222 | "AVDID": "AVD-AWS-0089", 223 | "Title": "S3 Bucket Logging", 224 | "Description": "Ensures S3 bucket logging is enabled for S3 buckets", 225 | "Message": "Bucket has logging disabled", 226 | "Namespace": "builtin.aws.s3.aws0089", 227 | "Query": "data.builtin.aws.s3.aws0089.deny", 228 | "Resolution": "Add a logging block to the resource to enable access logging", 229 | "Severity": "LOW", 230 | "PrimaryURL": "https://avd.aquasec.com/misconfig/s3-bucket-logging", 231 | "References": [ 232 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html", 233 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html", 234 | "https://avd.aquasec.com/misconfig/s3-bucket-logging" 235 | ], 236 | "Status": "FAIL", 237 | "Layer": {}, 238 | "CauseMetadata": { 239 | "Resource": "aws_s3_bucket.bucket", 240 | "Provider": "AWS", 241 | "Service": "s3", 242 | "StartLine": 8, 243 | "EndLine": 10, 244 | "Code": { 245 | "Lines": [ 246 | { 247 | "Number": 8, 248 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 249 | "IsCause": true, 250 | "Annotation": "", 251 | "Truncated": false, 252 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 253 | "FirstCause": true, 254 | "LastCause": false 255 | }, 256 | { 257 | "Number": 9, 258 | "Content": " bucket = \"trivy-action-bucket\"", 259 | "IsCause": true, 260 | "Annotation": "", 261 | "Truncated": false, 262 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 263 | "FirstCause": false, 264 | "LastCause": false 265 | }, 266 | { 267 | "Number": 10, 268 | "Content": "}", 269 | "IsCause": true, 270 | "Annotation": "", 271 | "Truncated": false, 272 | "Highlighted": "\u001b[0m}", 273 | "FirstCause": false, 274 | "LastCause": true 275 | } 276 | ] 277 | }, 278 | "RenderedCause": {} 279 | } 280 | }, 281 | { 282 | "Type": "Terraform Security Check", 283 | "ID": "AVD-AWS-0090", 284 | "AVDID": "AVD-AWS-0090", 285 | "Title": "S3 Data should be versioned", 286 | "Description": "Versioning in Amazon S3 is a means of keeping multiple variants of an object in the same bucket.\n\nYou can use the S3 Versioning feature to preserve, retrieve, and restore every version of every object stored in your buckets.\n\nWith versioning you can recover more easily from both unintended user actions and application failures.\n", 287 | "Message": "Bucket does not have versioning enabled", 288 | "Namespace": "builtin.aws.s3.aws0090", 289 | "Query": "data.builtin.aws.s3.aws0090.deny", 290 | "Resolution": "Enable versioning to protect against accidental/malicious removal or modification", 291 | "Severity": "MEDIUM", 292 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0090", 293 | "References": [ 294 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html", 295 | "https://avd.aquasec.com/misconfig/avd-aws-0090" 296 | ], 297 | "Status": "FAIL", 298 | "Layer": {}, 299 | "CauseMetadata": { 300 | "Resource": "aws_s3_bucket_versioning.bucket_versioning", 301 | "Provider": "AWS", 302 | "Service": "s3", 303 | "StartLine": 16, 304 | "EndLine": 16, 305 | "Code": { 306 | "Lines": [ 307 | { 308 | "Number": 12, 309 | "Content": "resource \"aws_s3_bucket_versioning\" \"bucket_versioning\" {", 310 | "IsCause": false, 311 | "Annotation": "", 312 | "Truncated": false, 313 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket_versioning\"\u001b[0m \u001b[38;5;37m\"bucket_versioning\"\u001b[0m {", 314 | "FirstCause": false, 315 | "LastCause": false 316 | }, 317 | { 318 | "Number": 13, 319 | "Content": " bucket = aws_s3_bucket.bucket.id", 320 | "IsCause": false, 321 | "Annotation": "", 322 | "Truncated": false, 323 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = aws_s3_bucket.bucket.id", 324 | "FirstCause": false, 325 | "LastCause": false 326 | }, 327 | { 328 | "Number": 14, 329 | "Content": "", 330 | "IsCause": false, 331 | "Annotation": "", 332 | "Truncated": false, 333 | "FirstCause": false, 334 | "LastCause": false 335 | }, 336 | { 337 | "Number": 15, 338 | "Content": " versioning_configuration {", 339 | "IsCause": false, 340 | "Annotation": "", 341 | "Truncated": false, 342 | "Highlighted": " versioning_configuration {", 343 | "FirstCause": false, 344 | "LastCause": false 345 | }, 346 | { 347 | "Number": 16, 348 | "Content": " status = var.bucket_versioning_enabled", 349 | "IsCause": true, 350 | "Annotation": "", 351 | "Truncated": false, 352 | "Highlighted": " \u001b[38;5;245mstatus\u001b[0m = \u001b[38;5;33mvar\u001b[0m.bucket_versioning_enabled", 353 | "FirstCause": true, 354 | "LastCause": true 355 | }, 356 | { 357 | "Number": 17, 358 | "Content": " }", 359 | "IsCause": false, 360 | "Annotation": "", 361 | "Truncated": false, 362 | "Highlighted": " }", 363 | "FirstCause": false, 364 | "LastCause": false 365 | }, 366 | { 367 | "Number": 18, 368 | "Content": "}", 369 | "IsCause": false, 370 | "Annotation": "", 371 | "Truncated": false, 372 | "Highlighted": "}", 373 | "FirstCause": false, 374 | "LastCause": false 375 | } 376 | ] 377 | }, 378 | "Occurrences": [ 379 | { 380 | "Resource": "versioning_configuration", 381 | "Filename": "main.tf", 382 | "Location": { 383 | "StartLine": 15, 384 | "EndLine": 17 385 | } 386 | }, 387 | { 388 | "Resource": "aws_s3_bucket_versioning.bucket_versioning", 389 | "Filename": "main.tf", 390 | "Location": { 391 | "StartLine": 12, 392 | "EndLine": 18 393 | } 394 | } 395 | ], 396 | "RenderedCause": { 397 | "Raw": "resource \"aws_s3_bucket_versioning\" \"bucket_versioning\" {\n versioning_configuration {\n status = \"Disabled\"\n }\n}", 398 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket_versioning\"\u001b[0m \u001b[38;5;37m\"bucket_versioning\"\u001b[0m {\n versioning_configuration {\n \u001b[38;5;245mstatus\u001b[0m = \u001b[38;5;37m\"Disabled\"\n\u001b[0m }\n}" 399 | } 400 | } 401 | }, 402 | { 403 | "Type": "Terraform Security Check", 404 | "ID": "AVD-AWS-0091", 405 | "AVDID": "AVD-AWS-0091", 406 | "Title": "S3 Access Block should Ignore Public Acl", 407 | "Description": "S3 buckets should ignore public ACLs on buckets and any objects they contain. By ignoring rather than blocking, PUT calls with public ACLs will still be applied but the ACL will be ignored.\n", 408 | "Message": "No public access block so not blocking public acls", 409 | "Namespace": "builtin.aws.s3.aws0091", 410 | "Query": "data.builtin.aws.s3.aws0091.deny", 411 | "Resolution": "Enable ignoring the application of public ACLs in PUT calls", 412 | "Severity": "HIGH", 413 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0091", 414 | "References": [ 415 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html", 416 | "https://avd.aquasec.com/misconfig/avd-aws-0091" 417 | ], 418 | "Status": "FAIL", 419 | "Layer": {}, 420 | "CauseMetadata": { 421 | "Resource": "aws_s3_bucket.bucket", 422 | "Provider": "AWS", 423 | "Service": "s3", 424 | "StartLine": 8, 425 | "EndLine": 10, 426 | "Code": { 427 | "Lines": [ 428 | { 429 | "Number": 8, 430 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 431 | "IsCause": true, 432 | "Annotation": "", 433 | "Truncated": false, 434 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 435 | "FirstCause": true, 436 | "LastCause": false 437 | }, 438 | { 439 | "Number": 9, 440 | "Content": " bucket = \"trivy-action-bucket\"", 441 | "IsCause": true, 442 | "Annotation": "", 443 | "Truncated": false, 444 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 445 | "FirstCause": false, 446 | "LastCause": false 447 | }, 448 | { 449 | "Number": 10, 450 | "Content": "}", 451 | "IsCause": true, 452 | "Annotation": "", 453 | "Truncated": false, 454 | "Highlighted": "\u001b[0m}", 455 | "FirstCause": false, 456 | "LastCause": true 457 | } 458 | ] 459 | }, 460 | "RenderedCause": {} 461 | } 462 | }, 463 | { 464 | "Type": "Terraform Security Check", 465 | "ID": "AVD-AWS-0093", 466 | "AVDID": "AVD-AWS-0093", 467 | "Title": "S3 Access block should restrict public bucket to limit access", 468 | "Description": "S3 buckets should restrict public policies for the bucket. By enabling, the restrict_public_buckets, only the bucket owner and AWS Services can access if it has a public policy.\n", 469 | "Message": "No public access block so not restricting public buckets", 470 | "Namespace": "builtin.aws.s3.aws0093", 471 | "Query": "data.builtin.aws.s3.aws0093.deny", 472 | "Resolution": "Limit the access to public buckets to only the owner or AWS Services (eg; CloudFront)", 473 | "Severity": "HIGH", 474 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0093", 475 | "References": [ 476 | "https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/access-control-block-public-access.html", 477 | "https://avd.aquasec.com/misconfig/avd-aws-0093" 478 | ], 479 | "Status": "FAIL", 480 | "Layer": {}, 481 | "CauseMetadata": { 482 | "Resource": "aws_s3_bucket.bucket", 483 | "Provider": "AWS", 484 | "Service": "s3", 485 | "StartLine": 8, 486 | "EndLine": 10, 487 | "Code": { 488 | "Lines": [ 489 | { 490 | "Number": 8, 491 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 492 | "IsCause": true, 493 | "Annotation": "", 494 | "Truncated": false, 495 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 496 | "FirstCause": true, 497 | "LastCause": false 498 | }, 499 | { 500 | "Number": 9, 501 | "Content": " bucket = \"trivy-action-bucket\"", 502 | "IsCause": true, 503 | "Annotation": "", 504 | "Truncated": false, 505 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 506 | "FirstCause": false, 507 | "LastCause": false 508 | }, 509 | { 510 | "Number": 10, 511 | "Content": "}", 512 | "IsCause": true, 513 | "Annotation": "", 514 | "Truncated": false, 515 | "Highlighted": "\u001b[0m}", 516 | "FirstCause": false, 517 | "LastCause": true 518 | } 519 | ] 520 | }, 521 | "RenderedCause": {} 522 | } 523 | }, 524 | { 525 | "Type": "Terraform Security Check", 526 | "ID": "AVD-AWS-0094", 527 | "AVDID": "AVD-AWS-0094", 528 | "Title": "S3 buckets should each define an aws_s3_bucket_public_access_block", 529 | "Description": "The \"block public access\" settings in S3 override individual policies that apply to a given bucket, meaning that all public access can be controlled in one central types for that bucket. It is therefore good practice to define these settings for each bucket in order to clearly define the public access that can be allowed for it.\n", 530 | "Message": "Bucket does not have a corresponding public access block.", 531 | "Namespace": "builtin.aws.s3.aws0094", 532 | "Query": "data.builtin.aws.s3.aws0094.deny", 533 | "Resolution": "Define a aws_s3_bucket_public_access_block for the given bucket to control public access policies", 534 | "Severity": "LOW", 535 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0094", 536 | "References": [ 537 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html", 538 | "https://avd.aquasec.com/misconfig/avd-aws-0094" 539 | ], 540 | "Status": "FAIL", 541 | "Layer": {}, 542 | "CauseMetadata": { 543 | "Resource": "aws_s3_bucket.bucket", 544 | "Provider": "AWS", 545 | "Service": "s3", 546 | "StartLine": 8, 547 | "EndLine": 10, 548 | "Code": { 549 | "Lines": [ 550 | { 551 | "Number": 8, 552 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 553 | "IsCause": true, 554 | "Annotation": "", 555 | "Truncated": false, 556 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 557 | "FirstCause": true, 558 | "LastCause": false 559 | }, 560 | { 561 | "Number": 9, 562 | "Content": " bucket = \"trivy-action-bucket\"", 563 | "IsCause": true, 564 | "Annotation": "", 565 | "Truncated": false, 566 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 567 | "FirstCause": false, 568 | "LastCause": false 569 | }, 570 | { 571 | "Number": 10, 572 | "Content": "}", 573 | "IsCause": true, 574 | "Annotation": "", 575 | "Truncated": false, 576 | "Highlighted": "\u001b[0m}", 577 | "FirstCause": false, 578 | "LastCause": true 579 | } 580 | ] 581 | }, 582 | "RenderedCause": {} 583 | } 584 | }, 585 | { 586 | "Type": "Terraform Security Check", 587 | "ID": "AVD-AWS-0132", 588 | "AVDID": "AVD-AWS-0132", 589 | "Title": "S3 encryption should use Customer Managed Keys", 590 | "Description": "Encryption using AWS keys provides protection for your S3 buckets. To increase control of the encryption and manage factors like rotation use customer managed keys.\n", 591 | "Message": "Bucket does not encrypt data with a customer managed key.", 592 | "Namespace": "builtin.aws.s3.aws0132", 593 | "Query": "data.builtin.aws.s3.aws0132.deny", 594 | "Resolution": "Enable encryption using customer managed keys", 595 | "Severity": "HIGH", 596 | "PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0132", 597 | "References": [ 598 | "https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html", 599 | "https://avd.aquasec.com/misconfig/avd-aws-0132" 600 | ], 601 | "Status": "FAIL", 602 | "Layer": {}, 603 | "CauseMetadata": { 604 | "Resource": "aws_s3_bucket.bucket", 605 | "Provider": "AWS", 606 | "Service": "s3", 607 | "StartLine": 8, 608 | "EndLine": 10, 609 | "Code": { 610 | "Lines": [ 611 | { 612 | "Number": 8, 613 | "Content": "resource \"aws_s3_bucket\" \"bucket\" {", 614 | "IsCause": true, 615 | "Annotation": "", 616 | "Truncated": false, 617 | "Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {", 618 | "FirstCause": true, 619 | "LastCause": false 620 | }, 621 | { 622 | "Number": 9, 623 | "Content": " bucket = \"trivy-action-bucket\"", 624 | "IsCause": true, 625 | "Annotation": "", 626 | "Truncated": false, 627 | "Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"", 628 | "FirstCause": false, 629 | "LastCause": false 630 | }, 631 | { 632 | "Number": 10, 633 | "Content": "}", 634 | "IsCause": true, 635 | "Annotation": "", 636 | "Truncated": false, 637 | "Highlighted": "\u001b[0m}", 638 | "FirstCause": false, 639 | "LastCause": true 640 | } 641 | ] 642 | }, 643 | "RenderedCause": {} 644 | } 645 | } 646 | ] 647 | } 648 | ] 649 | } 650 | -------------------------------------------------------------------------------- /test/data/fs-scan/report: -------------------------------------------------------------------------------- 1 | 2 | Report Summary 3 | 4 | ┌────────┬──────┬─────────────────┬─────────┐ 5 | │ Target │ Type │ Vulnerabilities │ Secrets │ 6 | ├────────┼──────┼─────────────────┼─────────┤ 7 | │ - │ - │ - │ - │ 8 | └────────┴──────┴─────────────────┴─────────┘ 9 | Legend: 10 | - '-': Not scanned 11 | - '0': Clean (no security findings detected) 12 | 13 | -------------------------------------------------------------------------------- /test/data/github-dep-snapshot/report.gsbom: -------------------------------------------------------------------------------- 1 | { 2 | "version": 0, 3 | "detector": { 4 | "name": "trivy", 5 | "url": "https://github.com/aquasecurity/trivy" 6 | }, 7 | "metadata": { 8 | "aquasecurity:trivy:RepoDigest": "knqyf263/vuln-image@sha256:1e8b199249d6d0ef3419ddc6eda2348d9fbdb10d350d3bb70aa98e87faa227c9", 9 | "aquasecurity:trivy:RepoTag": "knqyf263/vuln-image:1.2.3" 10 | }, 11 | "manifests": { 12 | "knqyf263/vuln-image:1.2.3 (alpine 3.7.1)": { 13 | "name": "alpine", 14 | "resolved": { 15 | ".composer-phpext-rundeps": { 16 | "package_url": "pkg:apk/alpine/.composer-phpext-rundeps@0?arch=noarch&distro=3.7.1", 17 | "relationship": "direct", 18 | "dependencies": [ 19 | "libsodium@1.0.15-r0", 20 | "musl@1.1.18-r3", 21 | "zlib@1.2.11-r1" 22 | ], 23 | "scope": "runtime" 24 | }, 25 | ".persistent-deps": { 26 | "package_url": "pkg:apk/alpine/.persistent-deps@0?arch=noarch&distro=3.7.1", 27 | "relationship": "direct", 28 | "dependencies": [ 29 | "ca-certificates@20171114-r0", 30 | "curl@7.61.0-r0", 31 | "libressl@2.6.5-r0", 32 | "tar@1.29-r1", 33 | "xz@5.2.3-r1" 34 | ], 35 | "scope": "runtime" 36 | }, 37 | ".php-rundeps": { 38 | "package_url": "pkg:apk/alpine/.php-rundeps@0?arch=noarch&distro=3.7.1", 39 | "relationship": "direct", 40 | "dependencies": [ 41 | "libcurl@7.61.1-r0", 42 | "libedit@20170329.3.1-r3", 43 | "libressl2.6-libcrypto@2.6.5-r0", 44 | "libressl2.6-libssl@2.6.5-r0", 45 | "libsodium@1.0.15-r0", 46 | "libxml2@2.9.7-r0", 47 | "musl@1.1.18-r3", 48 | "zlib@1.2.11-r1" 49 | ], 50 | "scope": "runtime" 51 | }, 52 | "alpine-baselayout": { 53 | "package_url": "pkg:apk/alpine/alpine-baselayout@3.0.5-r2?arch=x86_64&distro=3.7.1", 54 | "relationship": "direct", 55 | "dependencies": [ 56 | "busybox@1.27.2-r11", 57 | "musl@1.1.18-r3" 58 | ], 59 | "scope": "runtime" 60 | }, 61 | "alpine-keys": { 62 | "package_url": "pkg:apk/alpine/alpine-keys@2.1-r1?arch=x86_64&distro=3.7.1", 63 | "relationship": "direct", 64 | "scope": "runtime" 65 | }, 66 | "apk-tools": { 67 | "package_url": "pkg:apk/alpine/apk-tools@2.10.1-r0?arch=x86_64&distro=3.7.1", 68 | "relationship": "direct", 69 | "dependencies": [ 70 | "libressl2.6-libcrypto@2.6.5-r0", 71 | "libressl2.6-libssl@2.6.5-r0", 72 | "musl@1.1.18-r3", 73 | "zlib@1.2.11-r1" 74 | ], 75 | "scope": "runtime" 76 | }, 77 | "apr": { 78 | "package_url": "pkg:apk/alpine/apr@1.6.3-r0?arch=x86_64&distro=3.7.1", 79 | "relationship": "direct", 80 | "dependencies": [ 81 | "libuuid@2.31-r0", 82 | "musl@1.1.18-r3" 83 | ], 84 | "scope": "runtime" 85 | }, 86 | "apr-util": { 87 | "package_url": "pkg:apk/alpine/apr-util@1.6.1-r1?arch=x86_64&distro=3.7.1", 88 | "relationship": "direct", 89 | "dependencies": [ 90 | "apr@1.6.3-r0", 91 | "expat@2.2.5-r0", 92 | "libressl2.6-libcrypto@2.6.5-r0", 93 | "musl@1.1.18-r3" 94 | ], 95 | "scope": "runtime" 96 | }, 97 | "bash": { 98 | "package_url": "pkg:apk/alpine/bash@4.4.19-r1?arch=x86_64&distro=3.7.1", 99 | "relationship": "direct", 100 | "dependencies": [ 101 | "busybox@1.27.2-r11", 102 | "musl@1.1.18-r3", 103 | "pkgconf@1.3.10-r0", 104 | "readline@7.0.003-r0" 105 | ], 106 | "scope": "runtime" 107 | }, 108 | "busybox": { 109 | "package_url": "pkg:apk/alpine/busybox@1.27.2-r11?arch=x86_64&distro=3.7.1", 110 | "relationship": "direct", 111 | "dependencies": [ 112 | "musl@1.1.18-r3" 113 | ], 114 | "scope": "runtime" 115 | }, 116 | "ca-certificates": { 117 | "package_url": "pkg:apk/alpine/ca-certificates@20171114-r0?arch=x86_64&distro=3.7.1", 118 | "relationship": "direct", 119 | "dependencies": [ 120 | "busybox@1.27.2-r11", 121 | "libressl2.6-libcrypto@2.6.5-r0", 122 | "musl@1.1.18-r3" 123 | ], 124 | "scope": "runtime" 125 | }, 126 | "curl": { 127 | "package_url": "pkg:apk/alpine/curl@7.61.0-r0?arch=x86_64&distro=3.7.1", 128 | "relationship": "direct", 129 | "dependencies": [ 130 | "ca-certificates@20171114-r0", 131 | "libcurl@7.61.1-r0", 132 | "musl@1.1.18-r3", 133 | "zlib@1.2.11-r1" 134 | ], 135 | "scope": "runtime" 136 | }, 137 | "db": { 138 | "package_url": "pkg:apk/alpine/db@5.3.28-r0?arch=x86_64&distro=3.7.1", 139 | "relationship": "direct", 140 | "dependencies": [ 141 | "musl@1.1.18-r3" 142 | ], 143 | "scope": "runtime" 144 | }, 145 | "expat": { 146 | "package_url": "pkg:apk/alpine/expat@2.2.5-r0?arch=x86_64&distro=3.7.1", 147 | "relationship": "direct", 148 | "dependencies": [ 149 | "musl@1.1.18-r3" 150 | ], 151 | "scope": "runtime" 152 | }, 153 | "gdbm": { 154 | "package_url": "pkg:apk/alpine/gdbm@1.13-r1?arch=x86_64&distro=3.7.1", 155 | "relationship": "direct", 156 | "dependencies": [ 157 | "musl@1.1.18-r3" 158 | ], 159 | "scope": "runtime" 160 | }, 161 | "git": { 162 | "package_url": "pkg:apk/alpine/git@2.15.2-r0?arch=x86_64&distro=3.7.1", 163 | "relationship": "direct", 164 | "dependencies": [ 165 | "expat@2.2.5-r0", 166 | "libcurl@7.61.1-r0", 167 | "musl@1.1.18-r3", 168 | "pcre2@10.30-r0", 169 | "zlib@1.2.11-r1" 170 | ], 171 | "scope": "runtime" 172 | }, 173 | "libbz2": { 174 | "package_url": "pkg:apk/alpine/libbz2@1.0.6-r6?arch=x86_64&distro=3.7.1", 175 | "relationship": "direct", 176 | "dependencies": [ 177 | "musl@1.1.18-r3" 178 | ], 179 | "scope": "runtime" 180 | }, 181 | "libc-utils": { 182 | "package_url": "pkg:apk/alpine/libc-utils@0.7.1-r0?arch=x86_64&distro=3.7.1", 183 | "relationship": "direct", 184 | "dependencies": [ 185 | "musl-utils@1.1.18-r3" 186 | ], 187 | "scope": "runtime" 188 | }, 189 | "libcurl": { 190 | "package_url": "pkg:apk/alpine/libcurl@7.61.1-r0?arch=x86_64&distro=3.7.1", 191 | "relationship": "direct", 192 | "dependencies": [ 193 | "ca-certificates@20171114-r0", 194 | "libressl2.6-libcrypto@2.6.5-r0", 195 | "libressl2.6-libssl@2.6.5-r0", 196 | "libssh2@1.8.0-r2", 197 | "musl@1.1.18-r3", 198 | "zlib@1.2.11-r1" 199 | ], 200 | "scope": "runtime" 201 | }, 202 | "libedit": { 203 | "package_url": "pkg:apk/alpine/libedit@20170329.3.1-r3?arch=x86_64&distro=3.7.1", 204 | "relationship": "direct", 205 | "dependencies": [ 206 | "musl@1.1.18-r3", 207 | "ncurses-libs@6.0_p20171125-r1" 208 | ], 209 | "scope": "runtime" 210 | }, 211 | "libffi": { 212 | "package_url": "pkg:apk/alpine/libffi@3.2.1-r4?arch=x86_64&distro=3.7.1", 213 | "relationship": "direct", 214 | "dependencies": [ 215 | "musl@1.1.18-r3" 216 | ], 217 | "scope": "runtime" 218 | }, 219 | "libressl": { 220 | "package_url": "pkg:apk/alpine/libressl@2.6.5-r0?arch=x86_64&distro=3.7.1", 221 | "relationship": "direct", 222 | "dependencies": [ 223 | "libressl2.6-libcrypto@2.6.5-r0", 224 | "libressl2.6-libssl@2.6.5-r0", 225 | "libressl2.6-libtls@2.6.5-r0", 226 | "musl@1.1.18-r3" 227 | ], 228 | "scope": "runtime" 229 | }, 230 | "libressl2.6-libcrypto": { 231 | "package_url": "pkg:apk/alpine/libressl2.6-libcrypto@2.6.5-r0?arch=x86_64&distro=3.7.1", 232 | "relationship": "direct", 233 | "dependencies": [ 234 | "musl@1.1.18-r3" 235 | ], 236 | "scope": "runtime" 237 | }, 238 | "libressl2.6-libssl": { 239 | "package_url": "pkg:apk/alpine/libressl2.6-libssl@2.6.5-r0?arch=x86_64&distro=3.7.1", 240 | "relationship": "direct", 241 | "dependencies": [ 242 | "libressl2.6-libcrypto@2.6.5-r0", 243 | "musl@1.1.18-r3" 244 | ], 245 | "scope": "runtime" 246 | }, 247 | "libressl2.6-libtls": { 248 | "package_url": "pkg:apk/alpine/libressl2.6-libtls@2.6.5-r0?arch=x86_64&distro=3.7.1", 249 | "relationship": "direct", 250 | "dependencies": [ 251 | "libressl2.6-libcrypto@2.6.5-r0", 252 | "libressl2.6-libssl@2.6.5-r0", 253 | "musl@1.1.18-r3" 254 | ], 255 | "scope": "runtime" 256 | }, 257 | "libsasl": { 258 | "package_url": "pkg:apk/alpine/libsasl@2.1.26-r11?arch=x86_64&distro=3.7.1", 259 | "relationship": "direct", 260 | "dependencies": [ 261 | "db@5.3.28-r0", 262 | "musl@1.1.18-r3" 263 | ], 264 | "scope": "runtime" 265 | }, 266 | "libsodium": { 267 | "package_url": "pkg:apk/alpine/libsodium@1.0.15-r0?arch=x86_64&distro=3.7.1", 268 | "relationship": "direct", 269 | "dependencies": [ 270 | "musl@1.1.18-r3" 271 | ], 272 | "scope": "runtime" 273 | }, 274 | "libssh2": { 275 | "package_url": "pkg:apk/alpine/libssh2@1.8.0-r2?arch=x86_64&distro=3.7.1", 276 | "relationship": "direct", 277 | "dependencies": [ 278 | "libressl2.6-libcrypto@2.6.5-r0", 279 | "musl@1.1.18-r3", 280 | "zlib@1.2.11-r1" 281 | ], 282 | "scope": "runtime" 283 | }, 284 | "libuuid": { 285 | "package_url": "pkg:apk/alpine/libuuid@2.31-r0?arch=x86_64&distro=3.7.1", 286 | "relationship": "direct", 287 | "dependencies": [ 288 | "musl@1.1.18-r3" 289 | ], 290 | "scope": "runtime" 291 | }, 292 | "libxml2": { 293 | "package_url": "pkg:apk/alpine/libxml2@2.9.7-r0?arch=x86_64&distro=3.7.1", 294 | "relationship": "direct", 295 | "dependencies": [ 296 | "musl@1.1.18-r3", 297 | "zlib@1.2.11-r1" 298 | ], 299 | "scope": "runtime" 300 | }, 301 | "mercurial": { 302 | "package_url": "pkg:apk/alpine/mercurial@4.5.2-r0?arch=x86_64&distro=3.7.1", 303 | "relationship": "direct", 304 | "dependencies": [ 305 | "musl@1.1.18-r3", 306 | "python2@2.7.15-r2" 307 | ], 308 | "scope": "runtime" 309 | }, 310 | "musl": { 311 | "package_url": "pkg:apk/alpine/musl@1.1.18-r3?arch=x86_64&distro=3.7.1", 312 | "relationship": "direct", 313 | "scope": "runtime" 314 | }, 315 | "musl-utils": { 316 | "package_url": "pkg:apk/alpine/musl-utils@1.1.18-r3?arch=x86_64&distro=3.7.1", 317 | "relationship": "direct", 318 | "dependencies": [ 319 | "musl@1.1.18-r3", 320 | "scanelf@1.2.2-r1" 321 | ], 322 | "scope": "runtime" 323 | }, 324 | "ncurses-libs": { 325 | "package_url": "pkg:apk/alpine/ncurses-libs@6.0_p20171125-r1?arch=x86_64&distro=3.7.1", 326 | "relationship": "direct", 327 | "dependencies": [ 328 | "musl@1.1.18-r3", 329 | "ncurses-terminfo-base@6.0_p20171125-r1", 330 | "ncurses-terminfo@6.0_p20171125-r1" 331 | ], 332 | "scope": "runtime" 333 | }, 334 | "ncurses-terminfo": { 335 | "package_url": "pkg:apk/alpine/ncurses-terminfo@6.0_p20171125-r1?arch=x86_64&distro=3.7.1", 336 | "relationship": "direct", 337 | "dependencies": [ 338 | "ncurses-terminfo-base@6.0_p20171125-r1" 339 | ], 340 | "scope": "runtime" 341 | }, 342 | "ncurses-terminfo-base": { 343 | "package_url": "pkg:apk/alpine/ncurses-terminfo-base@6.0_p20171125-r1?arch=x86_64&distro=3.7.1", 344 | "relationship": "direct", 345 | "scope": "runtime" 346 | }, 347 | "openssh": { 348 | "package_url": "pkg:apk/alpine/openssh@7.5_p1-r9?arch=x86_64&distro=3.7.1", 349 | "relationship": "direct", 350 | "dependencies": [ 351 | "libressl2.6-libcrypto@2.6.5-r0", 352 | "musl@1.1.18-r3", 353 | "openssh-client@7.5_p1-r9", 354 | "openssh-server@7.5_p1-r9", 355 | "openssh-sftp-server@7.5_p1-r9" 356 | ], 357 | "scope": "runtime" 358 | }, 359 | "openssh-client": { 360 | "package_url": "pkg:apk/alpine/openssh-client@7.5_p1-r9?arch=x86_64&distro=3.7.1", 361 | "relationship": "direct", 362 | "dependencies": [ 363 | "libressl2.6-libcrypto@2.6.5-r0", 364 | "musl@1.1.18-r3", 365 | "openssh-keygen@7.5_p1-r9", 366 | "zlib@1.2.11-r1" 367 | ], 368 | "scope": "runtime" 369 | }, 370 | "openssh-keygen": { 371 | "package_url": "pkg:apk/alpine/openssh-keygen@7.5_p1-r9?arch=x86_64&distro=3.7.1", 372 | "relationship": "direct", 373 | "dependencies": [ 374 | "libressl2.6-libcrypto@2.6.5-r0", 375 | "musl@1.1.18-r3" 376 | ], 377 | "scope": "runtime" 378 | }, 379 | "openssh-server": { 380 | "package_url": "pkg:apk/alpine/openssh-server@7.5_p1-r9?arch=x86_64&distro=3.7.1", 381 | "relationship": "direct", 382 | "dependencies": [ 383 | "libressl2.6-libcrypto@2.6.5-r0", 384 | "musl@1.1.18-r3", 385 | "openssh-keygen@7.5_p1-r9", 386 | "openssh-server-common@7.5_p1-r9", 387 | "zlib@1.2.11-r1" 388 | ], 389 | "scope": "runtime" 390 | }, 391 | "openssh-server-common": { 392 | "package_url": "pkg:apk/alpine/openssh-server-common@7.5_p1-r9?arch=x86_64&distro=3.7.1", 393 | "relationship": "direct", 394 | "scope": "runtime" 395 | }, 396 | "openssh-sftp-server": { 397 | "package_url": "pkg:apk/alpine/openssh-sftp-server@7.5_p1-r9?arch=x86_64&distro=3.7.1", 398 | "relationship": "direct", 399 | "dependencies": [ 400 | "musl@1.1.18-r3" 401 | ], 402 | "scope": "runtime" 403 | }, 404 | "patch": { 405 | "package_url": "pkg:apk/alpine/patch@2.7.5-r2?arch=x86_64&distro=3.7.1", 406 | "relationship": "direct", 407 | "dependencies": [ 408 | "musl@1.1.18-r3" 409 | ], 410 | "scope": "runtime" 411 | }, 412 | "pcre2": { 413 | "package_url": "pkg:apk/alpine/pcre2@10.30-r0?arch=x86_64&distro=3.7.1", 414 | "relationship": "direct", 415 | "dependencies": [ 416 | "musl@1.1.18-r3" 417 | ], 418 | "scope": "runtime" 419 | }, 420 | "pkgconf": { 421 | "package_url": "pkg:apk/alpine/pkgconf@1.3.10-r0?arch=x86_64&distro=3.7.1", 422 | "relationship": "direct", 423 | "dependencies": [ 424 | "musl@1.1.18-r3" 425 | ], 426 | "scope": "runtime" 427 | }, 428 | "python2": { 429 | "package_url": "pkg:apk/alpine/python2@2.7.15-r2?arch=x86_64&distro=3.7.1", 430 | "relationship": "direct", 431 | "dependencies": [ 432 | "expat@2.2.5-r0", 433 | "gdbm@1.13-r1", 434 | "libbz2@1.0.6-r6", 435 | "libffi@3.2.1-r4", 436 | "libressl2.6-libcrypto@2.6.5-r0", 437 | "libressl2.6-libssl@2.6.5-r0", 438 | "musl@1.1.18-r3", 439 | "ncurses-libs@6.0_p20171125-r1", 440 | "readline@7.0.003-r0", 441 | "sqlite-libs@3.21.0-r1", 442 | "zlib@1.2.11-r1" 443 | ], 444 | "scope": "runtime" 445 | }, 446 | "readline": { 447 | "package_url": "pkg:apk/alpine/readline@7.0.003-r0?arch=x86_64&distro=3.7.1", 448 | "relationship": "direct", 449 | "dependencies": [ 450 | "musl@1.1.18-r3", 451 | "ncurses-libs@6.0_p20171125-r1" 452 | ], 453 | "scope": "runtime" 454 | }, 455 | "scanelf": { 456 | "package_url": "pkg:apk/alpine/scanelf@1.2.2-r1?arch=x86_64&distro=3.7.1", 457 | "relationship": "direct", 458 | "dependencies": [ 459 | "musl@1.1.18-r3" 460 | ], 461 | "scope": "runtime" 462 | }, 463 | "serf": { 464 | "package_url": "pkg:apk/alpine/serf@1.3.9-r3?arch=x86_64&distro=3.7.1", 465 | "relationship": "direct", 466 | "dependencies": [ 467 | "apr-util@1.6.1-r1", 468 | "apr@1.6.3-r0", 469 | "libressl2.6-libcrypto@2.6.5-r0", 470 | "libressl2.6-libssl@2.6.5-r0", 471 | "musl@1.1.18-r3", 472 | "zlib@1.2.11-r1" 473 | ], 474 | "scope": "runtime" 475 | }, 476 | "sqlite-libs": { 477 | "package_url": "pkg:apk/alpine/sqlite-libs@3.21.0-r1?arch=x86_64&distro=3.7.1", 478 | "relationship": "direct", 479 | "dependencies": [ 480 | "musl@1.1.18-r3" 481 | ], 482 | "scope": "runtime" 483 | }, 484 | "ssl_client": { 485 | "package_url": "pkg:apk/alpine/ssl_client@1.27.2-r11?arch=x86_64&distro=3.7.1", 486 | "relationship": "direct", 487 | "dependencies": [ 488 | "libressl2.6-libtls@2.6.5-r0", 489 | "musl@1.1.18-r3" 490 | ], 491 | "scope": "runtime" 492 | }, 493 | "subversion": { 494 | "package_url": "pkg:apk/alpine/subversion@1.9.7-r0?arch=x86_64&distro=3.7.1", 495 | "relationship": "direct", 496 | "dependencies": [ 497 | "apr-util@1.6.1-r1", 498 | "apr@1.6.3-r0", 499 | "busybox@1.27.2-r11", 500 | "libsasl@2.1.26-r11", 501 | "musl@1.1.18-r3", 502 | "subversion-libs@1.9.7-r0" 503 | ], 504 | "scope": "runtime" 505 | }, 506 | "subversion-libs": { 507 | "package_url": "pkg:apk/alpine/subversion-libs@1.9.7-r0?arch=x86_64&distro=3.7.1", 508 | "relationship": "direct", 509 | "dependencies": [ 510 | "apr-util@1.6.1-r1", 511 | "apr@1.6.3-r0", 512 | "db@5.3.28-r0", 513 | "expat@2.2.5-r0", 514 | "libsasl@2.1.26-r11", 515 | "musl@1.1.18-r3", 516 | "serf@1.3.9-r3", 517 | "sqlite-libs@3.21.0-r1", 518 | "zlib@1.2.11-r1" 519 | ], 520 | "scope": "runtime" 521 | }, 522 | "tar": { 523 | "package_url": "pkg:apk/alpine/tar@1.29-r1?arch=x86_64&distro=3.7.1", 524 | "relationship": "direct", 525 | "dependencies": [ 526 | "musl@1.1.18-r3" 527 | ], 528 | "scope": "runtime" 529 | }, 530 | "tini": { 531 | "package_url": "pkg:apk/alpine/tini@0.16.1-r0?arch=x86_64&distro=3.7.1", 532 | "relationship": "direct", 533 | "dependencies": [ 534 | "musl@1.1.18-r3" 535 | ], 536 | "scope": "runtime" 537 | }, 538 | "xz": { 539 | "package_url": "pkg:apk/alpine/xz@5.2.3-r1?arch=x86_64&distro=3.7.1", 540 | "relationship": "direct", 541 | "dependencies": [ 542 | "musl@1.1.18-r3", 543 | "xz-libs@5.2.3-r1" 544 | ], 545 | "scope": "runtime" 546 | }, 547 | "xz-libs": { 548 | "package_url": "pkg:apk/alpine/xz-libs@5.2.3-r1?arch=x86_64&distro=3.7.1", 549 | "relationship": "direct", 550 | "dependencies": [ 551 | "musl@1.1.18-r3" 552 | ], 553 | "scope": "runtime" 554 | }, 555 | "zlib": { 556 | "package_url": "pkg:apk/alpine/zlib@1.2.11-r1?arch=x86_64&distro=3.7.1", 557 | "relationship": "direct", 558 | "dependencies": [ 559 | "musl@1.1.18-r3" 560 | ], 561 | "scope": "runtime" 562 | } 563 | } 564 | }, 565 | "rust-app/Cargo.lock": { 566 | "name": "cargo", 567 | "file": { 568 | "source_location": "knqyf263/vuln-image:1.2.3@sha256:1e8b199249d6d0ef3419ddc6eda2348d9fbdb10d350d3bb70aa98e87faa227c9" 569 | }, 570 | "resolved": { 571 | "ammonia": { 572 | "package_url": "pkg:cargo/ammonia@1.9.0", 573 | "relationship": "direct", 574 | "dependencies": [ 575 | "html5ever@0.23.0", 576 | "lazy_static@1.3.0", 577 | "maplit@1.0.1", 578 | "matches@0.1.8", 579 | "tendril@0.4.1", 580 | "url@1.7.2" 581 | ], 582 | "scope": "runtime" 583 | }, 584 | "autocfg": { 585 | "package_url": "pkg:cargo/autocfg@0.1.2", 586 | "relationship": "direct", 587 | "scope": "runtime" 588 | }, 589 | "bitflags": { 590 | "package_url": "pkg:cargo/bitflags@1.0.4", 591 | "relationship": "direct", 592 | "scope": "runtime" 593 | }, 594 | "cfg-if": { 595 | "package_url": "pkg:cargo/cfg-if@0.1.7", 596 | "relationship": "direct", 597 | "scope": "runtime" 598 | }, 599 | "cloudabi": { 600 | "package_url": "pkg:cargo/cloudabi@0.0.3", 601 | "relationship": "direct", 602 | "dependencies": [ 603 | "bitflags@1.0.4" 604 | ], 605 | "scope": "runtime" 606 | }, 607 | "fuchsia-cprng": { 608 | "package_url": "pkg:cargo/fuchsia-cprng@0.1.1", 609 | "relationship": "direct", 610 | "scope": "runtime" 611 | }, 612 | "futf": { 613 | "package_url": "pkg:cargo/futf@0.1.4", 614 | "relationship": "direct", 615 | "dependencies": [ 616 | "mac@0.1.1", 617 | "new_debug_unreachable@1.0.3" 618 | ], 619 | "scope": "runtime" 620 | }, 621 | "gdi32-sys": { 622 | "package_url": "pkg:cargo/gdi32-sys@0.2.0", 623 | "relationship": "direct", 624 | "dependencies": [ 625 | "winapi-build@0.1.1", 626 | "winapi@0.2.8" 627 | ], 628 | "scope": "runtime" 629 | }, 630 | "html5ever": { 631 | "package_url": "pkg:cargo/html5ever@0.23.0", 632 | "relationship": "direct", 633 | "dependencies": [ 634 | "log@0.4.6", 635 | "mac@0.1.1", 636 | "markup5ever@0.8.1", 637 | "proc-macro2@0.4.30", 638 | "quote@0.6.12", 639 | "syn@0.15.34" 640 | ], 641 | "scope": "runtime" 642 | }, 643 | "idna": { 644 | "package_url": "pkg:cargo/idna@0.1.5", 645 | "relationship": "direct", 646 | "dependencies": [ 647 | "matches@0.1.8", 648 | "unicode-bidi@0.3.4", 649 | "unicode-normalization@0.1.8" 650 | ], 651 | "scope": "runtime" 652 | }, 653 | "itoa": { 654 | "package_url": "pkg:cargo/itoa@0.4.4", 655 | "relationship": "direct", 656 | "scope": "runtime" 657 | }, 658 | "kernel32-sys": { 659 | "package_url": "pkg:cargo/kernel32-sys@0.2.2", 660 | "relationship": "direct", 661 | "dependencies": [ 662 | "winapi-build@0.1.1", 663 | "winapi@0.2.8" 664 | ], 665 | "scope": "runtime" 666 | }, 667 | "lazy_static": { 668 | "package_url": "pkg:cargo/lazy_static@1.3.0", 669 | "relationship": "direct", 670 | "scope": "runtime" 671 | }, 672 | "libc": { 673 | "package_url": "pkg:cargo/libc@0.2.54", 674 | "relationship": "direct", 675 | "scope": "runtime" 676 | }, 677 | "libressl-pnacl-sys": { 678 | "package_url": "pkg:cargo/libressl-pnacl-sys@2.1.6", 679 | "relationship": "direct", 680 | "dependencies": [ 681 | "pnacl-build-helper@1.4.11" 682 | ], 683 | "scope": "runtime" 684 | }, 685 | "log": { 686 | "package_url": "pkg:cargo/log@0.4.6", 687 | "relationship": "direct", 688 | "dependencies": [ 689 | "cfg-if@0.1.7" 690 | ], 691 | "scope": "runtime" 692 | }, 693 | "mac": { 694 | "package_url": "pkg:cargo/mac@0.1.1", 695 | "relationship": "direct", 696 | "scope": "runtime" 697 | }, 698 | "maplit": { 699 | "package_url": "pkg:cargo/maplit@1.0.1", 700 | "relationship": "direct", 701 | "scope": "runtime" 702 | }, 703 | "markup5ever": { 704 | "package_url": "pkg:cargo/markup5ever@0.8.1", 705 | "relationship": "direct", 706 | "dependencies": [ 707 | "log@0.4.6", 708 | "phf@0.7.24", 709 | "phf_codegen@0.7.24", 710 | "serde@1.0.91", 711 | "serde_derive@1.0.91", 712 | "serde_json@1.0.39", 713 | "string_cache@0.7.3", 714 | "string_cache_codegen@0.4.2", 715 | "tendril@0.4.1" 716 | ], 717 | "scope": "runtime" 718 | }, 719 | "matches": { 720 | "package_url": "pkg:cargo/matches@0.1.8", 721 | "relationship": "direct", 722 | "scope": "runtime" 723 | }, 724 | "new_debug_unreachable": { 725 | "package_url": "pkg:cargo/new_debug_unreachable@1.0.3", 726 | "relationship": "direct", 727 | "scope": "runtime" 728 | }, 729 | "normal": { 730 | "package_url": "pkg:cargo/normal@0.1.0", 731 | "relationship": "direct", 732 | "dependencies": [ 733 | "ammonia@2.0.0", 734 | "libc@0.2.54", 735 | "openssl@0.8.3" 736 | ], 737 | "scope": "runtime" 738 | }, 739 | "openssl": { 740 | "package_url": "pkg:cargo/openssl@0.8.3", 741 | "relationship": "direct", 742 | "dependencies": [ 743 | "bitflags@0.7.0", 744 | "lazy_static@0.2.11", 745 | "libc@0.2.54", 746 | "openssl-sys@0.7.17" 747 | ], 748 | "scope": "runtime" 749 | }, 750 | "openssl-sys": { 751 | "package_url": "pkg:cargo/openssl-sys@0.7.17", 752 | "relationship": "direct", 753 | "dependencies": [ 754 | "gdi32-sys@0.2.0", 755 | "libc@0.2.54", 756 | "libressl-pnacl-sys@2.1.6", 757 | "pkg-config@0.3.14", 758 | "user32-sys@0.2.0" 759 | ], 760 | "scope": "runtime" 761 | }, 762 | "percent-encoding": { 763 | "package_url": "pkg:cargo/percent-encoding@1.0.1", 764 | "relationship": "direct", 765 | "scope": "runtime" 766 | }, 767 | "phf": { 768 | "package_url": "pkg:cargo/phf@0.7.24", 769 | "relationship": "direct", 770 | "dependencies": [ 771 | "phf_shared@0.7.24" 772 | ], 773 | "scope": "runtime" 774 | }, 775 | "phf_codegen": { 776 | "package_url": "pkg:cargo/phf_codegen@0.7.24", 777 | "relationship": "direct", 778 | "dependencies": [ 779 | "phf_generator@0.7.24", 780 | "phf_shared@0.7.24" 781 | ], 782 | "scope": "runtime" 783 | }, 784 | "phf_generator": { 785 | "package_url": "pkg:cargo/phf_generator@0.7.24", 786 | "relationship": "direct", 787 | "dependencies": [ 788 | "phf_shared@0.7.24", 789 | "rand@0.6.5" 790 | ], 791 | "scope": "runtime" 792 | }, 793 | "phf_shared": { 794 | "package_url": "pkg:cargo/phf_shared@0.7.24", 795 | "relationship": "direct", 796 | "dependencies": [ 797 | "siphasher@0.2.3" 798 | ], 799 | "scope": "runtime" 800 | }, 801 | "pkg-config": { 802 | "package_url": "pkg:cargo/pkg-config@0.3.14", 803 | "relationship": "direct", 804 | "scope": "runtime" 805 | }, 806 | "pnacl-build-helper": { 807 | "package_url": "pkg:cargo/pnacl-build-helper@1.4.11", 808 | "relationship": "direct", 809 | "dependencies": [ 810 | "tempdir@0.3.7", 811 | "walkdir@1.0.7" 812 | ], 813 | "scope": "runtime" 814 | }, 815 | "precomputed-hash": { 816 | "package_url": "pkg:cargo/precomputed-hash@0.1.1", 817 | "relationship": "direct", 818 | "scope": "runtime" 819 | }, 820 | "proc-macro2": { 821 | "package_url": "pkg:cargo/proc-macro2@0.4.30", 822 | "relationship": "direct", 823 | "dependencies": [ 824 | "unicode-xid@0.1.0" 825 | ], 826 | "scope": "runtime" 827 | }, 828 | "quote": { 829 | "package_url": "pkg:cargo/quote@0.6.12", 830 | "relationship": "direct", 831 | "dependencies": [ 832 | "proc-macro2@0.4.30" 833 | ], 834 | "scope": "runtime" 835 | }, 836 | "rand": { 837 | "package_url": "pkg:cargo/rand@0.6.5", 838 | "relationship": "direct", 839 | "dependencies": [ 840 | "autocfg@0.1.2", 841 | "libc@0.2.54", 842 | "rand_chacha@0.1.1", 843 | "rand_core@0.4.0", 844 | "rand_hc@0.1.0", 845 | "rand_isaac@0.1.1", 846 | "rand_jitter@0.1.4", 847 | "rand_os@0.1.3", 848 | "rand_pcg@0.1.2", 849 | "rand_xorshift@0.1.1", 850 | "winapi@0.3.7" 851 | ], 852 | "scope": "runtime" 853 | }, 854 | "rand_chacha": { 855 | "package_url": "pkg:cargo/rand_chacha@0.1.1", 856 | "relationship": "direct", 857 | "dependencies": [ 858 | "autocfg@0.1.2", 859 | "rand_core@0.3.1" 860 | ], 861 | "scope": "runtime" 862 | }, 863 | "rand_core": { 864 | "package_url": "pkg:cargo/rand_core@0.4.0", 865 | "relationship": "direct", 866 | "scope": "runtime" 867 | }, 868 | "rand_hc": { 869 | "package_url": "pkg:cargo/rand_hc@0.1.0", 870 | "relationship": "direct", 871 | "dependencies": [ 872 | "rand_core@0.3.1" 873 | ], 874 | "scope": "runtime" 875 | }, 876 | "rand_isaac": { 877 | "package_url": "pkg:cargo/rand_isaac@0.1.1", 878 | "relationship": "direct", 879 | "dependencies": [ 880 | "rand_core@0.3.1" 881 | ], 882 | "scope": "runtime" 883 | }, 884 | "rand_jitter": { 885 | "package_url": "pkg:cargo/rand_jitter@0.1.4", 886 | "relationship": "direct", 887 | "dependencies": [ 888 | "libc@0.2.54", 889 | "rand_core@0.4.0", 890 | "winapi@0.3.7" 891 | ], 892 | "scope": "runtime" 893 | }, 894 | "rand_os": { 895 | "package_url": "pkg:cargo/rand_os@0.1.3", 896 | "relationship": "direct", 897 | "dependencies": [ 898 | "cloudabi@0.0.3", 899 | "fuchsia-cprng@0.1.1", 900 | "libc@0.2.54", 901 | "rand_core@0.4.0", 902 | "rdrand@0.4.0", 903 | "winapi@0.3.7" 904 | ], 905 | "scope": "runtime" 906 | }, 907 | "rand_pcg": { 908 | "package_url": "pkg:cargo/rand_pcg@0.1.2", 909 | "relationship": "direct", 910 | "dependencies": [ 911 | "autocfg@0.1.2", 912 | "rand_core@0.4.0" 913 | ], 914 | "scope": "runtime" 915 | }, 916 | "rand_xorshift": { 917 | "package_url": "pkg:cargo/rand_xorshift@0.1.1", 918 | "relationship": "direct", 919 | "dependencies": [ 920 | "rand_core@0.3.1" 921 | ], 922 | "scope": "runtime" 923 | }, 924 | "rdrand": { 925 | "package_url": "pkg:cargo/rdrand@0.4.0", 926 | "relationship": "direct", 927 | "dependencies": [ 928 | "rand_core@0.3.1" 929 | ], 930 | "scope": "runtime" 931 | }, 932 | "remove_dir_all": { 933 | "package_url": "pkg:cargo/remove_dir_all@0.5.1", 934 | "relationship": "direct", 935 | "dependencies": [ 936 | "winapi@0.3.7" 937 | ], 938 | "scope": "runtime" 939 | }, 940 | "ryu": { 941 | "package_url": "pkg:cargo/ryu@0.2.8", 942 | "relationship": "direct", 943 | "scope": "runtime" 944 | }, 945 | "same-file": { 946 | "package_url": "pkg:cargo/same-file@0.1.3", 947 | "relationship": "direct", 948 | "dependencies": [ 949 | "kernel32-sys@0.2.2", 950 | "winapi@0.2.8" 951 | ], 952 | "scope": "runtime" 953 | }, 954 | "serde": { 955 | "package_url": "pkg:cargo/serde@1.0.91", 956 | "relationship": "direct", 957 | "scope": "runtime" 958 | }, 959 | "serde_derive": { 960 | "package_url": "pkg:cargo/serde_derive@1.0.91", 961 | "relationship": "direct", 962 | "dependencies": [ 963 | "proc-macro2@0.4.30", 964 | "quote@0.6.12", 965 | "syn@0.15.34" 966 | ], 967 | "scope": "runtime" 968 | }, 969 | "serde_json": { 970 | "package_url": "pkg:cargo/serde_json@1.0.39", 971 | "relationship": "direct", 972 | "dependencies": [ 973 | "itoa@0.4.4", 974 | "ryu@0.2.8", 975 | "serde@1.0.91" 976 | ], 977 | "scope": "runtime" 978 | }, 979 | "siphasher": { 980 | "package_url": "pkg:cargo/siphasher@0.2.3", 981 | "relationship": "direct", 982 | "scope": "runtime" 983 | }, 984 | "smallvec": { 985 | "package_url": "pkg:cargo/smallvec@0.6.9", 986 | "relationship": "direct", 987 | "scope": "runtime" 988 | }, 989 | "string_cache": { 990 | "package_url": "pkg:cargo/string_cache@0.7.3", 991 | "relationship": "direct", 992 | "dependencies": [ 993 | "lazy_static@1.3.0", 994 | "new_debug_unreachable@1.0.3", 995 | "phf_shared@0.7.24", 996 | "precomputed-hash@0.1.1", 997 | "serde@1.0.91", 998 | "string_cache_codegen@0.4.2", 999 | "string_cache_shared@0.3.0" 1000 | ], 1001 | "scope": "runtime" 1002 | }, 1003 | "string_cache_codegen": { 1004 | "package_url": "pkg:cargo/string_cache_codegen@0.4.2", 1005 | "relationship": "direct", 1006 | "dependencies": [ 1007 | "phf_generator@0.7.24", 1008 | "phf_shared@0.7.24", 1009 | "proc-macro2@0.4.30", 1010 | "quote@0.6.12", 1011 | "string_cache_shared@0.3.0" 1012 | ], 1013 | "scope": "runtime" 1014 | }, 1015 | "string_cache_shared": { 1016 | "package_url": "pkg:cargo/string_cache_shared@0.3.0", 1017 | "relationship": "direct", 1018 | "scope": "runtime" 1019 | }, 1020 | "syn": { 1021 | "package_url": "pkg:cargo/syn@0.15.34", 1022 | "relationship": "direct", 1023 | "dependencies": [ 1024 | "proc-macro2@0.4.30", 1025 | "quote@0.6.12", 1026 | "unicode-xid@0.1.0" 1027 | ], 1028 | "scope": "runtime" 1029 | }, 1030 | "tempdir": { 1031 | "package_url": "pkg:cargo/tempdir@0.3.7", 1032 | "relationship": "direct", 1033 | "dependencies": [ 1034 | "rand@0.4.6", 1035 | "remove_dir_all@0.5.1" 1036 | ], 1037 | "scope": "runtime" 1038 | }, 1039 | "tendril": { 1040 | "package_url": "pkg:cargo/tendril@0.4.1", 1041 | "relationship": "direct", 1042 | "dependencies": [ 1043 | "futf@0.1.4", 1044 | "mac@0.1.1", 1045 | "utf-8@0.7.5" 1046 | ], 1047 | "scope": "runtime" 1048 | }, 1049 | "unicode-bidi": { 1050 | "package_url": "pkg:cargo/unicode-bidi@0.3.4", 1051 | "relationship": "direct", 1052 | "dependencies": [ 1053 | "matches@0.1.8" 1054 | ], 1055 | "scope": "runtime" 1056 | }, 1057 | "unicode-normalization": { 1058 | "package_url": "pkg:cargo/unicode-normalization@0.1.8", 1059 | "relationship": "direct", 1060 | "dependencies": [ 1061 | "smallvec@0.6.9" 1062 | ], 1063 | "scope": "runtime" 1064 | }, 1065 | "unicode-xid": { 1066 | "package_url": "pkg:cargo/unicode-xid@0.1.0", 1067 | "relationship": "direct", 1068 | "scope": "runtime" 1069 | }, 1070 | "url": { 1071 | "package_url": "pkg:cargo/url@1.7.2", 1072 | "relationship": "direct", 1073 | "dependencies": [ 1074 | "idna@0.1.5", 1075 | "matches@0.1.8", 1076 | "percent-encoding@1.0.1" 1077 | ], 1078 | "scope": "runtime" 1079 | }, 1080 | "user32-sys": { 1081 | "package_url": "pkg:cargo/user32-sys@0.2.0", 1082 | "relationship": "direct", 1083 | "dependencies": [ 1084 | "winapi-build@0.1.1", 1085 | "winapi@0.2.8" 1086 | ], 1087 | "scope": "runtime" 1088 | }, 1089 | "utf-8": { 1090 | "package_url": "pkg:cargo/utf-8@0.7.5", 1091 | "relationship": "direct", 1092 | "scope": "runtime" 1093 | }, 1094 | "walkdir": { 1095 | "package_url": "pkg:cargo/walkdir@1.0.7", 1096 | "relationship": "direct", 1097 | "dependencies": [ 1098 | "kernel32-sys@0.2.2", 1099 | "same-file@0.1.3", 1100 | "winapi@0.2.8" 1101 | ], 1102 | "scope": "runtime" 1103 | }, 1104 | "winapi": { 1105 | "package_url": "pkg:cargo/winapi@0.3.7", 1106 | "relationship": "direct", 1107 | "dependencies": [ 1108 | "winapi-i686-pc-windows-gnu@0.4.0", 1109 | "winapi-x86_64-pc-windows-gnu@0.4.0" 1110 | ], 1111 | "scope": "runtime" 1112 | }, 1113 | "winapi-build": { 1114 | "package_url": "pkg:cargo/winapi-build@0.1.1", 1115 | "relationship": "direct", 1116 | "scope": "runtime" 1117 | }, 1118 | "winapi-i686-pc-windows-gnu": { 1119 | "package_url": "pkg:cargo/winapi-i686-pc-windows-gnu@0.4.0", 1120 | "relationship": "direct", 1121 | "scope": "runtime" 1122 | }, 1123 | "winapi-x86_64-pc-windows-gnu": { 1124 | "package_url": "pkg:cargo/winapi-x86_64-pc-windows-gnu@0.4.0", 1125 | "relationship": "direct", 1126 | "scope": "runtime" 1127 | } 1128 | } 1129 | } 1130 | } 1131 | } 1132 | -------------------------------------------------------------------------------- /test/data/image-scan/report: -------------------------------------------------------------------------------- 1 | 2 | Report Summary 3 | 4 | ┌──────────────────────────────────────────┬────────┬─────────────────┬─────────┐ 5 | │ Target │ Type │ Vulnerabilities │ Secrets │ 6 | ├──────────────────────────────────────────┼────────┼─────────────────┼─────────┤ 7 | │ knqyf263/vuln-image:1.2.3 (alpine 3.7.1) │ alpine │ 19 │ - │ 8 | ├──────────────────────────────────────────┼────────┼─────────────────┼─────────┤ 9 | │ rust-app/Cargo.lock │ cargo │ 4 │ - │ 10 | └──────────────────────────────────────────┴────────┴─────────────────┴─────────┘ 11 | Legend: 12 | - '-': Not scanned 13 | - '0': Clean (no security findings detected) 14 | 15 | 16 | knqyf263/vuln-image:1.2.3 (alpine 3.7.1) 17 | ======================================== 18 | Total: 19 (CRITICAL: 19) 19 | 20 | ┌─────────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐ 21 | │ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │ 22 | ├─────────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 23 | │ curl │ CVE-2018-14618 │ CRITICAL │ fixed │ 7.61.0-r0 │ 7.61.1-r0 │ curl: NTLM password overflow via integer overflow │ 24 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-14618 │ 25 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 26 | │ │ CVE-2018-16839 │ │ │ │ 7.61.1-r1 │ curl: Integer overflow leading to heap-based buffer overflow │ 27 | │ │ │ │ │ │ │ in Curl_sasl_create_plain_message() │ 28 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16839 │ 29 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 30 | │ │ CVE-2018-16840 │ │ │ │ │ curl: Use-after-free when closing "easy" handle in │ 31 | │ │ │ │ │ │ │ Curl_close() │ 32 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16840 │ 33 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 34 | │ │ CVE-2018-16842 │ │ │ │ │ curl: Heap-based buffer over-read in the curl tool warning │ 35 | │ │ │ │ │ │ │ formatting │ 36 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16842 │ 37 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 38 | │ │ CVE-2019-3822 │ │ │ │ 7.61.1-r2 │ curl: NTLMv2 type-3 header stack buffer overflow │ 39 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-3822 │ 40 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 41 | │ │ CVE-2019-5481 │ │ │ │ 7.61.1-r3 │ curl: double free due to subsequent call of realloc() │ 42 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5481 │ 43 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 44 | │ │ CVE-2019-5482 │ │ │ │ │ curl: heap buffer overflow in function tftp_receive_packet() │ 45 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5482 │ 46 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 47 | │ git │ CVE-2018-17456 │ │ │ 2.15.2-r0 │ 2.15.3-r0 │ git: arbitrary code execution via .gitmodules │ 48 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-17456 │ 49 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 50 | │ │ CVE-2019-1353 │ │ │ │ 2.15.4-r0 │ git: NTFS protections inactive when running Git in the │ 51 | │ │ │ │ │ │ │ Windows Subsystem for... │ 52 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1353 │ 53 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 54 | │ libbz2 │ CVE-2019-12900 │ │ │ 1.0.6-r6 │ 1.0.6-r7 │ bzip2: out-of-bounds write in function BZ2_decompress │ 55 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-12900 │ 56 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 57 | │ libcurl │ CVE-2018-16839 │ │ │ 7.61.1-r0 │ 7.61.1-r1 │ curl: Integer overflow leading to heap-based buffer overflow │ 58 | │ │ │ │ │ │ │ in Curl_sasl_create_plain_message() │ 59 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16839 │ 60 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 61 | │ │ CVE-2018-16840 │ │ │ │ │ curl: Use-after-free when closing "easy" handle in │ 62 | │ │ │ │ │ │ │ Curl_close() │ 63 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16840 │ 64 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 65 | │ │ CVE-2018-16842 │ │ │ │ │ curl: Heap-based buffer over-read in the curl tool warning │ 66 | │ │ │ │ │ │ │ formatting │ 67 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16842 │ 68 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 69 | │ │ CVE-2019-3822 │ │ │ │ 7.61.1-r2 │ curl: NTLMv2 type-3 header stack buffer overflow │ 70 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-3822 │ 71 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 72 | │ │ CVE-2019-5481 │ │ │ │ 7.61.1-r3 │ curl: double free due to subsequent call of realloc() │ 73 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5481 │ 74 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 75 | │ │ CVE-2019-5482 │ │ │ │ │ curl: heap buffer overflow in function tftp_receive_packet() │ 76 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5482 │ 77 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 78 | │ musl │ CVE-2019-14697 │ │ │ 1.1.18-r3 │ 1.1.18-r4 │ musl libc through 1.1.23 has an x87 floating-point stack │ 79 | │ │ │ │ │ │ │ adjustment im ...... │ 80 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-14697 │ 81 | ├─────────────┤ │ │ │ │ │ │ 82 | │ musl-utils │ │ │ │ │ │ │ 83 | │ │ │ │ │ │ │ │ 84 | │ │ │ │ │ │ │ │ 85 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 86 | │ sqlite-libs │ CVE-2019-8457 │ │ │ 3.21.0-r1 │ 3.25.3-r1 │ sqlite: heap out-of-bound read in function rtreenode() │ 87 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-8457 │ 88 | └─────────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴──────────────────────────────────────────────────────────────┘ 89 | 90 | rust-app/Cargo.lock (cargo) 91 | =========================== 92 | Total: 4 (CRITICAL: 4) 93 | 94 | ┌───────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐ 95 | │ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │ 96 | ├───────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ 97 | │ rand_core │ CVE-2020-25576 │ CRITICAL │ fixed │ 0.4.0 │ 0.4.2, 0.3.1 │ An issue was discovered in the rand_core crate before 0.4.2 │ 98 | │ │ │ │ │ │ │ for Rust.... │ 99 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2020-25576 │ 100 | ├───────────┼────────────────┤ │ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ 101 | │ smallvec │ CVE-2019-15551 │ │ │ 0.6.9 │ 0.6.10 │ An issue was discovered in the smallvec crate before 0.6.10 │ 102 | │ │ │ │ │ │ │ for Rust.... │ 103 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-15551 │ 104 | │ ├────────────────┤ │ │ │ ├─────────────────────────────────────────────────────────────┤ 105 | │ │ CVE-2019-15554 │ │ │ │ │ An issue was discovered in the smallvec crate before 0.6.10 │ 106 | │ │ │ │ │ │ │ for Rust.... │ 107 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-15554 │ 108 | │ ├────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ 109 | │ │ CVE-2021-25900 │ │ │ │ 0.6.14, 1.6.1 │ An issue was discovered in the smallvec crate before 0.6.14 │ 110 | │ │ │ │ │ │ │ and 1.x... │ 111 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │ 112 | └───────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘ 113 | -------------------------------------------------------------------------------- /test/data/rootfs-scan/report: -------------------------------------------------------------------------------- 1 | 2 | Report Summary 3 | 4 | ┌────────┬──────┬─────────────────┬─────────┐ 5 | │ Target │ Type │ Vulnerabilities │ Secrets │ 6 | ├────────┼──────┼─────────────────┼─────────┤ 7 | │ - │ - │ - │ - │ 8 | └────────┴──────┴─────────────────┴─────────┘ 9 | Legend: 10 | - '-': Not scanned 11 | - '0': Clean (no security findings detected) 12 | 13 | -------------------------------------------------------------------------------- /test/data/secret-scan/report.json: -------------------------------------------------------------------------------- 1 | { 2 | "SchemaVersion": 2, 3 | "ArtifactName": "https://github.com/krol3/demo-trivy/", 4 | "ArtifactType": "repository", 5 | "Metadata": { 6 | "ImageConfig": { 7 | "architecture": "", 8 | "created": "0001-01-01T00:00:00Z", 9 | "os": "", 10 | "rootfs": { 11 | "type": "", 12 | "diff_ids": null 13 | }, 14 | "config": {} 15 | } 16 | }, 17 | "Results": [ 18 | { 19 | "Target": "env", 20 | "Class": "secret", 21 | "Secrets": [ 22 | { 23 | "RuleID": "github-pat", 24 | "Category": "GitHub", 25 | "Severity": "CRITICAL", 26 | "Title": "GitHub Personal Access Token", 27 | "StartLine": 5, 28 | "EndLine": 5, 29 | "Code": { 30 | "Lines": [ 31 | { 32 | "Number": 3, 33 | "Content": "export AWS_ACCESS_KEY_ID=1234567", 34 | "IsCause": false, 35 | "Annotation": "", 36 | "Truncated": false, 37 | "Highlighted": "export AWS_ACCESS_KEY_ID=1234567", 38 | "FirstCause": false, 39 | "LastCause": false 40 | }, 41 | { 42 | "Number": 4, 43 | "Content": "", 44 | "IsCause": false, 45 | "Annotation": "", 46 | "Truncated": false, 47 | "FirstCause": false, 48 | "LastCause": false 49 | }, 50 | { 51 | "Number": 5, 52 | "Content": "export GITHUB_PAT=****************************************", 53 | "IsCause": true, 54 | "Annotation": "", 55 | "Truncated": false, 56 | "Highlighted": "export GITHUB_PAT=****************************************", 57 | "FirstCause": true, 58 | "LastCause": true 59 | }, 60 | { 61 | "Number": 6, 62 | "Content": "", 63 | "IsCause": false, 64 | "Annotation": "", 65 | "Truncated": false, 66 | "FirstCause": false, 67 | "LastCause": false 68 | } 69 | ] 70 | }, 71 | "Match": "export GITHUB_PAT=****************************************", 72 | "Layer": {} 73 | } 74 | ] 75 | } 76 | ] 77 | } 78 | -------------------------------------------------------------------------------- /test/data/with-ignore-files/.trivyignore1: -------------------------------------------------------------------------------- 1 | # test data #1 for trivy-ignores option 2 | CVE-2020-25576 3 | CVE-2019-15551 4 | -------------------------------------------------------------------------------- /test/data/with-ignore-files/.trivyignore2: -------------------------------------------------------------------------------- 1 | # test data #2 for trivy-ignores option 2 | CVE-2019-15554 3 | -------------------------------------------------------------------------------- /test/data/with-ignore-files/report: -------------------------------------------------------------------------------- 1 | 2 | Report Summary 3 | 4 | ┌──────────────────────────────────────────┬────────┬─────────────────┬─────────┐ 5 | │ Target │ Type │ Vulnerabilities │ Secrets │ 6 | ├──────────────────────────────────────────┼────────┼─────────────────┼─────────┤ 7 | │ knqyf263/vuln-image:1.2.3 (alpine 3.7.1) │ alpine │ 19 │ - │ 8 | ├──────────────────────────────────────────┼────────┼─────────────────┼─────────┤ 9 | │ rust-app/Cargo.lock │ cargo │ 1 │ - │ 10 | └──────────────────────────────────────────┴────────┴─────────────────┴─────────┘ 11 | Legend: 12 | - '-': Not scanned 13 | - '0': Clean (no security findings detected) 14 | 15 | 16 | knqyf263/vuln-image:1.2.3 (alpine 3.7.1) 17 | ======================================== 18 | Total: 19 (CRITICAL: 19) 19 | 20 | ┌─────────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐ 21 | │ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │ 22 | ├─────────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 23 | │ curl │ CVE-2018-14618 │ CRITICAL │ fixed │ 7.61.0-r0 │ 7.61.1-r0 │ curl: NTLM password overflow via integer overflow │ 24 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-14618 │ 25 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 26 | │ │ CVE-2018-16839 │ │ │ │ 7.61.1-r1 │ curl: Integer overflow leading to heap-based buffer overflow │ 27 | │ │ │ │ │ │ │ in Curl_sasl_create_plain_message() │ 28 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16839 │ 29 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 30 | │ │ CVE-2018-16840 │ │ │ │ │ curl: Use-after-free when closing "easy" handle in │ 31 | │ │ │ │ │ │ │ Curl_close() │ 32 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16840 │ 33 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 34 | │ │ CVE-2018-16842 │ │ │ │ │ curl: Heap-based buffer over-read in the curl tool warning │ 35 | │ │ │ │ │ │ │ formatting │ 36 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16842 │ 37 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 38 | │ │ CVE-2019-3822 │ │ │ │ 7.61.1-r2 │ curl: NTLMv2 type-3 header stack buffer overflow │ 39 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-3822 │ 40 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 41 | │ │ CVE-2019-5481 │ │ │ │ 7.61.1-r3 │ curl: double free due to subsequent call of realloc() │ 42 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5481 │ 43 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 44 | │ │ CVE-2019-5482 │ │ │ │ │ curl: heap buffer overflow in function tftp_receive_packet() │ 45 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5482 │ 46 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 47 | │ git │ CVE-2018-17456 │ │ │ 2.15.2-r0 │ 2.15.3-r0 │ git: arbitrary code execution via .gitmodules │ 48 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-17456 │ 49 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 50 | │ │ CVE-2019-1353 │ │ │ │ 2.15.4-r0 │ git: NTFS protections inactive when running Git in the │ 51 | │ │ │ │ │ │ │ Windows Subsystem for... │ 52 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1353 │ 53 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 54 | │ libbz2 │ CVE-2019-12900 │ │ │ 1.0.6-r6 │ 1.0.6-r7 │ bzip2: out-of-bounds write in function BZ2_decompress │ 55 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-12900 │ 56 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 57 | │ libcurl │ CVE-2018-16839 │ │ │ 7.61.1-r0 │ 7.61.1-r1 │ curl: Integer overflow leading to heap-based buffer overflow │ 58 | │ │ │ │ │ │ │ in Curl_sasl_create_plain_message() │ 59 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16839 │ 60 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 61 | │ │ CVE-2018-16840 │ │ │ │ │ curl: Use-after-free when closing "easy" handle in │ 62 | │ │ │ │ │ │ │ Curl_close() │ 63 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16840 │ 64 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 65 | │ │ CVE-2018-16842 │ │ │ │ │ curl: Heap-based buffer over-read in the curl tool warning │ 66 | │ │ │ │ │ │ │ formatting │ 67 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16842 │ 68 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 69 | │ │ CVE-2019-3822 │ │ │ │ 7.61.1-r2 │ curl: NTLMv2 type-3 header stack buffer overflow │ 70 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-3822 │ 71 | │ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤ 72 | │ │ CVE-2019-5481 │ │ │ │ 7.61.1-r3 │ curl: double free due to subsequent call of realloc() │ 73 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5481 │ 74 | │ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤ 75 | │ │ CVE-2019-5482 │ │ │ │ │ curl: heap buffer overflow in function tftp_receive_packet() │ 76 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5482 │ 77 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 78 | │ musl │ CVE-2019-14697 │ │ │ 1.1.18-r3 │ 1.1.18-r4 │ musl libc through 1.1.23 has an x87 floating-point stack │ 79 | │ │ │ │ │ │ │ adjustment im ...... │ 80 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-14697 │ 81 | ├─────────────┤ │ │ │ │ │ │ 82 | │ musl-utils │ │ │ │ │ │ │ 83 | │ │ │ │ │ │ │ │ 84 | │ │ │ │ │ │ │ │ 85 | ├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤ 86 | │ sqlite-libs │ CVE-2019-8457 │ │ │ 3.21.0-r1 │ 3.25.3-r1 │ sqlite: heap out-of-bound read in function rtreenode() │ 87 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-8457 │ 88 | └─────────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴──────────────────────────────────────────────────────────────┘ 89 | 90 | rust-app/Cargo.lock (cargo) 91 | =========================== 92 | Total: 1 (CRITICAL: 1) 93 | 94 | ┌──────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐ 95 | │ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │ 96 | ├──────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ 97 | │ smallvec │ CVE-2021-25900 │ CRITICAL │ fixed │ 0.6.9 │ 0.6.14, 1.6.1 │ An issue was discovered in the smallvec crate before 0.6.14 │ 98 | │ │ │ │ │ │ │ and 1.x... │ 99 | │ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │ 100 | └──────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘ 101 | -------------------------------------------------------------------------------- /test/data/with-tf-vars/dev.tfvars: -------------------------------------------------------------------------------- 1 | # test data for trivy config with terraform variables 2 | bucket_versioning_enabled="Enabled" -------------------------------------------------------------------------------- /test/data/with-tf-vars/main.tf: -------------------------------------------------------------------------------- 1 | # test data for trivy config with terraform variables 2 | 3 | variable "bucket_versioning_enabled" { 4 | type = string 5 | default = "Disabled" 6 | } 7 | 8 | resource "aws_s3_bucket" "bucket" { 9 | bucket = "trivy-action-bucket" 10 | } 11 | 12 | resource "aws_s3_bucket_versioning" "bucket_versioning" { 13 | bucket = aws_s3_bucket.bucket.id 14 | 15 | versioning_configuration { 16 | status = var.bucket_versioning_enabled 17 | } 18 | } -------------------------------------------------------------------------------- /test/data/with-tf-vars/report.json: -------------------------------------------------------------------------------- 1 | { 2 | "SchemaVersion": 2, 3 | "ArtifactName": "test/data/with-tf-vars/main.tf", 4 | "ArtifactType": "filesystem", 5 | "Metadata": { 6 | "ImageConfig": { 7 | "architecture": "", 8 | "created": "0001-01-01T00:00:00Z", 9 | "os": "", 10 | "rootfs": { 11 | "type": "", 12 | "diff_ids": null 13 | }, 14 | "config": {} 15 | } 16 | }, 17 | "Results": [ 18 | { 19 | "Target": ".", 20 | "Class": "config", 21 | "Type": "terraform", 22 | "MisconfSummary": { 23 | "Successes": 19, 24 | "Failures": 0 25 | } 26 | }, 27 | { 28 | "Target": "main.tf", 29 | "Class": "config", 30 | "Type": "terraform" 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /test/data/with-trivy-yaml-cfg/report.json: -------------------------------------------------------------------------------- 1 | { 2 | "SchemaVersion": 2, 3 | "CreatedAt": "2025-06-03T01:26:45.367171-06:00", 4 | "ArtifactName": "alpine:3.10", 5 | "ArtifactType": "container_image", 6 | "Metadata": { 7 | "Size": 5842432, 8 | "OS": { 9 | "Family": "alpine", 10 | "Name": "3.10.9", 11 | "EOSL": true 12 | }, 13 | "ImageID": "sha256:e7b300aee9f9bf3433d32bc9305bfdd22183beb59d933b48d77ab56ba53a197a", 14 | "DiffIDs": [ 15 | "sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635" 16 | ], 17 | "RepoTags": [ 18 | "alpine:3.10" 19 | ], 20 | "RepoDigests": [ 21 | "alpine@sha256:451eee8bedcb2f029756dc3e9d73bab0e7943c1ac55cff3a4861c52a0fdd3e98" 22 | ], 23 | "ImageConfig": { 24 | "architecture": "amd64", 25 | "container": "fdb7e80e3339e8d0599282e606c907aa5881ee4c668a68136119e6dfac6ce3a4", 26 | "created": "2021-04-14T19:20:05.338397761Z", 27 | "docker_version": "19.03.12", 28 | "history": [ 29 | { 30 | "created": "2021-04-14T19:20:04.987219124Z", 31 | "created_by": "/bin/sh -c #(nop) ADD file:c5377eaa926bf412dd8d4a08b0a1f2399cfd708743533b0aa03b53d14cb4bb4e in / " 32 | }, 33 | { 34 | "created": "2021-04-14T19:20:05.338397761Z", 35 | "created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]", 36 | "empty_layer": true 37 | } 38 | ], 39 | "os": "linux", 40 | "rootfs": { 41 | "type": "layers", 42 | "diff_ids": [ 43 | "sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635" 44 | ] 45 | }, 46 | "config": { 47 | "Cmd": [ 48 | "/bin/sh" 49 | ], 50 | "Env": [ 51 | "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 52 | ], 53 | "Image": "sha256:eb2080c455e94c22ae35b3aef9e078c492a00795412e026e4d6b41ef64bc7dd8" 54 | } 55 | }, 56 | "Layers": [ 57 | { 58 | "Size": 5842432, 59 | "Digest": "sha256:396c31837116ac290458afcb928f68b6cc1c7bdd6963fc72f52f365a2a89c1b5", 60 | "DiffID": "sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635" 61 | } 62 | ] 63 | }, 64 | "Results": [ 65 | { 66 | "Target": "alpine:3.10 (alpine 3.10.9)", 67 | "Class": "os-pkgs", 68 | "Type": "alpine", 69 | "Vulnerabilities": [ 70 | { 71 | "VulnerabilityID": "CVE-2021-36159", 72 | "PkgID": "apk-tools@2.10.6-r0", 73 | "PkgName": "apk-tools", 74 | "PkgIdentifier": { 75 | "PURL": "pkg:apk/alpine/apk-tools@2.10.6-r0?arch=x86_64\u0026distro=3.10.9", 76 | "UID": "b7a64ae671a99195" 77 | }, 78 | "InstalledVersion": "2.10.6-r0", 79 | "FixedVersion": "2.10.7-r0", 80 | "Status": "fixed", 81 | "Layer": { 82 | "Digest": "sha256:396c31837116ac290458afcb928f68b6cc1c7bdd6963fc72f52f365a2a89c1b5", 83 | "DiffID": "sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635" 84 | }, 85 | "SeveritySource": "nvd", 86 | "PrimaryURL": "https://avd.aquasec.com/nvd/cve-2021-36159", 87 | "DataSource": { 88 | "ID": "alpine", 89 | "Name": "Alpine Secdb", 90 | "URL": "https://secdb.alpinelinux.org/" 91 | }, 92 | "Title": "libfetch: an out of boundary read while libfetch uses strtol to parse the relevant numbers into address bytes leads to information leak or crash", 93 | "Description": "libfetch before 2021-07-26, as used in apk-tools, xbps, and other products, mishandles numeric strings for the FTP and HTTP protocols. The FTP passive mode implementation allows an out-of-bounds read because strtol is used to parse the relevant numbers into address bytes. It does not check if the line ends prematurely. If it does, the for-loop condition checks for the '\\0' terminator one byte too late.", 94 | "Severity": "CRITICAL", 95 | "CweIDs": [ 96 | "CWE-125" 97 | ], 98 | "VendorSeverity": { 99 | "nvd": 4, 100 | "redhat": 3 101 | }, 102 | "CVSS": { 103 | "nvd": { 104 | "V2Vector": "AV:N/AC:L/Au:N/C:P/I:N/A:P", 105 | "V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H", 106 | "V2Score": 6.4, 107 | "V3Score": 9.1 108 | }, 109 | "redhat": { 110 | "V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H", 111 | "V3Score": 9.1 112 | } 113 | }, 114 | "References": [ 115 | "https://access.redhat.com/security/cve/CVE-2021-36159", 116 | "https://github.com/freebsd/freebsd-src/commits/main/lib/libfetch", 117 | "https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10749", 118 | "https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc%40%3Cdev.kafka.apache.org%3E", 119 | "https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc%40%3Cusers.kafka.apache.org%3E", 120 | "https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7%40%3Cdev.kafka.apache.org%3E", 121 | "https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7%40%3Cusers.kafka.apache.org%3E", 122 | "https://nvd.nist.gov/vuln/detail/CVE-2021-36159", 123 | "https://www.cve.org/CVERecord?id=CVE-2021-36159" 124 | ], 125 | "PublishedDate": "2021-08-03T14:15:08.233Z", 126 | "LastModifiedDate": "2023-11-07T03:36:43.337Z" 127 | } 128 | ] 129 | } 130 | ] 131 | } 132 | -------------------------------------------------------------------------------- /test/data/with-trivy-yaml-cfg/trivy.yaml: -------------------------------------------------------------------------------- 1 | format: json 2 | severity: CRITICAL 3 | vulnerability: 4 | type: os 5 | output: yamlconfig.json -------------------------------------------------------------------------------- /test/test.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | setup_file() { 4 | local owner=$GITHUB_REPOSITORY_OWNER 5 | export TRIVY_DB_REPOSITORY=ghcr.io/${owner}/trivy-db-act:latest 6 | export TRIVY_JAVA_DB_REPOSITORY=ghcr.io/${owner}/trivy-java-db-act:latest 7 | export TRIVY_CHECKS_BUNDLE_REPOSITORY=ghcr.io/${owner}/trivy-checks-act:latest 8 | } 9 | 10 | setup() { 11 | bats_load_library bats-support 12 | bats_load_library bats-assert 13 | bats_load_library bats-file 14 | } 15 | 16 | function remove_json_fields() { 17 | local file="$1" 18 | if [[ "$file" == *.json ]]; then 19 | jq 'del(.CreatedAt)' "$file" > tmp && mv tmp "$file" 20 | fi 21 | } 22 | 23 | function remove_sarif_fields() { 24 | local file="$1" 25 | if [[ "$file" == *.sarif ]]; then 26 | jq 'del(.runs[].tool.driver.version) | del(.runs[].originalUriBaseIds)' "$file" > tmp && mv tmp "$file" 27 | fi 28 | } 29 | 30 | function remove_github_fields() { 31 | local file="$1" 32 | if [[ "$file" == *.gsbom ]]; then 33 | jq 'del(.detector.version) | del(.scanned) | del(.job) | del(.ref) | del(.sha)' "$file" > tmp && mv tmp "$file" 34 | fi 35 | } 36 | 37 | function reset_envs() { 38 | local var 39 | for var in $(env | grep '^TRIVY_\|^INPUT_' | cut -d= -f1); do 40 | unset "$var" 41 | done 42 | rm -f trivy_envs.txt 43 | } 44 | 45 | function compare_files() { 46 | local file1="$1" 47 | local file2="$2" 48 | 49 | # Some fields should be removed as they are environment dependent 50 | # and may cause undesirable results when comparing files. 51 | remove_json_fields "$file1" 52 | remove_json_fields "$file2" 53 | 54 | remove_sarif_fields "$file1" 55 | remove_sarif_fields "$file2" 56 | 57 | remove_github_fields "$file1" 58 | remove_github_fields "$file2" 59 | 60 | run diff "$file1" "$file2" 61 | echo "$output" 62 | assert_files_equal "$file1" "$file2" 63 | } 64 | 65 | @test "trivy repo with securityCheck secret only" { 66 | # trivy repo -f json -o repo.test --scanners=secret https://github.com/krol3/demo-trivy/ 67 | export TRIVY_FORMAT=json TRIVY_OUTPUT=repo.json TRIVY_SCANNERS=secret INPUT_SCAN_TYPE=repo INPUT_SCAN_REF="https://github.com/krol3/demo-trivy/" 68 | ./entrypoint.sh 69 | compare_files repo.json ./test/data/secret-scan/report.json 70 | reset_envs 71 | } 72 | 73 | @test "trivy image" { 74 | # trivy image --severity CRITICAL -o image.test knqyf263/vuln-image:1.2.3 75 | export TRIVY_OUTPUT=image.test TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3 76 | ./entrypoint.sh 77 | compare_files image.test ./test/data/image-scan/report 78 | reset_envs 79 | } 80 | 81 | @test "trivy config sarif report" { 82 | # trivy config -f sarif -o config-sarif.test ./test/data/config-sarif-report 83 | export TRIVY_FORMAT=sarif TRIVY_OUTPUT=config-sarif.sarif INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/config-sarif-report 84 | ./entrypoint.sh 85 | compare_files config-sarif.sarif ./test/data/config-sarif-report/report.sarif 86 | reset_envs 87 | } 88 | 89 | @test "trivy config" { 90 | # trivy config -f json -o config.json ./test/data/config-scan 91 | export TRIVY_FORMAT=json TRIVY_OUTPUT=config.json INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/config-scan 92 | ./entrypoint.sh 93 | compare_files config.json ./test/data/config-scan/report.json 94 | reset_envs 95 | } 96 | 97 | @test "trivy rootfs" { 98 | # trivy rootfs --output rootfs.test ./test/data/rootfs-scan 99 | # TODO: add data 100 | export TRIVY_OUTPUT=rootfs.test INPUT_SCAN_TYPE=rootfs INPUT_SCAN_REF=./test/data/rootfs-scan 101 | ./entrypoint.sh 102 | compare_files rootfs.test ./test/data/rootfs-scan/report 103 | reset_envs 104 | } 105 | 106 | @test "trivy fs" { 107 | # trivy fs --output fs.test ./test/data/fs-scan 108 | # TODO: add data 109 | export TRIVY_OUTPUT=fs.test INPUT_SCAN_TYPE=fs INPUT_SCAN_REF=./test/data/fs-scan 110 | ./entrypoint.sh 111 | compare_files fs.test ./test/data/fs-scan/report 112 | reset_envs 113 | } 114 | 115 | @test "trivy image with trivyIgnores option" { 116 | # cat ./test/data/with-ignore-files/.trivyignore1 ./test/data/with-ignore-files/.trivyignore2 > ./trivyignores ; trivy image --severity CRITICAL --output image-trivyignores.test --ignorefile ./trivyignores knqyf263/vuln-image:1.2.3 117 | export TRIVY_OUTPUT=image-trivyignores.test TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_IMAGE_REF=knqyf263/vuln-image:1.2.3 INPUT_TRIVYIGNORES="./test/data/with-ignore-files/.trivyignore1,./test/data/with-ignore-files/.trivyignore2" 118 | ./entrypoint.sh 119 | compare_files image-trivyignores.test ./test/data/with-ignore-files/report 120 | reset_envs 121 | } 122 | 123 | @test "trivy image with sbom output" { 124 | # trivy image --format github knqyf263/vuln-image:1.2.3 125 | export TRIVY_FORMAT=github TRIVY_OUTPUT=github-dep-snapshot.gsbom INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3 126 | ./entrypoint.sh 127 | compare_files github-dep-snapshot.gsbom ./test/data/github-dep-snapshot/report.gsbom 128 | reset_envs 129 | } 130 | 131 | @test "trivy image with trivy.yaml config" { 132 | # trivy --config=./test/data/with-trivy-yaml-cfg/trivy.yaml image alpine:3.10 133 | export TRIVY_CONFIG=./test/data/with-trivy-yaml-cfg/trivy.yaml INPUT_SCAN_TYPE=image INPUT_SCAN_REF=alpine:3.10 134 | ./entrypoint.sh 135 | compare_files yamlconfig.json ./test/data/with-trivy-yaml-cfg/report.json 136 | reset_envs 137 | } 138 | 139 | @test "trivy image with custom docker-host" { 140 | # trivy image --docker-host unix:///var/run/docker.sock --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3 141 | export TRIVY_OUTPUT=image.test TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3 TRIVY_DOCKER_HOST=unix:///var/run/docker.sock 142 | ./entrypoint.sh 143 | compare_files image.test ./test/data/image-scan/report 144 | reset_envs 145 | } 146 | 147 | @test "trivy config with terraform variables" { 148 | # trivy config -f json -o tfvars.json --severity MEDIUM --tf-vars ./test/data/with-tf-vars/dev.tfvars ./test/data/with-tf-vars/main.tf 149 | export TRIVY_FORMAT=json TRIVY_SEVERITY=MEDIUM TRIVY_OUTPUT=tfvars.json INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/with-tf-vars/main.tf TRIVY_TF_VARS=./test/data/with-tf-vars/dev.tfvars 150 | ./entrypoint.sh 151 | compare_files tfvars.json ./test/data/with-tf-vars/report.json 152 | reset_envs 153 | } 154 | 155 | @test "trivy image via environment file" { 156 | # trivy image --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3 157 | # Action injects inputs into the script via environment variables 158 | echo "export TRIVY_OUTPUT=image.test" >> trivy_envs.txt 159 | echo "export TRIVY_SEVERITY=CRITICAL" >> trivy_envs.txt 160 | echo "export INPUT_SCAN_TYPE=image" >> trivy_envs.txt 161 | echo "export INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3" >> trivy_envs.txt 162 | ./entrypoint.sh 163 | compare_files image.test ./test/data/image-scan/report 164 | reset_envs 165 | } 166 | 167 | @test "trivy image via environment file overrides env leakages" { 168 | # trivy image --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3 169 | # Action injects inputs into the script via environment variables 170 | # If caller mixes old and new trivy-action version they could still have env leakage so verify that env vars already 171 | # in the env are overridden by those from the envs file 172 | export INPUT_SCAN_REF=no/such-image:1.2.3 173 | echo "export TRIVY_OUTPUT=image.test" >> trivy_envs.txt 174 | echo "export TRIVY_SEVERITY=CRITICAL" >> trivy_envs.txt 175 | echo "export INPUT_SCAN_TYPE=image" >> trivy_envs.txt 176 | echo "export INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3" >> trivy_envs.txt 177 | ./entrypoint.sh 178 | compare_files image.test ./test/data/image-scan/report 179 | reset_envs 180 | } -------------------------------------------------------------------------------- /workflow.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | jobs: 8 | build: 9 | name: Build 10 | runs-on: ubuntu-20.04 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v3 14 | 15 | - name: Build an image from Dockerfile 16 | run: | 17 | docker build -t docker.io/my-organization/my-app:${{ github.sha }} . 18 | 19 | - name: Run Trivy vulnerability scanner 20 | uses: aquasecurity/trivy-action@master 21 | with: 22 | image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}' 23 | exit-code: '1' 24 | ignore-unfixed: true 25 | vuln-type: 'os,library' 26 | format: 'template' 27 | template: '@/contrib/sarif.tpl' 28 | output: 'trivy-results.sarif' 29 | severity: 'CRITICAL,HIGH' 30 | 31 | - name: Upload Trivy scan results to GitHub Security tab 32 | uses: github/codeql-action/upload-sarif@v3 33 | with: 34 | sarif_file: 'trivy-results.sarif' 35 | --------------------------------------------------------------------------------