Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c07df6fec6 | |||
| df678dbccf | |||
| cf5c088a69 | |||
| 476e4fdcdc | |||
| 52d14fa83d | |||
| e671314e1a | |||
| bfa4b33a02 | |||
| 68b488a75b | |||
| 314ff8b431 | |||
| ed142fd067 | |||
| dea62cf79a | |||
| 128d9a8815 | |||
| 876cf04c63 | |||
| dada78485d | |||
| 4a2deec910 | |||
| 1994662b55 | |||
| 6b36659d99 | |||
| 316aa5aebe | |||
| 264c9c5e18 | |||
| aeb13962e8 | |||
| f685ba7215 | |||
| 34f2b232c5 | |||
| 57a97c7e78 | |||
| 97e0b3872f | |||
| 4c61e6329b | |||
| 1bd062560b | |||
| bce3086c4a | |||
| 5a9fbb1236 | |||
| 16154502ca | |||
| df85774a45 | |||
| 56c8daebb9 | |||
| e368e32897 | |||
| 6476b939ea | |||
| c1824fd6ed | |||
| bc61dc5570 | |||
| 5eb7ef2605 | |||
| 22438a4357 | |||
| 0024b3f39e | |||
| 83690f7d38 | |||
| df65449f48 | |||
| 0317097f59 | |||
| b6643a29fe |
@@ -0,0 +1,12 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
cooldown:
|
||||||
|
default-days: 7
|
||||||
|
groups:
|
||||||
|
actions:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
@@ -10,35 +10,70 @@ on:
|
|||||||
|
|
||||||
run-name: Bump trivy to v${{ inputs.trivy_version }}
|
run-name: Bump trivy to v${{ inputs.trivy_version }}
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump:
|
bump:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-2404-2core
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||||
|
with:
|
||||||
- name: Set new version from input
|
persist-credentials: false
|
||||||
run: echo "NEW_VERSION=${{ inputs.trivy_version }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Update Trivy versions
|
- name: Update Trivy versions
|
||||||
|
env:
|
||||||
|
NEW_VERSION: ${{ inputs.trivy_version }}
|
||||||
run: make bump-trivy
|
run: make bump-trivy
|
||||||
|
|
||||||
|
- name: Setup Bats and bats libs
|
||||||
|
id: setup-bats
|
||||||
|
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
|
||||||
|
|
||||||
|
- name: Install Trivy
|
||||||
|
run: make ensure-trivy TRIVY_INSTALL_DIR=/usr/local/bin
|
||||||
|
|
||||||
- name: Update golden files
|
- name: Update golden files
|
||||||
|
env:
|
||||||
|
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
|
||||||
run: make update-golden
|
run: make update-golden
|
||||||
|
|
||||||
- name: Create PR
|
- name: Run tests
|
||||||
id: create-pr
|
env:
|
||||||
uses: peter-evans/create-pull-request@v5
|
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
|
||||||
with:
|
run: make test
|
||||||
token: ${{ secrets.ORG_REPO_TOKEN }}
|
|
||||||
title: "chore(deps): Update trivy to v${{ inputs.trivy_version }}"
|
|
||||||
commit-message: "chore(deps): Update trivy to v${{ inputs.trivy_version }}"
|
|
||||||
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
|
||||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
||||||
branch-suffix: timestamp
|
|
||||||
branch: bump-trivy
|
|
||||||
delete-branch: true
|
|
||||||
|
|
||||||
- name: Check outputs
|
# Use a GitHub App token because GITHUB_TOKEN does not trigger CI on PRs created by workflows
|
||||||
|
- name: Generate token
|
||||||
|
id: app-token
|
||||||
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.REPO_TRIVY_ACTION_WRITE_GH_APP_CLIENT_ID }}
|
||||||
|
private-key: ${{ secrets.REPO_TRIVY_ACTION_WRITE_GH_APP_PRIVATE_KEY }}
|
||||||
|
owner: ${{ github.repository_owner }}
|
||||||
|
repositories: ${{ github.event.repository.name }}
|
||||||
|
permission-contents: write
|
||||||
|
permission-pull-requests: write
|
||||||
|
|
||||||
|
- name: Create PR
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
TRIVY_VERSION: ${{ inputs.trivy_version }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
BASE_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
run: |
|
run: |
|
||||||
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
|
gh auth setup-git
|
||||||
echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}"
|
git config user.name "GitHub Actions"
|
||||||
|
git config user.email "actions@github.com"
|
||||||
|
BRANCH="bump-trivy-${TRIVY_VERSION}"
|
||||||
|
git checkout -b "${BRANCH}"
|
||||||
|
git add action.yaml README.md test/
|
||||||
|
git commit -m "chore(deps): Update trivy to v${TRIVY_VERSION}"
|
||||||
|
git push origin "${BRANCH}"
|
||||||
|
PR_RESPONSE=$(gh api repos/${REPO}/pulls \
|
||||||
|
--method POST \
|
||||||
|
--field title="chore(deps): Update trivy to v${TRIVY_VERSION}" \
|
||||||
|
--field body="This PR was automatically generated by the bump-trivy workflow." \
|
||||||
|
--field base="${BASE_BRANCH}" \
|
||||||
|
--field head="${BRANCH}")
|
||||||
|
echo "Pull Request Number - $(echo "${PR_RESPONSE}" | jq -r '.number')"
|
||||||
|
echo "Pull Request URL - $(echo "${PR_RESPONSE}" | jq -r '.html_url')"
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
name: Sync Trivy Checks
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: ${{ github.repository_owner }}/trivy-checks-act
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sync-trivy-checks:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: setup-oras
|
|
||||||
uses: oras-project/setup-oras@v1.2.3
|
|
||||||
|
|
||||||
- name: Login to GitHub Packages Container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Copy Trivy Checks
|
|
||||||
run: |
|
|
||||||
oras cp ghcr.io/aquasecurity/trivy-checks:1 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
name: Sync Trivy DB
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: ${{ github.repository_owner }}/trivy-db-act
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sync-trivy-db:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: setup-oras
|
|
||||||
uses: oras-project/setup-oras@v1.2.3
|
|
||||||
|
|
||||||
- name: Login to GitHub Packages Container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Copy Trivy DB
|
|
||||||
run: |
|
|
||||||
oras cp ghcr.io/aquasecurity/trivy-db:2 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
name: Sync Trivy Java DB
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: ${{ github.repository_owner }}/trivy-java-db-act
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sync-trivy-db:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: setup-oras
|
|
||||||
uses: oras-project/setup-oras@v1.2.3
|
|
||||||
|
|
||||||
- name: Login to GitHub Packages Container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Copy Trivy Java DB
|
|
||||||
run: |
|
|
||||||
oras cp ghcr.io/aquasecurity/trivy-java-db:1 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
+24
-10
@@ -6,26 +6,40 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TRIVY_VERSION: 0.65.0
|
|
||||||
BATS_LIB_PATH: '/usr/lib/'
|
BATS_LIB_PATH: '/usr/lib/'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Run zizmor
|
||||||
|
uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7
|
||||||
|
with:
|
||||||
|
advanced-security: false
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Setup Bats and bats libs
|
- name: Setup Bats and bats libs
|
||||||
uses: bats-core/bats-action@2.0.0
|
id: setup-bats
|
||||||
|
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
|
||||||
|
|
||||||
- name: Install Trivy
|
- name: Install Trivy
|
||||||
run: |
|
run: make ensure-trivy TRIVY_INSTALL_DIR=/usr/local/bin
|
||||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v${{ env.TRIVY_VERSION }}
|
|
||||||
trivy --version
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: bats --recursive --timing --verbose-run .
|
|
||||||
env:
|
env:
|
||||||
TRIVY_CACHE_DIR: .cache
|
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
|
||||||
TRIVY_DISABLE_VEX_NOTICE: true
|
run: make test
|
||||||
TRIVY_DEBUG: true
|
|
||||||
|
|||||||
+4
-1
@@ -4,4 +4,7 @@
|
|||||||
trivyignores
|
trivyignores
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
.cache
|
.cache
|
||||||
|
|
||||||
|
# Local tools
|
||||||
|
.bin/
|
||||||
|
|||||||
@@ -1,36 +1,73 @@
|
|||||||
OS := $(shell uname)
|
OS := $(shell uname)
|
||||||
SED = sed
|
|
||||||
BATS_LIB_PATH = /usr/local/lib/
|
|
||||||
|
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
SED = gsed
|
SED = gsed
|
||||||
BATS_LIB_PATH = /opt/homebrew/lib
|
BATS_LIB_PATH ?= /opt/homebrew/lib
|
||||||
|
else
|
||||||
|
SED = sed
|
||||||
|
BATS_LIB_PATH ?= /usr/local/lib/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
LOCAL_BIN := $(CURDIR)/.bin
|
||||||
|
TRIVY_INSTALL_DIR ?= $(LOCAL_BIN)
|
||||||
|
LOCAL_TRIVY := $(TRIVY_INSTALL_DIR)/trivy
|
||||||
|
|
||||||
|
ifeq ($(shell [ -f $(LOCAL_TRIVY) ] && [ -z "$(CI)" ] && echo yes),yes)
|
||||||
|
TRIVY_CMD := $(LOCAL_TRIVY)
|
||||||
|
else
|
||||||
|
TRIVY_CMD ?= trivy
|
||||||
|
endif
|
||||||
|
|
||||||
|
CACHE_DIR := '.cache'
|
||||||
|
|
||||||
|
ACTION_FILE := action.yaml
|
||||||
|
|
||||||
|
CURRENT_TRIVY_VERSION := $(shell yq '.inputs.version.default' $(ACTION_FILE) 2>/dev/null | tr -d 'v')
|
||||||
|
|
||||||
BATS_ENV := BATS_LIB_PATH=$(BATS_LIB_PATH) \
|
BATS_ENV := BATS_LIB_PATH=$(BATS_LIB_PATH) \
|
||||||
GITHUB_REPOSITORY_OWNER=aquasecurity \
|
TRIVY_CACHE_DIR=$(CACHE_DIR) \
|
||||||
TRIVY_CACHE_DIR=.cache \
|
|
||||||
TRIVY_DISABLE_VEX_NOTICE=true \
|
|
||||||
TRIVY_DEBUG=true
|
TRIVY_DEBUG=true
|
||||||
|
|
||||||
BATS_FLAGS := --recursive --timing --verbose-run .
|
BATS_FLAGS := --timing --verbose-run test/test.bats
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: init-cache
|
test:
|
||||||
$(BATS_ENV) bats $(BATS_FLAGS)
|
TRIVY_CMD=$(TRIVY_CMD) $(BATS_ENV) bats $(BATS_FLAGS)
|
||||||
|
|
||||||
.PHONY: update-golden
|
.PHONY: update-golden
|
||||||
update-golden: init-cache
|
update-golden:
|
||||||
UPDATE_GOLDEN=1 $(BATS_ENV) bats $(BATS_FLAGS)
|
UPDATE_GOLDEN=1 TRIVY_CMD=$(TRIVY_CMD) $(BATS_ENV) bats $(BATS_FLAGS)
|
||||||
|
|
||||||
.PHONY: init-cache
|
.PHONY: clean-cache
|
||||||
init-cache:
|
clean-cache:
|
||||||
mkdir -p .cache
|
$(TRIVY_CMD) clean --scan-cache --cache-dir $(CACHE_DIR)
|
||||||
rm -f .cache/fanal/fanal.db
|
|
||||||
|
|
||||||
bump-trivy:
|
.PHONY: check-yq
|
||||||
|
check-yq:
|
||||||
|
@command -v yq >/dev/null 2>&1 || (echo "yq is required but not installed. Install it from https://github.com/mikefarah/yq"; exit 1)
|
||||||
|
|
||||||
|
bump-trivy: check-yq
|
||||||
@[ $$NEW_VERSION ] || ( echo "env 'NEW_VERSION' is not set"; exit 1 )
|
@[ $$NEW_VERSION ] || ( echo "env 'NEW_VERSION' is not set"; exit 1 )
|
||||||
@CURRENT_VERSION=$$(grep "TRIVY_VERSION:" .github/workflows/test.yaml | awk '{print $$2}');\
|
@echo Current version: $(CURRENT_TRIVY_VERSION) ;\
|
||||||
echo Current version: $$CURRENT_VERSION ;\
|
|
||||||
echo New version: $$NEW_VERSION ;\
|
echo New version: $$NEW_VERSION ;\
|
||||||
$(SED) -i -e "s/$$CURRENT_VERSION/$$NEW_VERSION/g" README.md action.yaml .github/workflows/test.yaml ;\
|
$(SED) -i -e "s/$(CURRENT_TRIVY_VERSION)/$$NEW_VERSION/g" \
|
||||||
|
README.md $(ACTION_FILE)
|
||||||
|
|
||||||
|
.PHONY: ensure-trivy
|
||||||
|
ensure-trivy: check-yq
|
||||||
|
@set -e; \
|
||||||
|
mkdir -p $(TRIVY_INSTALL_DIR); \
|
||||||
|
if [ -x $(LOCAL_TRIVY) ]; then \
|
||||||
|
CURRENT_VERSION="$$( $(LOCAL_TRIVY) version -f json | jq -r '.Version' )"; \
|
||||||
|
else \
|
||||||
|
CURRENT_VERSION=none; \
|
||||||
|
fi; \
|
||||||
|
echo "Required: $(CURRENT_TRIVY_VERSION)"; \
|
||||||
|
echo "Current: $$CURRENT_VERSION"; \
|
||||||
|
if [ "$$CURRENT_VERSION" != "$(CURRENT_TRIVY_VERSION)" ]; then \
|
||||||
|
echo "Installing Trivy $(CURRENT_TRIVY_VERSION) locally..."; \
|
||||||
|
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | \
|
||||||
|
sh -s -- -b $(TRIVY_INSTALL_DIR) v$(CURRENT_TRIVY_VERSION); \
|
||||||
|
else \
|
||||||
|
echo "Trivy $(CURRENT_TRIVY_VERSION) already present."; \
|
||||||
|
fi
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
- name: Build an image from Dockerfile
|
- name: Build an image from Dockerfile
|
||||||
run: docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
run: docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'table'
|
format: 'table'
|
||||||
@@ -78,7 +78,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in fs mode
|
- name: Run Trivy vulnerability scanner in fs mode
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
scan-ref: '.'
|
scan-ref: '.'
|
||||||
@@ -119,7 +119,7 @@ If you want to disable caching, set the `cache` input to `false`, but we recomme
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner without cache
|
- name: Run Trivy scanner without cache
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
scan-ref: '.'
|
scan-ref: '.'
|
||||||
@@ -180,7 +180,7 @@ When running a scan, set the environment variables `TRIVY_SKIP_DB_UPDATE` and `T
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner without downloading DBs
|
- name: Run Trivy scanner without downloading DBs
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'image'
|
scan-type: 'image'
|
||||||
scan-ref: 'myimage'
|
scan-ref: 'myimage'
|
||||||
@@ -215,10 +215,10 @@ jobs:
|
|||||||
uses: aquasecurity/setup-trivy@v0.2.0
|
uses: aquasecurity/setup-trivy@v0.2.0
|
||||||
with:
|
with:
|
||||||
cache: true
|
cache: true
|
||||||
version: v0.65.0
|
version: v0.72.0
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in repo mode
|
- name: Run Trivy vulnerability scanner in repo mode
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
@@ -252,7 +252,7 @@ jobs:
|
|||||||
|
|
||||||
# The first call to the action will invoke setup-trivy and install trivy
|
# The first call to the action will invoke setup-trivy and install trivy
|
||||||
- name: Generate Trivy Vulnerability Report
|
- name: Generate Trivy Vulnerability Report
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
output: trivy-report.json
|
output: trivy-report.json
|
||||||
@@ -268,7 +268,7 @@ jobs:
|
|||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
- name: Fail build on High/Criticial Vulnerabilities
|
- name: Fail build on High/Criticial Vulnerabilities
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
format: table
|
format: table
|
||||||
@@ -287,7 +287,7 @@ Therefore, you can't install `Trivy` using the `setup-trivy` action.
|
|||||||
To fix this problem, you need to overwrite the token for `setup-trivy` using `token-setup-trivy` input:
|
To fix this problem, you need to overwrite the token for `setup-trivy` using `token-setup-trivy` input:
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner without cache
|
- name: Run Trivy scanner without cache
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
scan-ref: '.'
|
scan-ref: '.'
|
||||||
@@ -318,7 +318,7 @@ jobs:
|
|||||||
docker save -o vuln-image.tar <your-docker-image>
|
docker save -o vuln-image.tar <your-docker-image>
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in tarball mode
|
- name: Run Trivy vulnerability scanner in tarball mode
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
input: /github/workspace/vuln-image.tar
|
input: /github/workspace/vuln-image.tar
|
||||||
severity: 'CRITICAL,HIGH'
|
severity: 'CRITICAL,HIGH'
|
||||||
@@ -345,7 +345,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
scan-ref: .
|
scan-ref: .
|
||||||
@@ -374,7 +374,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
scan-ref: .
|
scan-ref: .
|
||||||
@@ -395,6 +395,9 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -404,14 +407,14 @@ jobs:
|
|||||||
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
@@ -430,6 +433,9 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -439,14 +445,14 @@ jobs:
|
|||||||
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
@@ -455,7 +461,7 @@ jobs:
|
|||||||
See this for more details: https://docs.github.com/en/actions/learn-github-actions/expressions#always
|
See this for more details: https://docs.github.com/en/actions/learn-github-actions/expressions#always
|
||||||
|
|
||||||
### Using Trivy to scan your Git repo
|
### Using Trivy to scan your Git repo
|
||||||
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.
|
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 vulnerabilities that might get introduced with each PR.
|
||||||
|
|
||||||
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:
|
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:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -469,12 +475,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in repo mode
|
- name: Run Trivy vulnerability scanner in repo mode
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
@@ -483,13 +492,13 @@ jobs:
|
|||||||
severity: 'CRITICAL'
|
severity: 'CRITICAL'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Trivy to scan your rootfs directories
|
### Using Trivy to scan your rootfs directories
|
||||||
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.
|
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 vulnerabilities that might get introduced with each PR.
|
||||||
|
|
||||||
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:
|
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:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -503,12 +512,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner with rootfs command
|
- name: Run Trivy vulnerability scanner with rootfs command
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'rootfs'
|
scan-type: 'rootfs'
|
||||||
scan-ref: 'rootfs-example-binary'
|
scan-ref: 'rootfs-example-binary'
|
||||||
@@ -518,13 +530,15 @@ jobs:
|
|||||||
severity: 'CRITICAL'
|
severity: 'CRITICAL'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Trivy to scan Infrastructure as Code
|
### Using Trivy to scan Infrastructure as Code
|
||||||
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.
|
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 vulnerabilities that might get introduced with each PR.
|
||||||
|
|
||||||
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:
|
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:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -538,12 +552,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in IaC mode
|
- name: Run Trivy vulnerability scanner in IaC mode
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'config'
|
scan-type: 'config'
|
||||||
hide-progress: true
|
hide-progress: true
|
||||||
@@ -553,11 +570,26 @@ jobs:
|
|||||||
severity: 'CRITICAL,HIGH'
|
severity: 'CRITICAL,HIGH'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
if: always()
|
||||||
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note**: If your Terraform configuration contains private modules, configure Git to authenticate with the repository hosting them.
|
||||||
|
This can be done by adding a step in your CI workflow that sets up access, for example using a Personal Access Token (PAT) or SSH keys:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Configure Git for private modules
|
||||||
|
run: |
|
||||||
|
git config --global url."https://$GITHUB_USER:$PRIVATE_REPO_TOKEN@github.com/".insteadOf "https://github.com/"
|
||||||
|
env:
|
||||||
|
GITHUB_USER: ${{ github.actor }}
|
||||||
|
PRIVATE_REPO_TOKEN: ${{ secrets.PRIVATE_REPO_TOKEN }}
|
||||||
|
```
|
||||||
|
This ensures Trivy can download private modules.
|
||||||
|
|
||||||
|
|
||||||
### Using Trivy to generate SBOM
|
### Using Trivy to generate SBOM
|
||||||
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).
|
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).
|
||||||
|
|
||||||
@@ -585,7 +617,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
|
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
format: 'github'
|
format: 'github'
|
||||||
@@ -615,7 +647,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Scan image in a private registry
|
- name: Scan image in a private registry
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: "private_image_registry/image_name:image_tag"
|
image-ref: "private_image_registry/image_name:image_tag"
|
||||||
scan-type: image
|
scan-type: image
|
||||||
@@ -653,12 +685,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF results to the GitHub Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -668,7 +703,7 @@ jobs:
|
|||||||
TRIVY_PASSWORD: Password
|
TRIVY_PASSWORD: Password
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
@@ -689,12 +724,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
|
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -705,7 +743,7 @@ jobs:
|
|||||||
AWS_DEFAULT_REGION: us-west-2
|
AWS_DEFAULT_REGION: us-west-2
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
@@ -713,7 +751,7 @@ jobs:
|
|||||||
#### GCR (Google Container Registry)
|
#### GCR (Google Container Registry)
|
||||||
Trivy uses Google Cloud SDK. You don't need to install `gcloud` command.
|
Trivy uses Google Cloud SDK. You don't need to install `gcloud` command.
|
||||||
|
|
||||||
If you want to use target project's repository, you can set it via `GOOGLE_APPLICATION_CREDENTIAL`.
|
If you want to use target project's repository, you can set it via `GOOGLE_APPLICATION_CREDENTIALS`.
|
||||||
```yaml
|
```yaml
|
||||||
name: build
|
name: build
|
||||||
on:
|
on:
|
||||||
@@ -725,21 +763,24 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
env:
|
env:
|
||||||
GOOGLE_APPLICATION_CREDENTIAL: /path/to/credential.json
|
GOOGLE_APPLICATION_CREDENTIALS: /path/to/credential.json
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
@@ -758,12 +799,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read # Required to checkout and read repo files
|
||||||
|
security-events: write # Required to upload SARIF files to Security tab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -773,7 +817,7 @@ jobs:
|
|||||||
TRIVY_PASSWORD: Password
|
TRIVY_PASSWORD: Password
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
@@ -786,7 +830,7 @@ This step is especially useful for private repositories without [GitHub Advanced
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner
|
- name: Run Trivy scanner
|
||||||
uses: aquasecurity/trivy-action@0.28.0
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
with:
|
with:
|
||||||
scan-type: config
|
scan-type: config
|
||||||
hide-progress: true
|
hide-progress: true
|
||||||
@@ -842,12 +886,12 @@ Following inputs can be used as `step.with` keys:
|
|||||||
| `hide-progress` | String | `false` | Suppress progress bar and log output |
|
| `hide-progress` | String | `false` | Suppress progress bar and log output |
|
||||||
| `list-all-pkgs` | String | | Output all packages regardless of vulnerability |
|
| `list-all-pkgs` | String | | Output all packages regardless of vulnerability |
|
||||||
| `scanners` | String | `vuln,secret` | comma-separated list of what security issues to detect (`vuln`,`secret`,`misconfig`,`license`) |
|
| `scanners` | String | `vuln,secret` | comma-separated list of what security issues to detect (`vuln`,`secret`,`misconfig`,`license`) |
|
||||||
| `trivyignores` | String | | comma-separated list of relative paths in repository to one or more `.trivyignore` files |
|
| `trivyignores` | String | | comma-separated list of relative paths within the repository to one or more `.trivyignore` files, or a single `.trivyignore.yaml` file. |
|
||||||
| `trivy-config` | String | | Path to trivy.yaml config |
|
| `trivy-config` | String | | Path to trivy.yaml config |
|
||||||
| `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 |
|
| `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 |
|
||||||
| `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** |
|
| `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** |
|
||||||
| `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) |
|
| `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) |
|
||||||
| `version` | String | `v0.65.0` | Trivy version to use, e.g. `latest` or `v0.65.0` |
|
| `version` | String | `v0.72.0` | Trivy version to use, e.g. `latest` or `v0.72.0` |
|
||||||
| `skip-setup-trivy` | Boolean | false | Skip calling the `setup-trivy` action to install `trivy` |
|
| `skip-setup-trivy` | Boolean | false | Skip calling the `setup-trivy` action to install `trivy` |
|
||||||
| `token-setup-trivy` | Boolean | | Overwrite `github.token` used by `setup-trivy` to checkout the `trivy` repository |
|
| `token-setup-trivy` | Boolean | | Overwrite `github.token` used by `setup-trivy` to checkout the `trivy` repository |
|
||||||
|
|
||||||
|
|||||||
+51
-30
@@ -77,7 +77,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
trivyignores:
|
trivyignores:
|
||||||
description: 'comma-separated list of relative paths in repository to one or more .trivyignore files'
|
description: 'comma-separated list of relative paths within the repository to one or more .trivyignore files, or a single .trivyignore.yaml file.'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
github-pat:
|
github-pat:
|
||||||
@@ -98,7 +98,7 @@ inputs:
|
|||||||
version:
|
version:
|
||||||
description: 'Trivy version to use'
|
description: 'Trivy version to use'
|
||||||
required: false
|
required: false
|
||||||
default: 'v0.65.0'
|
default: 'v0.72.0'
|
||||||
cache:
|
cache:
|
||||||
description: 'Used to specify whether caching is needed. Set to false, if you would like to disable caching.'
|
description: 'Used to specify whether caching is needed. Set to false, if you would like to disable caching.'
|
||||||
required: false
|
required: false
|
||||||
@@ -126,9 +126,10 @@ runs:
|
|||||||
# "allowing select actions" feature can be used to whitelist the dependent action by a hash.
|
# "allowing select actions" feature can be used to whitelist the dependent action by a hash.
|
||||||
# This is needed since some organizations have a policy to only allow pinned 3rd party actions to
|
# This is needed since some organizations have a policy to only allow pinned 3rd party actions to
|
||||||
# be used.
|
# be used.
|
||||||
uses: aquasecurity/setup-trivy@ff1b8b060f23b650436d419b5e13f67f5d4c3087 # equivalent to `v0.2.2`
|
uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version }}
|
# version is pinned by default; using a floating tag like `latest` is the caller's responsibility
|
||||||
|
version: ${{ inputs.version }} # zizmor: ignore[unpinned-tools]
|
||||||
cache: ${{ inputs.cache }}
|
cache: ${{ inputs.cache }}
|
||||||
token: ${{ inputs.token-setup-trivy }}
|
token: ${{ inputs.token-setup-trivy }}
|
||||||
|
|
||||||
@@ -139,14 +140,14 @@ runs:
|
|||||||
|
|
||||||
- name: Restore DB from cache
|
- name: Restore DB from cache
|
||||||
if: ${{ inputs.cache == 'true' }}
|
if: ${{ inputs.cache == 'true' }}
|
||||||
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.cache-dir }}
|
path: ${{ inputs.cache-dir }}
|
||||||
key: cache-trivy-${{ steps.date.outputs.date }}
|
key: cache-trivy-${{ steps.date.outputs.date }}
|
||||||
restore-keys: cache-trivy-
|
restore-keys: cache-trivy-
|
||||||
|
|
||||||
- name: Set GitHub Path
|
- name: Set GitHub Path
|
||||||
run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
|
run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH # zizmor: ignore[github-env]
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GITHUB_ACTION_PATH: ${{ github.action_path }}
|
GITHUB_ACTION_PATH: ${{ github.action_path }}
|
||||||
@@ -161,6 +162,25 @@ runs:
|
|||||||
|
|
||||||
- name: Set Trivy environment variables
|
- name: Set Trivy environment variables
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
INPUT_INPUT: ${{ inputs.input }}
|
||||||
|
INPUT_EXIT_CODE: ${{ inputs.exit-code }}
|
||||||
|
INPUT_IGNORE_UNFIXED: ${{ inputs.ignore-unfixed }}
|
||||||
|
INPUT_VULN_TYPE: ${{ inputs.vuln-type }}
|
||||||
|
INPUT_SEVERITY: ${{ inputs.severity }}
|
||||||
|
INPUT_FORMAT: ${{ inputs.format }}
|
||||||
|
INPUT_TEMPLATE: ${{ inputs.template }}
|
||||||
|
INPUT_OUTPUT: ${{ inputs.output }}
|
||||||
|
INPUT_SKIP_DIRS: ${{ inputs.skip-dirs }}
|
||||||
|
INPUT_SKIP_FILES: ${{ inputs.skip-files }}
|
||||||
|
INPUT_TIMEOUT: ${{ inputs.timeout }}
|
||||||
|
INPUT_IGNORE_POLICY: ${{ inputs.ignore-policy }}
|
||||||
|
INPUT_HIDE_PROGRESS: ${{ inputs.hide-progress }}
|
||||||
|
INPUT_LIST_ALL_PKGS: ${{ inputs.list-all-pkgs }}
|
||||||
|
INPUT_SCANNERS: ${{ inputs.scanners }}
|
||||||
|
INPUT_TRIVY_CONFIG: ${{ inputs.trivy-config }}
|
||||||
|
INPUT_TF_VARS: ${{ inputs.tf-vars }}
|
||||||
|
INPUT_DOCKER_HOST: ${{ inputs.docker-host }}
|
||||||
run: |
|
run: |
|
||||||
# Note: There is currently no way to distinguish between undefined variables and empty strings in GitHub Actions.
|
# Note: There is currently no way to distinguish between undefined variables and empty strings in GitHub Actions.
|
||||||
# This limitation affects how we handle default values and empty inputs.
|
# This limitation affects how we handle default values and empty inputs.
|
||||||
@@ -175,40 +195,41 @@ runs:
|
|||||||
#
|
#
|
||||||
# As noted above defaults are awkward to handle as GitHub Actions will inject those values as the input
|
# As noted above defaults are awkward to handle as GitHub Actions will inject those values as the input
|
||||||
# if the caller doesn't provide them, thus if the input matches the default we don't set it as we
|
# if the caller doesn't provide them, thus if the input matches the default we don't set it as we
|
||||||
# can't tell the difference. Plus if we did set it when it was the default value then it could potentially
|
# can't tell the difference. Plus if we did set it when it was the default value then it could potentially
|
||||||
# override an external environment variable, or something in the callers configuration file, which then wouldn't
|
# override an external environment variable, or something in the callers configuration file, which then wouldn't
|
||||||
# match the configuration priority that is documented.
|
# match the configuration priority that is documented.
|
||||||
set_env_var_if_provided() {
|
set_env_var_if_provided() {
|
||||||
local var_name="$1"
|
local var_name="$1"
|
||||||
local input_value="$2"
|
local input_value="$2"
|
||||||
local default_value="$3"
|
local default_value="$3"
|
||||||
|
|
||||||
if [ ! -z "$input_value" ] && [ "$input_value" != "$default_value" ]; then
|
if [ -n "$input_value" ] && [ "$input_value" != "$default_value" ]; then
|
||||||
# If action was provided with explicit input by the caller set that
|
# If action was provided with explicit input by the caller set that
|
||||||
echo "export $var_name=$input_value" >> trivy_envs.txt
|
# Use printf %q to safely escape special characters and prevent command injection
|
||||||
|
printf 'export %s=%q\n' "$var_name" "$input_value" >> trivy_envs.txt
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set environment variables, handling those with default values
|
# Set environment variables, handling those with default values
|
||||||
# cf. https://aquasecurity.github.io/trivy/latest/docs/configuration/#environment-variables
|
# cf. https://aquasecurity.github.io/trivy/latest/docs/configuration/#environment-variables
|
||||||
set_env_var_if_provided "TRIVY_INPUT" "${{ inputs.input }}" ""
|
set_env_var_if_provided "TRIVY_INPUT" "$INPUT_INPUT" ""
|
||||||
set_env_var_if_provided "TRIVY_EXIT_CODE" "${{ inputs.exit-code }}" ""
|
set_env_var_if_provided "TRIVY_EXIT_CODE" "$INPUT_EXIT_CODE" ""
|
||||||
set_env_var_if_provided "TRIVY_IGNORE_UNFIXED" "${{ inputs.ignore-unfixed }}" "false"
|
set_env_var_if_provided "TRIVY_IGNORE_UNFIXED" "$INPUT_IGNORE_UNFIXED" "false"
|
||||||
set_env_var_if_provided "TRIVY_PKG_TYPES" "${{ inputs.vuln-type }}" "os,library"
|
set_env_var_if_provided "TRIVY_PKG_TYPES" "$INPUT_VULN_TYPE" "os,library"
|
||||||
set_env_var_if_provided "TRIVY_SEVERITY" "${{ inputs.severity }}" "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL"
|
set_env_var_if_provided "TRIVY_SEVERITY" "$INPUT_SEVERITY" "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL"
|
||||||
set_env_var_if_provided "TRIVY_FORMAT" "${{ inputs.format }}" "table"
|
set_env_var_if_provided "TRIVY_FORMAT" "$INPUT_FORMAT" "table"
|
||||||
set_env_var_if_provided "TRIVY_TEMPLATE" "${{ inputs.template }}" ""
|
set_env_var_if_provided "TRIVY_TEMPLATE" "$INPUT_TEMPLATE" ""
|
||||||
set_env_var_if_provided "TRIVY_OUTPUT" "${{ inputs.output }}" ""
|
set_env_var_if_provided "TRIVY_OUTPUT" "$INPUT_OUTPUT" ""
|
||||||
set_env_var_if_provided "TRIVY_SKIP_DIRS" "${{ inputs.skip-dirs }}" ""
|
set_env_var_if_provided "TRIVY_SKIP_DIRS" "$INPUT_SKIP_DIRS" ""
|
||||||
set_env_var_if_provided "TRIVY_SKIP_FILES" "${{ inputs.skip-files }}" ""
|
set_env_var_if_provided "TRIVY_SKIP_FILES" "$INPUT_SKIP_FILES" ""
|
||||||
set_env_var_if_provided "TRIVY_TIMEOUT" "${{ inputs.timeout }}" ""
|
set_env_var_if_provided "TRIVY_TIMEOUT" "$INPUT_TIMEOUT" ""
|
||||||
set_env_var_if_provided "TRIVY_IGNORE_POLICY" "${{ inputs.ignore-policy }}" ""
|
set_env_var_if_provided "TRIVY_IGNORE_POLICY" "$INPUT_IGNORE_POLICY" ""
|
||||||
set_env_var_if_provided "TRIVY_QUIET" "${{ inputs.hide-progress }}" ""
|
set_env_var_if_provided "TRIVY_QUIET" "$INPUT_HIDE_PROGRESS" ""
|
||||||
set_env_var_if_provided "TRIVY_LIST_ALL_PKGS" "${{ inputs.list-all-pkgs }}" "false"
|
set_env_var_if_provided "TRIVY_LIST_ALL_PKGS" "$INPUT_LIST_ALL_PKGS" "false"
|
||||||
set_env_var_if_provided "TRIVY_SCANNERS" "${{ inputs.scanners }}" ""
|
set_env_var_if_provided "TRIVY_SCANNERS" "$INPUT_SCANNERS" ""
|
||||||
set_env_var_if_provided "TRIVY_CONFIG" "${{ inputs.trivy-config }}" ""
|
set_env_var_if_provided "TRIVY_CONFIG" "$INPUT_TRIVY_CONFIG" ""
|
||||||
set_env_var_if_provided "TRIVY_TF_VARS" "${{ inputs.tf-vars }}" ""
|
set_env_var_if_provided "TRIVY_TF_VARS" "$INPUT_TF_VARS" ""
|
||||||
set_env_var_if_provided "TRIVY_DOCKER_HOST" "${{ inputs.docker-host }}" ""
|
set_env_var_if_provided "TRIVY_DOCKER_HOST" "$INPUT_DOCKER_HOST" ""
|
||||||
|
|
||||||
- name: Run Trivy
|
- name: Run Trivy
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
+47
-11
@@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Allow overriding trivy binary via env
|
||||||
|
TRIVY_CMD="${TRIVY_CMD:-trivy}"
|
||||||
|
|
||||||
# Read TRIVY_* envs from file, previously they were written to the GITHUB_ENV file but GitHub Actions automatically
|
# Read TRIVY_* envs from file, previously they were written to the GITHUB_ENV file but GitHub Actions automatically
|
||||||
# injects those into subsequent job steps which means inputs from one trivy-action invocation were leaking over to
|
# injects those into subsequent job steps which means inputs from one trivy-action invocation were leaking over to
|
||||||
# any subsequent invocation which led to unexpected/undesireable behaviour from a user perspective
|
# any subsequent invocation which led to unexpected/undesireable behaviour from a user perspective
|
||||||
@@ -18,22 +21,55 @@ fi
|
|||||||
|
|
||||||
# Handle trivy ignores
|
# Handle trivy ignores
|
||||||
if [ -n "${INPUT_TRIVYIGNORES:-}" ]; then
|
if [ -n "${INPUT_TRIVYIGNORES:-}" ]; then
|
||||||
ignorefile="./trivyignores"
|
|
||||||
|
|
||||||
# Clear the ignore file if it exists, or create a new empty file
|
yaml_count=0
|
||||||
: > "$ignorefile"
|
plain_count=0
|
||||||
|
|
||||||
|
# Validate files and detect types
|
||||||
for f in ${INPUT_TRIVYIGNORES//,/ }; do
|
for f in ${INPUT_TRIVYIGNORES//,/ }; do
|
||||||
if [ -f "$f" ]; then
|
if [ ! -f "$f" ]; then
|
||||||
echo "Found ignorefile '${f}':"
|
|
||||||
cat "${f}"
|
|
||||||
cat "${f}" >> "$ignorefile"
|
|
||||||
else
|
|
||||||
echo "ERROR: cannot find ignorefile '${f}'." >&2
|
echo "ERROR: cannot find ignorefile '${f}'." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$f" in
|
||||||
|
*.yml|*.yaml) yaml_count=$((yaml_count + 1)) ;;
|
||||||
|
*) plain_count=$((plain_count + 1)) ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
export TRIVY_IGNOREFILE="$ignorefile"
|
|
||||||
|
# Mixed types are not allowed
|
||||||
|
if [ "$yaml_count" -gt 0 ] && [ "$plain_count" -gt 0 ]; then
|
||||||
|
echo "ERROR: Cannot mix YAML and plain trivy ignore files." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# YAML mode
|
||||||
|
if [ "$yaml_count" -gt 0 ]; then
|
||||||
|
if [ "$yaml_count" -gt 1 ]; then
|
||||||
|
echo "ERROR: Multiple YAML ignore files provided. Only one YAML file is supported." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use the single YAML file
|
||||||
|
yaml_file=$(echo ${INPUT_TRIVYIGNORES//,/ } | awk '{print $1}')
|
||||||
|
echo "Using YAML ignorefile '$yaml_file':"
|
||||||
|
cat "$yaml_file"
|
||||||
|
export TRIVY_IGNOREFILE="$yaml_file"
|
||||||
|
|
||||||
|
else
|
||||||
|
# Plain mode (old behaviour)
|
||||||
|
ignorefile="./trivyignores"
|
||||||
|
: > "$ignorefile"
|
||||||
|
|
||||||
|
for f in ${INPUT_TRIVYIGNORES//,/ }; do
|
||||||
|
echo "Found ignorefile '$f':"
|
||||||
|
cat "$f"
|
||||||
|
cat "$f" >> "$ignorefile"
|
||||||
|
done
|
||||||
|
|
||||||
|
export TRIVY_IGNOREFILE="$ignorefile"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Handle SARIF
|
# Handle SARIF
|
||||||
@@ -47,7 +83,7 @@ if [ "${TRIVY_FORMAT:-}" = "sarif" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run Trivy
|
# Run Trivy
|
||||||
cmd=(trivy "$scanType" "$scanRef")
|
cmd=("$TRIVY_CMD" "$scanType" "$scanRef")
|
||||||
echo "Running Trivy with options: ${cmd[*]}"
|
echo "Running Trivy with options: ${cmd[*]}"
|
||||||
"${cmd[@]}"
|
"${cmd[@]}"
|
||||||
returnCode=$?
|
returnCode=$?
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"name": "Trivy",
|
"name": "Trivy",
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0086",
|
"id": "AWS-0086",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 Access block should block public ACL"
|
"text": "S3 Access block should block public ACL"
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "error"
|
"level": "error"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0086",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0086",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration 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: [AWS-0086](https://avd.aquasec.com/misconfig/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",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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|[AWS-0086](https://avd.aquasec.com/misconfig/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"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0087",
|
"id": "AWS-0087",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 Access block should block public policy"
|
"text": "S3 Access block should block public policy"
|
||||||
@@ -48,10 +48,10 @@
|
|||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "error"
|
"level": "error"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0087",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0087",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration 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: [AWS-0087](https://avd.aquasec.com/misconfig/aws-0087)\nS3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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|[AWS-0087](https://avd.aquasec.com/misconfig/aws-0087)|\n\nS3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -64,34 +64,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0088",
|
"id": "AWS-0089",
|
||||||
"name": "Misconfiguration",
|
|
||||||
"shortDescription": {
|
|
||||||
"text": "Unencrypted S3 bucket."
|
|
||||||
},
|
|
||||||
"fullDescription": {
|
|
||||||
"text": "S3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.\n"
|
|
||||||
},
|
|
||||||
"defaultConfiguration": {
|
|
||||||
"level": "error"
|
|
||||||
},
|
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0088",
|
|
||||||
"help": {
|
|
||||||
"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",
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"precision": "very-high",
|
|
||||||
"security-severity": "8.0",
|
|
||||||
"tags": [
|
|
||||||
"misconfiguration",
|
|
||||||
"security",
|
|
||||||
"HIGH"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "s3-bucket-logging",
|
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 Bucket Logging"
|
"text": "S3 Bucket Logging"
|
||||||
@@ -102,10 +75,10 @@
|
|||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "note"
|
"level": "note"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/s3-bucket-logging",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0089",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration AWS-0089\nType: Terraform Security Check\nSeverity: LOW\nCheck: S3 Bucket Logging\nMessage: Bucket has logging disabled\nLink: [AWS-0089](https://avd.aquasec.com/misconfig/aws-0089)\nEnsures S3 bucket logging is enabled for S3 buckets",
|
||||||
"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"
|
"markdown": "**Misconfiguration AWS-0089**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Terraform Security Check|LOW|S3 Bucket Logging|Bucket has logging disabled|[AWS-0089](https://avd.aquasec.com/misconfig/aws-0089)|\n\nEnsures S3 bucket logging is enabled for S3 buckets"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -118,21 +91,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0090",
|
"id": "AWS-0090",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 Data should be versioned"
|
"text": "S3 Data should be versioned"
|
||||||
},
|
},
|
||||||
"fullDescription": {
|
"fullDescription": {
|
||||||
"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"
|
"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\nWhen you enable versioning, also keep in mind the potential costs of storing noncurrent versions of objects. To help manage those costs, consider setting up an S3 Lifecycle configuration.\n"
|
||||||
},
|
},
|
||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "warning"
|
"level": "warning"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0090",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0090",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration AWS-0090\nType: Terraform Security Check\nSeverity: MEDIUM\nCheck: S3 Data should be versioned\nMessage: Bucket does not have versioning enabled\nLink: [AWS-0090](https://avd.aquasec.com/misconfig/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\nWhen you enable versioning, also keep in mind the potential costs of storing noncurrent versions of objects. To help manage those costs, consider setting up an S3 Lifecycle configuration.\n",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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|[AWS-0090](https://avd.aquasec.com/misconfig/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\nWhen you enable versioning, also keep in mind the potential costs of storing noncurrent versions of objects. To help manage those costs, consider setting up an S3 Lifecycle configuration.\n"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -145,10 +118,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0091",
|
"id": "AWS-0091",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 Access Block should Ignore Public Acl"
|
"text": "S3 Access Block should Ignore Public ACL"
|
||||||
},
|
},
|
||||||
"fullDescription": {
|
"fullDescription": {
|
||||||
"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"
|
"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"
|
||||||
@@ -156,10 +129,10 @@
|
|||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "error"
|
"level": "error"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0091",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0091",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration 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: [AWS-0091](https://avd.aquasec.com/misconfig/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",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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|[AWS-0091](https://avd.aquasec.com/misconfig/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"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -172,7 +145,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0093",
|
"id": "AWS-0093",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 Access block should restrict public bucket to limit access"
|
"text": "S3 Access block should restrict public bucket to limit access"
|
||||||
@@ -183,10 +156,10 @@
|
|||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "error"
|
"level": "error"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0093",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0093",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration 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: [AWS-0093](https://avd.aquasec.com/misconfig/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",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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|[AWS-0093](https://avd.aquasec.com/misconfig/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"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -199,7 +172,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0094",
|
"id": "AWS-0094",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 buckets should each define an aws_s3_bucket_public_access_block"
|
"text": "S3 buckets should each define an aws_s3_bucket_public_access_block"
|
||||||
@@ -210,10 +183,10 @@
|
|||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "note"
|
"level": "note"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0094",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0094",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration 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: [AWS-0094](https://avd.aquasec.com/misconfig/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",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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.|[AWS-0094](https://avd.aquasec.com/misconfig/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"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -226,21 +199,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "AVD-AWS-0132",
|
"id": "AWS-0132",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "S3 encryption should use Customer Managed Keys"
|
"text": "S3 encryption should use Customer Managed Keys"
|
||||||
},
|
},
|
||||||
"fullDescription": {
|
"fullDescription": {
|
||||||
"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"
|
"text": "Encryption using AWS keys provides protection for your S3 buckets. To gain greater control over encryption, such as key rotation, access policies, and auditability, use customer managed keys (CMKs) with SSE-KMS.\nNote that SSE-KMS is not supported for S3 server access logging destination buckets; in such cases, use SSE-S3 instead.\n"
|
||||||
},
|
},
|
||||||
"defaultConfiguration": {
|
"defaultConfiguration": {
|
||||||
"level": "error"
|
"level": "error"
|
||||||
},
|
},
|
||||||
"helpUri": "https://avd.aquasec.com/misconfig/avd-aws-0132",
|
"helpUri": "https://avd.aquasec.com/misconfig/aws-0132",
|
||||||
"help": {
|
"help": {
|
||||||
"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",
|
"text": "Misconfiguration 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: [AWS-0132](https://avd.aquasec.com/misconfig/aws-0132)\nEncryption using AWS keys provides protection for your S3 buckets. To gain greater control over encryption, such as key rotation, access policies, and auditability, use customer managed keys (CMKs) with SSE-KMS.\nNote that SSE-KMS is not supported for S3 server access logging destination buckets; in such cases, use SSE-S3 instead.\n",
|
||||||
"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"
|
"markdown": "**Misconfiguration 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.|[AWS-0132](https://avd.aquasec.com/misconfig/aws-0132)|\n\nEncryption using AWS keys provides protection for your S3 buckets. To gain greater control over encryption, such as key rotation, access policies, and auditability, use customer managed keys (CMKs) with SSE-KMS.\nNote that SSE-KMS is not supported for S3 server access logging destination buckets; in such cases, use SSE-S3 instead.\n"
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"precision": "very-high",
|
"precision": "very-high",
|
||||||
@@ -257,11 +230,11 @@
|
|||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0086",
|
"ruleId": "AWS-0086",
|
||||||
"ruleIndex": 0,
|
"ruleIndex": 0,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0086\nSeverity: HIGH\nMessage: No public access block so not blocking public acls\nLink: [AWS-0086](https://avd.aquasec.com/misconfig/aws-0086)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
@@ -284,11 +257,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0087",
|
"ruleId": "AWS-0087",
|
||||||
"ruleIndex": 1,
|
"ruleIndex": 1,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0087\nSeverity: HIGH\nMessage: No public access block so not blocking public policies\nLink: [AWS-0087](https://avd.aquasec.com/misconfig/aws-0087)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
@@ -311,38 +284,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0088",
|
"ruleId": "AWS-0089",
|
||||||
"ruleIndex": 2,
|
"ruleIndex": 2,
|
||||||
"level": "error",
|
|
||||||
"message": {
|
|
||||||
"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)"
|
|
||||||
},
|
|
||||||
"locations": [
|
|
||||||
{
|
|
||||||
"physicalLocation": {
|
|
||||||
"artifactLocation": {
|
|
||||||
"uri": "main.tf",
|
|
||||||
"uriBaseId": "ROOTPATH"
|
|
||||||
},
|
|
||||||
"region": {
|
|
||||||
"startLine": 8,
|
|
||||||
"startColumn": 1,
|
|
||||||
"endLine": 10,
|
|
||||||
"endColumn": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"text": "main.tf"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ruleId": "s3-bucket-logging",
|
|
||||||
"ruleIndex": 3,
|
|
||||||
"level": "note",
|
"level": "note",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0089\nSeverity: LOW\nMessage: Bucket has logging disabled\nLink: [AWS-0089](https://avd.aquasec.com/misconfig/aws-0089)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
@@ -365,11 +311,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0090",
|
"ruleId": "AWS-0090",
|
||||||
"ruleIndex": 4,
|
"ruleIndex": 3,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0090\nSeverity: MEDIUM\nMessage: Bucket does not have versioning enabled\nLink: [AWS-0090](https://avd.aquasec.com/misconfig/aws-0090)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
@@ -392,11 +338,38 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0091",
|
"ruleId": "AWS-0091",
|
||||||
|
"ruleIndex": 4,
|
||||||
|
"level": "error",
|
||||||
|
"message": {
|
||||||
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0091\nSeverity: HIGH\nMessage: No public access block so not blocking public acls\nLink: [AWS-0091](https://avd.aquasec.com/misconfig/aws-0091)"
|
||||||
|
},
|
||||||
|
"locations": [
|
||||||
|
{
|
||||||
|
"physicalLocation": {
|
||||||
|
"artifactLocation": {
|
||||||
|
"uri": "main.tf",
|
||||||
|
"uriBaseId": "ROOTPATH"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"startLine": 8,
|
||||||
|
"startColumn": 1,
|
||||||
|
"endLine": 10,
|
||||||
|
"endColumn": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"text": "main.tf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ruleId": "AWS-0093",
|
||||||
"ruleIndex": 5,
|
"ruleIndex": 5,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0093\nSeverity: HIGH\nMessage: No public access block so not restricting public buckets\nLink: [AWS-0093](https://avd.aquasec.com/misconfig/aws-0093)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
@@ -419,38 +392,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0093",
|
"ruleId": "AWS-0094",
|
||||||
"ruleIndex": 6,
|
"ruleIndex": 6,
|
||||||
"level": "error",
|
|
||||||
"message": {
|
|
||||||
"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)"
|
|
||||||
},
|
|
||||||
"locations": [
|
|
||||||
{
|
|
||||||
"physicalLocation": {
|
|
||||||
"artifactLocation": {
|
|
||||||
"uri": "main.tf",
|
|
||||||
"uriBaseId": "ROOTPATH"
|
|
||||||
},
|
|
||||||
"region": {
|
|
||||||
"startLine": 8,
|
|
||||||
"startColumn": 1,
|
|
||||||
"endLine": 10,
|
|
||||||
"endColumn": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"text": "main.tf"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ruleId": "AVD-AWS-0094",
|
|
||||||
"ruleIndex": 7,
|
|
||||||
"level": "note",
|
"level": "note",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0094\nSeverity: LOW\nMessage: Bucket does not have a corresponding public access block.\nLink: [AWS-0094](https://avd.aquasec.com/misconfig/aws-0094)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
@@ -473,11 +419,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "AVD-AWS-0132",
|
"ruleId": "AWS-0132",
|
||||||
"ruleIndex": 8,
|
"ruleIndex": 7,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"message": {
|
"message": {
|
||||||
"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)"
|
"text": "Artifact: main.tf\nType: terraform\nVulnerability AWS-0132\nSeverity: HIGH\nMessage: Bucket does not encrypt data with a customer managed key.\nLink: [AWS-0132](https://avd.aquasec.com/misconfig/aws-0132)"
|
||||||
},
|
},
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
|
"Trivy": {
|
||||||
|
"Version": "0.72.0"
|
||||||
|
},
|
||||||
"ArtifactName": "test/data/config-scan",
|
"ArtifactName": "test/data/config-scan",
|
||||||
"ArtifactType": "filesystem",
|
"ArtifactType": "filesystem",
|
||||||
"Results": [
|
"Results": [
|
||||||
@@ -8,7 +11,7 @@
|
|||||||
"Class": "config",
|
"Class": "config",
|
||||||
"Type": "terraform",
|
"Type": "terraform",
|
||||||
"MisconfSummary": {
|
"MisconfSummary": {
|
||||||
"Successes": 38,
|
"Successes": 53,
|
||||||
"Failures": 0
|
"Failures": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -18,13 +21,12 @@
|
|||||||
"Type": "terraform",
|
"Type": "terraform",
|
||||||
"MisconfSummary": {
|
"MisconfSummary": {
|
||||||
"Successes": 0,
|
"Successes": 0,
|
||||||
"Failures": 9
|
"Failures": 8
|
||||||
},
|
},
|
||||||
"Misconfigurations": [
|
"Misconfigurations": [
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0086",
|
"ID": "AWS-0086",
|
||||||
"AVDID": "AVD-AWS-0086",
|
|
||||||
"Title": "S3 Access block should block public ACL",
|
"Title": "S3 Access block should block public ACL",
|
||||||
"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",
|
"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",
|
||||||
"Message": "No public access block so not blocking public acls",
|
"Message": "No public access block so not blocking public acls",
|
||||||
@@ -32,10 +34,10 @@
|
|||||||
"Query": "data.builtin.aws.s3.aws0086.deny",
|
"Query": "data.builtin.aws.s3.aws0086.deny",
|
||||||
"Resolution": "Enable blocking any PUT calls with a public ACL specified",
|
"Resolution": "Enable blocking any PUT calls with a public ACL specified",
|
||||||
"Severity": "HIGH",
|
"Severity": "HIGH",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0086",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0086",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0086"
|
"https://avd.aquasec.com/misconfig/aws-0086"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -82,8 +84,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0087",
|
"ID": "AWS-0087",
|
||||||
"AVDID": "AVD-AWS-0087",
|
|
||||||
"Title": "S3 Access block should block public policy",
|
"Title": "S3 Access block should block public policy",
|
||||||
"Description": "S3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n",
|
"Description": "S3 bucket policy should have block public policy to prevent users from putting a policy that enable public access.\n",
|
||||||
"Message": "No public access block so not blocking public policies",
|
"Message": "No public access block so not blocking public policies",
|
||||||
@@ -91,10 +92,10 @@
|
|||||||
"Query": "data.builtin.aws.s3.aws0087.deny",
|
"Query": "data.builtin.aws.s3.aws0087.deny",
|
||||||
"Resolution": "Prevent policies that allow public access being PUT",
|
"Resolution": "Prevent policies that allow public access being PUT",
|
||||||
"Severity": "HIGH",
|
"Severity": "HIGH",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0087",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0087",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/access-control-block-public-access.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/access-control-block-public-access.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0087"
|
"https://avd.aquasec.com/misconfig/aws-0087"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -141,67 +142,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0088",
|
"ID": "AWS-0089",
|
||||||
"AVDID": "AVD-AWS-0088",
|
|
||||||
"Title": "Unencrypted S3 bucket.",
|
|
||||||
"Description": "S3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.\n",
|
|
||||||
"Message": "Bucket does not have encryption enabled",
|
|
||||||
"Namespace": "builtin.aws.s3.aws0088",
|
|
||||||
"Query": "data.builtin.aws.s3.aws0088.deny",
|
|
||||||
"Resolution": "Configure bucket encryption",
|
|
||||||
"Severity": "HIGH",
|
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0088",
|
|
||||||
"References": [
|
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html",
|
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0088"
|
|
||||||
],
|
|
||||||
"Status": "FAIL",
|
|
||||||
"CauseMetadata": {
|
|
||||||
"Resource": "aws_s3_bucket.bucket",
|
|
||||||
"Provider": "AWS",
|
|
||||||
"Service": "s3",
|
|
||||||
"StartLine": 8,
|
|
||||||
"EndLine": 10,
|
|
||||||
"Code": {
|
|
||||||
"Lines": [
|
|
||||||
{
|
|
||||||
"Number": 8,
|
|
||||||
"Content": "resource \"aws_s3_bucket\" \"bucket\" {",
|
|
||||||
"IsCause": true,
|
|
||||||
"Annotation": "",
|
|
||||||
"Truncated": false,
|
|
||||||
"Highlighted": "\u001b[38;5;33mresource\u001b[0m \u001b[38;5;37m\"aws_s3_bucket\"\u001b[0m \u001b[38;5;37m\"bucket\"\u001b[0m {",
|
|
||||||
"FirstCause": true,
|
|
||||||
"LastCause": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Number": 9,
|
|
||||||
"Content": " bucket = \"trivy-action-bucket\"",
|
|
||||||
"IsCause": true,
|
|
||||||
"Annotation": "",
|
|
||||||
"Truncated": false,
|
|
||||||
"Highlighted": " \u001b[38;5;245mbucket\u001b[0m = \u001b[38;5;37m\"trivy-action-bucket\"",
|
|
||||||
"FirstCause": false,
|
|
||||||
"LastCause": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Number": 10,
|
|
||||||
"Content": "}",
|
|
||||||
"IsCause": true,
|
|
||||||
"Annotation": "",
|
|
||||||
"Truncated": false,
|
|
||||||
"Highlighted": "\u001b[0m}",
|
|
||||||
"FirstCause": false,
|
|
||||||
"LastCause": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Type": "Terraform Security Check",
|
|
||||||
"ID": "s3-bucket-logging",
|
|
||||||
"AVDID": "AVD-AWS-0089",
|
|
||||||
"Title": "S3 Bucket Logging",
|
"Title": "S3 Bucket Logging",
|
||||||
"Description": "Ensures S3 bucket logging is enabled for S3 buckets",
|
"Description": "Ensures S3 bucket logging is enabled for S3 buckets",
|
||||||
"Message": "Bucket has logging disabled",
|
"Message": "Bucket has logging disabled",
|
||||||
@@ -209,11 +150,11 @@
|
|||||||
"Query": "data.builtin.aws.s3.aws0089.deny",
|
"Query": "data.builtin.aws.s3.aws0089.deny",
|
||||||
"Resolution": "Add a logging block to the resource to enable access logging",
|
"Resolution": "Add a logging block to the resource to enable access logging",
|
||||||
"Severity": "LOW",
|
"Severity": "LOW",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/s3-bucket-logging",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0089",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html",
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html",
|
||||||
"https://avd.aquasec.com/misconfig/s3-bucket-logging"
|
"https://avd.aquasec.com/misconfig/aws-0089"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -260,19 +201,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0090",
|
"ID": "AWS-0090",
|
||||||
"AVDID": "AVD-AWS-0090",
|
|
||||||
"Title": "S3 Data should be versioned",
|
"Title": "S3 Data should be versioned",
|
||||||
"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",
|
"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\nWhen you enable versioning, also keep in mind the potential costs of storing noncurrent versions of objects. To help manage those costs, consider setting up an S3 Lifecycle configuration.\n",
|
||||||
"Message": "Bucket does not have versioning enabled",
|
"Message": "Bucket does not have versioning enabled",
|
||||||
"Namespace": "builtin.aws.s3.aws0090",
|
"Namespace": "builtin.aws.s3.aws0090",
|
||||||
"Query": "data.builtin.aws.s3.aws0090.deny",
|
"Query": "data.builtin.aws.s3.aws0090.deny",
|
||||||
"Resolution": "Enable versioning to protect against accidental/malicious removal or modification",
|
"Resolution": "Enable versioning to protect against accidental/malicious removal or modification",
|
||||||
"Severity": "MEDIUM",
|
"Severity": "MEDIUM",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0090",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0090",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0090"
|
"https://aws.amazon.com/blogs/storage/reduce-storage-costs-with-fewer-noncurrent-versions-using-amazon-s3-lifecycle/",
|
||||||
|
"https://avd.aquasec.com/misconfig/aws-0090"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -380,19 +321,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0091",
|
"ID": "AWS-0091",
|
||||||
"AVDID": "AVD-AWS-0091",
|
"Title": "S3 Access Block should Ignore Public ACL",
|
||||||
"Title": "S3 Access Block should Ignore Public Acl",
|
|
||||||
"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",
|
"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",
|
||||||
"Message": "No public access block so not blocking public acls",
|
"Message": "No public access block so not blocking public acls",
|
||||||
"Namespace": "builtin.aws.s3.aws0091",
|
"Namespace": "builtin.aws.s3.aws0091",
|
||||||
"Query": "data.builtin.aws.s3.aws0091.deny",
|
"Query": "data.builtin.aws.s3.aws0091.deny",
|
||||||
"Resolution": "Enable ignoring the application of public ACLs in PUT calls",
|
"Resolution": "Enable ignoring the application of public ACLs in PUT calls",
|
||||||
"Severity": "HIGH",
|
"Severity": "HIGH",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0091",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0091",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0091"
|
"https://avd.aquasec.com/misconfig/aws-0091"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -439,8 +379,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0093",
|
"ID": "AWS-0093",
|
||||||
"AVDID": "AVD-AWS-0093",
|
|
||||||
"Title": "S3 Access block should restrict public bucket to limit access",
|
"Title": "S3 Access block should restrict public bucket to limit access",
|
||||||
"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",
|
"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",
|
||||||
"Message": "No public access block so not restricting public buckets",
|
"Message": "No public access block so not restricting public buckets",
|
||||||
@@ -448,10 +387,10 @@
|
|||||||
"Query": "data.builtin.aws.s3.aws0093.deny",
|
"Query": "data.builtin.aws.s3.aws0093.deny",
|
||||||
"Resolution": "Limit the access to public buckets to only the owner or AWS Services (eg; CloudFront)",
|
"Resolution": "Limit the access to public buckets to only the owner or AWS Services (eg; CloudFront)",
|
||||||
"Severity": "HIGH",
|
"Severity": "HIGH",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0093",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0093",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/access-control-block-public-access.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/dev-retired/access-control-block-public-access.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0093"
|
"https://avd.aquasec.com/misconfig/aws-0093"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -498,8 +437,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0094",
|
"ID": "AWS-0094",
|
||||||
"AVDID": "AVD-AWS-0094",
|
|
||||||
"Title": "S3 buckets should each define an aws_s3_bucket_public_access_block",
|
"Title": "S3 buckets should each define an aws_s3_bucket_public_access_block",
|
||||||
"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",
|
"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",
|
||||||
"Message": "Bucket does not have a corresponding public access block.",
|
"Message": "Bucket does not have a corresponding public access block.",
|
||||||
@@ -507,10 +445,10 @@
|
|||||||
"Query": "data.builtin.aws.s3.aws0094.deny",
|
"Query": "data.builtin.aws.s3.aws0094.deny",
|
||||||
"Resolution": "Define a aws_s3_bucket_public_access_block for the given bucket to control public access policies",
|
"Resolution": "Define a aws_s3_bucket_public_access_block for the given bucket to control public access policies",
|
||||||
"Severity": "LOW",
|
"Severity": "LOW",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0094",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0094",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0094"
|
"https://avd.aquasec.com/misconfig/aws-0094"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
@@ -557,19 +495,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Terraform Security Check",
|
"Type": "Terraform Security Check",
|
||||||
"ID": "AVD-AWS-0132",
|
"ID": "AWS-0132",
|
||||||
"AVDID": "AVD-AWS-0132",
|
|
||||||
"Title": "S3 encryption should use Customer Managed Keys",
|
"Title": "S3 encryption should use Customer Managed Keys",
|
||||||
"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",
|
"Description": "Encryption using AWS keys provides protection for your S3 buckets. To gain greater control over encryption, such as key rotation, access policies, and auditability, use customer managed keys (CMKs) with SSE-KMS.\nNote that SSE-KMS is not supported for S3 server access logging destination buckets; in such cases, use SSE-S3 instead.\n",
|
||||||
"Message": "Bucket does not encrypt data with a customer managed key.",
|
"Message": "Bucket does not encrypt data with a customer managed key.",
|
||||||
"Namespace": "builtin.aws.s3.aws0132",
|
"Namespace": "builtin.aws.s3.aws0132",
|
||||||
"Query": "data.builtin.aws.s3.aws0132.deny",
|
"Query": "data.builtin.aws.s3.aws0132.deny",
|
||||||
"Resolution": "Enable encryption using customer managed keys",
|
"Resolution": "Use SSE-KMS with a customer managed key (CMK)",
|
||||||
"Severity": "HIGH",
|
"Severity": "HIGH",
|
||||||
"PrimaryURL": "https://avd.aquasec.com/misconfig/avd-aws-0132",
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/aws-0132",
|
||||||
"References": [
|
"References": [
|
||||||
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html",
|
"https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-encryption.html",
|
||||||
"https://avd.aquasec.com/misconfig/avd-aws-0132"
|
"https://avd.aquasec.com/misconfig/aws-0132"
|
||||||
],
|
],
|
||||||
"Status": "FAIL",
|
"Status": "FAIL",
|
||||||
"CauseMetadata": {
|
"CauseMetadata": {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
|
"Trivy": {
|
||||||
|
"Version": "0.72.0"
|
||||||
|
},
|
||||||
|
"ArtifactID": "sha256:79ce4c2f8371bef1ce2a321518d3136bc1bd8f3c307ed679944a38e7cbd76c14",
|
||||||
"ArtifactName": "https://github.com/krol3/demo-trivy/",
|
"ArtifactName": "https://github.com/krol3/demo-trivy/",
|
||||||
"ArtifactType": "repository",
|
"ArtifactType": "repository",
|
||||||
"Metadata": {
|
"Metadata": {
|
||||||
@@ -64,7 +68,8 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Match": "export GITHUB_PAT=****************************************"
|
"Match": "export GITHUB_PAT=****************************************",
|
||||||
|
"Offset": 63
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
|
"Trivy": {
|
||||||
|
"Version": "0.72.0"
|
||||||
|
},
|
||||||
"ArtifactName": "test/data/with-tf-vars/main.tf",
|
"ArtifactName": "test/data/with-tf-vars/main.tf",
|
||||||
"ArtifactType": "filesystem",
|
"ArtifactType": "filesystem",
|
||||||
"Results": [
|
"Results": [
|
||||||
@@ -8,7 +11,7 @@
|
|||||||
"Class": "config",
|
"Class": "config",
|
||||||
"Type": "terraform",
|
"Type": "terraform",
|
||||||
"MisconfSummary": {
|
"MisconfSummary": {
|
||||||
"Successes": 19,
|
"Successes": 27,
|
||||||
"Failures": 0
|
"Failures": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
|
"Trivy": {
|
||||||
|
"Version": "0.72.0"
|
||||||
|
},
|
||||||
|
"ArtifactID": "sha256:aab05ff324c90bb728aa5177b75d7e39d363be13323873de70959d2251edcebc",
|
||||||
"ArtifactName": "alpine:3.10",
|
"ArtifactName": "alpine:3.10",
|
||||||
"ArtifactType": "container_image",
|
"ArtifactType": "container_image",
|
||||||
"Metadata": {
|
"Metadata": {
|
||||||
@@ -19,6 +23,7 @@
|
|||||||
"RepoDigests": [
|
"RepoDigests": [
|
||||||
"alpine@sha256:451eee8bedcb2f029756dc3e9d73bab0e7943c1ac55cff3a4861c52a0fdd3e98"
|
"alpine@sha256:451eee8bedcb2f029756dc3e9d73bab0e7943c1ac55cff3a4861c52a0fdd3e98"
|
||||||
],
|
],
|
||||||
|
"Reference": "alpine:3.10",
|
||||||
"ImageConfig": {
|
"ImageConfig": {
|
||||||
"architecture": "amd64",
|
"architecture": "amd64",
|
||||||
"container": "fdb7e80e3339e8d0599282e606c907aa5881ee4c668a68136119e6dfac6ce3a4",
|
"container": "fdb7e80e3339e8d0599282e606c907aa5881ee4c668a68136119e6dfac6ce3a4",
|
||||||
@@ -72,7 +77,7 @@
|
|||||||
"PkgName": "apk-tools",
|
"PkgName": "apk-tools",
|
||||||
"PkgIdentifier": {
|
"PkgIdentifier": {
|
||||||
"PURL": "pkg:apk/alpine/apk-tools@2.10.6-r0?arch=x86_64&distro=3.10.9",
|
"PURL": "pkg:apk/alpine/apk-tools@2.10.6-r0?arch=x86_64&distro=3.10.9",
|
||||||
"UID": "b7a64ae671a99195"
|
"UID": "19136436b32ef499"
|
||||||
},
|
},
|
||||||
"InstalledVersion": "2.10.6-r0",
|
"InstalledVersion": "2.10.6-r0",
|
||||||
"FixedVersion": "2.10.7-r0",
|
"FixedVersion": "2.10.7-r0",
|
||||||
@@ -88,6 +93,7 @@
|
|||||||
"Name": "Alpine Secdb",
|
"Name": "Alpine Secdb",
|
||||||
"URL": "https://secdb.alpinelinux.org/"
|
"URL": "https://secdb.alpinelinux.org/"
|
||||||
},
|
},
|
||||||
|
"Fingerprint": "sha256:f86484d912018e22a8212a9c21359a64583d86342016ed1c57e3b3d6e9afa63c",
|
||||||
"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",
|
"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",
|
||||||
"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.",
|
"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.",
|
||||||
"Severity": "CRITICAL",
|
"Severity": "CRITICAL",
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
format: json
|
|
||||||
severity: CRITICAL
|
severity: CRITICAL
|
||||||
vulnerability:
|
vulnerability:
|
||||||
type: os
|
type: os
|
||||||
output: yamlconfig.json
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vulnerabilities:
|
||||||
|
- id: CVE-2018-14618
|
||||||
|
- id: CVE-2018-16839
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
|
||||||
|
Report Summary
|
||||||
|
|
||||||
|
┌──────────────────────────────────────────┬────────┬─────────────────┬─────────┐
|
||||||
|
│ Target │ Type │ Vulnerabilities │ Secrets │
|
||||||
|
├──────────────────────────────────────────┼────────┼─────────────────┼─────────┤
|
||||||
|
│ knqyf263/vuln-image:1.2.3 (alpine 3.7.1) │ alpine │ 16 │ - │
|
||||||
|
├──────────────────────────────────────────┼────────┼─────────────────┼─────────┤
|
||||||
|
│ rust-app/Cargo.lock │ cargo │ 4 │ - │
|
||||||
|
└──────────────────────────────────────────┴────────┴─────────────────┴─────────┘
|
||||||
|
Legend:
|
||||||
|
- '-': Not scanned
|
||||||
|
- '0': Clean (no security findings detected)
|
||||||
|
|
||||||
|
|
||||||
|
knqyf263/vuln-image:1.2.3 (alpine 3.7.1)
|
||||||
|
========================================
|
||||||
|
Total: 16 (CRITICAL: 16)
|
||||||
|
|
||||||
|
┌─────────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
|
||||||
|
│ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │
|
||||||
|
├─────────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ curl │ CVE-2018-16840 │ CRITICAL │ fixed │ 7.61.0-r0 │ 7.61.1-r1 │ curl: Use-after-free when closing "easy" handle in │
|
||||||
|
│ │ │ │ │ │ │ Curl_close() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16840 │
|
||||||
|
│ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2018-16842 │ │ │ │ │ curl: Heap-based buffer over-read in the curl tool warning │
|
||||||
|
│ │ │ │ │ │ │ formatting │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16842 │
|
||||||
|
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-3822 │ │ │ │ 7.61.1-r2 │ curl: NTLMv2 type-3 header stack buffer overflow │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-3822 │
|
||||||
|
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-5481 │ │ │ │ 7.61.1-r3 │ curl: double free due to subsequent call of realloc() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5481 │
|
||||||
|
│ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-5482 │ │ │ │ │ curl: heap buffer overflow in function tftp_receive_packet() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5482 │
|
||||||
|
├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ git │ CVE-2018-17456 │ │ │ 2.15.2-r0 │ 2.15.3-r0 │ git: arbitrary code execution via .gitmodules │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-17456 │
|
||||||
|
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-1353 │ │ │ │ 2.15.4-r0 │ git: NTFS protections inactive when running Git in the │
|
||||||
|
│ │ │ │ │ │ │ Windows Subsystem for... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1353 │
|
||||||
|
├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ libbz2 │ CVE-2019-12900 │ │ │ 1.0.6-r6 │ 1.0.6-r7 │ bzip2: bzip2: Data integrity error when decompressing (with │
|
||||||
|
│ │ │ │ │ │ │ data integrity tests fail).... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-12900 │
|
||||||
|
├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ libcurl │ CVE-2018-16840 │ │ │ 7.61.1-r0 │ 7.61.1-r1 │ curl: Use-after-free when closing "easy" handle in │
|
||||||
|
│ │ │ │ │ │ │ Curl_close() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16840 │
|
||||||
|
│ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2018-16842 │ │ │ │ │ curl: Heap-based buffer over-read in the curl tool warning │
|
||||||
|
│ │ │ │ │ │ │ formatting │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-16842 │
|
||||||
|
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-3822 │ │ │ │ 7.61.1-r2 │ curl: NTLMv2 type-3 header stack buffer overflow │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-3822 │
|
||||||
|
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-5481 │ │ │ │ 7.61.1-r3 │ curl: double free due to subsequent call of realloc() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5481 │
|
||||||
|
│ ├────────────────┤ │ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-5482 │ │ │ │ │ curl: heap buffer overflow in function tftp_receive_packet() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-5482 │
|
||||||
|
├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ musl │ CVE-2019-14697 │ │ │ 1.1.18-r3 │ 1.1.18-r4 │ musl libc through 1.1.23 has an x87 floating-point stack │
|
||||||
|
│ │ │ │ │ │ │ adjustment im ...... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-14697 │
|
||||||
|
├─────────────┤ │ │ │ │ │ │
|
||||||
|
│ musl-utils │ │ │ │ │ │ │
|
||||||
|
│ │ │ │ │ │ │ │
|
||||||
|
│ │ │ │ │ │ │ │
|
||||||
|
├─────────────┼────────────────┤ │ ├───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||||
|
│ sqlite-libs │ CVE-2019-8457 │ │ │ 3.21.0-r1 │ 3.25.3-r1 │ sqlite: heap out-of-bound read in function rtreenode() │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-8457 │
|
||||||
|
└─────────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴──────────────────────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
rust-app/Cargo.lock (cargo)
|
||||||
|
===========================
|
||||||
|
Total: 4 (CRITICAL: 4)
|
||||||
|
|
||||||
|
┌───────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐
|
||||||
|
│ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │
|
||||||
|
├───────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
|
│ 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 │
|
||||||
|
│ │ │ │ │ │ │ for Rust.... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2020-25576 │
|
||||||
|
├───────────┼────────────────┤ │ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
|
│ smallvec │ CVE-2019-15551 │ │ │ 0.6.9 │ 0.6.10 │ An issue was discovered in the smallvec crate before 0.6.10 │
|
||||||
|
│ │ │ │ │ │ │ for Rust.... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-15551 │
|
||||||
|
│ ├────────────────┤ │ │ │ ├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2019-15554 │ │ │ │ │ An issue was discovered in the smallvec crate before 0.6.10 │
|
||||||
|
│ │ │ │ │ │ │ for Rust.... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-15554 │
|
||||||
|
│ ├────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
|
│ │ CVE-2021-25900 │ │ │ │ 0.6.14, 1.6.1 │ An issue was discovered in the smallvec crate before 0.6.14 │
|
||||||
|
│ │ │ │ │ │ │ and 1.x... │
|
||||||
|
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │
|
||||||
|
└───────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘
|
||||||
+180
-94
@@ -1,40 +1,39 @@
|
|||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
bats_load_library bats-support
|
||||||
|
bats_load_library bats-assert
|
||||||
|
bats_load_library bats-file
|
||||||
|
|
||||||
setup_file() {
|
setup_file() {
|
||||||
local owner=$GITHUB_REPOSITORY_OWNER
|
setup_trivy_env
|
||||||
export TRIVY_DB_REPOSITORY=ghcr.io/${owner}/trivy-db-act:latest
|
# bats provides fd 3 for printing directly to the terminal
|
||||||
export TRIVY_JAVA_DB_REPOSITORY=ghcr.io/${owner}/trivy-java-db-act:latest
|
# see https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal
|
||||||
export TRIVY_CHECKS_BUNDLE_REPOSITORY=ghcr.io/${owner}/trivy-checks-act:latest
|
docker pull knqyf263/vuln-image:1.2.3 1>&3 2>&3
|
||||||
|
trivy image --no-progress --download-db-only 1>&3 2>&3
|
||||||
}
|
}
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
bats_load_library bats-support
|
export TRIVY_OUTPUT="$BATS_TEST_TMPDIR/output.test"
|
||||||
bats_load_library bats-assert
|
export TRIVY_SKIP_DB_UPDATE=true
|
||||||
bats_load_library bats-file
|
export TRIVY_SKIP_JAVA_DB_UPDATE=true
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_json_fields() {
|
teardown() {
|
||||||
local file="$1"
|
reset_envs
|
||||||
if [[ "$file" == *.json ]]; then
|
|
||||||
jq 'del(.CreatedAt)' "$file" > tmp && mv tmp "$file"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_sarif_fields() {
|
setup_trivy_env() {
|
||||||
local file="$1"
|
export TRIVY_DB_REPOSITORY="ghcr.io/aquasecurity/trivy-db@sha256:7f8b879d4c23469b09c874b18d64a7eedea95f0ce08ea1862a783dc8d799be6f"
|
||||||
if [[ "$file" == *.sarif ]]; then
|
export TRIVY_JAVA_DB_REPOSITORY="ghcr.io/aquasecurity/trivy-java-db@sha256:f60faf3353edb6556f676c83c8b26d8a60398feab31ab2ec591537707a7354ba"
|
||||||
jq 'del(.runs[].tool.driver.version) | del(.runs[].originalUriBaseIds)' "$file" > tmp && mv tmp "$file"
|
export TRIVY_CHECKS_BUNDLE_REPOSITORY="ghcr.io/aquasecurity/trivy-checks@sha256:b63166ca02aa09e30a5127320384d7bd0d2760dc19bab3ab7041a6070114ba45" # v2.2.0
|
||||||
fi
|
|
||||||
|
export TRIVY_LIST_ALL_PKGS=false
|
||||||
|
export TRIVY_DISABLE_VEX_NOTICE=true
|
||||||
|
export TRIVY_SKIP_VERSION_CHECK=true
|
||||||
|
export TRIVY_DISABLE_TELEMETRY=true
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_github_fields() {
|
reset_envs() {
|
||||||
local file="$1"
|
|
||||||
if [[ "$file" == *.gsbom ]]; then
|
|
||||||
jq 'del(.detector.version) | del(.scanned) | del(.job) | del(.ref) | del(.sha)' "$file" > tmp && mv tmp "$file"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset_envs() {
|
|
||||||
local var
|
local var
|
||||||
for var in $(env | grep '^TRIVY_\|^INPUT_' | cut -d= -f1); do
|
for var in $(env | grep '^TRIVY_\|^INPUT_' | cut -d= -f1); do
|
||||||
unset "$var"
|
unset "$var"
|
||||||
@@ -42,133 +41,161 @@ function reset_envs() {
|
|||||||
rm -f trivy_envs.txt
|
rm -f trivy_envs.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
function compare_files() {
|
compare_files() {
|
||||||
local file1="$1"
|
local actual="$1"
|
||||||
local file2="$2"
|
local expected="$2"
|
||||||
|
|
||||||
# Some fields should be removed as they are environment dependent
|
# Some fields should be removed as they are environment dependent
|
||||||
# and may cause undesirable results when comparing files.
|
# and may cause undesirable results when comparing files.
|
||||||
remove_json_fields "$file1"
|
normalize_report "$actual"
|
||||||
remove_json_fields "$file2"
|
normalize_report "$expected"
|
||||||
|
|
||||||
remove_sarif_fields "$file1"
|
|
||||||
remove_sarif_fields "$file2"
|
|
||||||
|
|
||||||
remove_github_fields "$file1"
|
|
||||||
remove_github_fields "$file2"
|
|
||||||
|
|
||||||
if [ "${UPDATE_GOLDEN}" = "1" ]; then
|
if [ "${UPDATE_GOLDEN}" = "1" ]; then
|
||||||
cp "$file1" "$file2"
|
cp "$actual" "$expected"
|
||||||
echo "Updated golden file: $file2"
|
echo "Updated golden file: $expected"
|
||||||
else
|
else
|
||||||
run diff "$file1" "$file2"
|
run diff "$actual" "$expected"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
assert_files_equal "$file1" "$file2"
|
assert_files_equal "$actual" "$expected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$file1"
|
rm -f "$actual"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
normalize_report() {
|
||||||
|
local file="$1"
|
||||||
|
|
||||||
|
case "$TRIVY_FORMAT" in
|
||||||
|
json)
|
||||||
|
apply_jq_filter "$file" \
|
||||||
|
'del(.CreatedAt, .ReportID)'
|
||||||
|
;;
|
||||||
|
sarif)
|
||||||
|
apply_jq_filter "$file" \
|
||||||
|
'del(.runs[].tool.driver.version)
|
||||||
|
| del(.runs[].originalUriBaseIds)'
|
||||||
|
;;
|
||||||
|
github)
|
||||||
|
apply_jq_filter "$file" \
|
||||||
|
'del(.detector.version)
|
||||||
|
| del(.scanned)
|
||||||
|
| del(.job)
|
||||||
|
| del(.ref)
|
||||||
|
| del(.sha)'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_jq_filter() {
|
||||||
|
local file="$1"
|
||||||
|
local filter="$2"
|
||||||
|
local tmp="$BATS_TEST_TMPDIR/jq.tmp"
|
||||||
|
|
||||||
|
jq "$filter" "$file" > "$tmp" && mv "$tmp" "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test_case_compare() {
|
||||||
|
local expected_file="$1"
|
||||||
|
|
||||||
|
run ./entrypoint.sh
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
compare_files "$TRIVY_OUTPUT" "$expected_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test_case_fails() {
|
||||||
|
local expected_msg="$1"
|
||||||
|
|
||||||
|
run ./entrypoint.sh
|
||||||
|
assert_failure
|
||||||
|
|
||||||
|
if [ -n "$expected_msg" ]; then
|
||||||
|
assert_output --partial "$expected_msg"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy repo with securityCheck secret only" {
|
@test "trivy repo with securityCheck secret only" {
|
||||||
# trivy repo -f json -o repo.test --scanners=secret https://github.com/krol3/demo-trivy/
|
# trivy repo -f json -o repo.test --scanners=secret https://github.com/krol3/demo-trivy/
|
||||||
export TRIVY_FORMAT=json TRIVY_OUTPUT=repo.json TRIVY_SCANNERS=secret INPUT_SCAN_TYPE=repo INPUT_SCAN_REF="https://github.com/krol3/demo-trivy/"
|
export TRIVY_FORMAT=json TRIVY_SCANNERS=secret INPUT_SCAN_TYPE=repo INPUT_SCAN_REF="https://github.com/krol3/demo-trivy/"
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/secret-scan/report.json
|
||||||
compare_files repo.json ./test/data/secret-scan/report.json
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image" {
|
@test "trivy image" {
|
||||||
# trivy image --severity CRITICAL -o image.test knqyf263/vuln-image:1.2.3
|
# trivy image --severity CRITICAL -o image.test knqyf263/vuln-image:1.2.3
|
||||||
export TRIVY_OUTPUT=image.test TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3
|
export TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/image-scan/report
|
||||||
compare_files image.test ./test/data/image-scan/report
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy config sarif report" {
|
@test "trivy config sarif report" {
|
||||||
# trivy config -f sarif -o config-sarif.test ./test/data/config-sarif-report
|
# trivy config -f sarif -o config-sarif.test ./test/data/config-sarif-report
|
||||||
export TRIVY_FORMAT=sarif TRIVY_OUTPUT=config-sarif.sarif INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/config-sarif-report
|
export TRIVY_FORMAT=sarif INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/config-sarif-report
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/config-sarif-report/report.sarif
|
||||||
compare_files config-sarif.sarif ./test/data/config-sarif-report/report.sarif
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy config" {
|
@test "trivy config" {
|
||||||
# trivy config -f json -o config.json ./test/data/config-scan
|
# trivy config -f json -o config.json ./test/data/config-scan
|
||||||
export TRIVY_FORMAT=json TRIVY_OUTPUT=config.json INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/config-scan
|
export TRIVY_FORMAT=json INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/config-scan
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/config-scan/report.json
|
||||||
compare_files config.json ./test/data/config-scan/report.json
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy rootfs" {
|
@test "trivy rootfs" {
|
||||||
# trivy rootfs --output rootfs.test ./test/data/rootfs-scan
|
# trivy rootfs --output rootfs.test ./test/data/rootfs-scan
|
||||||
# TODO: add data
|
# TODO: add data
|
||||||
export TRIVY_OUTPUT=rootfs.test INPUT_SCAN_TYPE=rootfs INPUT_SCAN_REF=./test/data/rootfs-scan
|
export INPUT_SCAN_TYPE=rootfs INPUT_SCAN_REF=./test/data/rootfs-scan
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/rootfs-scan/report
|
||||||
compare_files rootfs.test ./test/data/rootfs-scan/report
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy fs" {
|
@test "trivy fs" {
|
||||||
# trivy fs --output fs.test ./test/data/fs-scan
|
# trivy fs --output fs.test ./test/data/fs-scan
|
||||||
# TODO: add data
|
# TODO: add data
|
||||||
export TRIVY_OUTPUT=fs.test INPUT_SCAN_TYPE=fs INPUT_SCAN_REF=./test/data/fs-scan
|
export INPUT_SCAN_TYPE=fs INPUT_SCAN_REF=./test/data/fs-scan
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/fs-scan/report
|
||||||
compare_files fs.test ./test/data/fs-scan/report
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image with trivyIgnores option" {
|
@test "trivy image with trivyIgnores option" {
|
||||||
# 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
|
# 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
|
||||||
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"
|
export 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"
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/with-ignore-files/report
|
||||||
compare_files image-trivyignores.test ./test/data/with-ignore-files/report
|
}
|
||||||
reset_envs
|
|
||||||
|
@test "trivy image with .trivyignore.yaml" {
|
||||||
|
# trivy image --severity CRITICAL --output with-yaml-ignore-file.test --ignorefile ./test/data/with-yaml-ignore-file/.trivyignore.yaml
|
||||||
|
export TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_IMAGE_REF=knqyf263/vuln-image:1.2.3 INPUT_TRIVYIGNORES=./test/data/with-yaml-ignore-file/.trivyignore.yaml
|
||||||
|
run_test_case_compare ./test/data/with-yaml-ignore-file/report
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image with sbom output" {
|
@test "trivy image with sbom output" {
|
||||||
# trivy image --format github knqyf263/vuln-image:1.2.3
|
# trivy image --format github knqyf263/vuln-image:1.2.3
|
||||||
export TRIVY_FORMAT=github TRIVY_OUTPUT=github-dep-snapshot.gsbom INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3
|
export TRIVY_FORMAT=github INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/github-dep-snapshot/report.gsbom
|
||||||
compare_files github-dep-snapshot.gsbom ./test/data/github-dep-snapshot/report.gsbom
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image with trivy.yaml config" {
|
@test "trivy image with trivy.yaml config" {
|
||||||
# trivy --config=./test/data/with-trivy-yaml-cfg/trivy.yaml image alpine:3.10
|
# trivy --config=./test/data/with-trivy-yaml-cfg/trivy.yaml image alpine:3.10
|
||||||
export TRIVY_CONFIG=./test/data/with-trivy-yaml-cfg/trivy.yaml INPUT_SCAN_TYPE=image INPUT_SCAN_REF=alpine:3.10
|
export TRIVY_CONFIG=./test/data/with-trivy-yaml-cfg/trivy.yaml TRIVY_FORMAT=json INPUT_SCAN_TYPE=image INPUT_SCAN_REF=alpine:3.10
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/with-trivy-yaml-cfg/report.json
|
||||||
compare_files yamlconfig.json ./test/data/with-trivy-yaml-cfg/report.json
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image with custom docker-host" {
|
@test "trivy image with custom docker-host" {
|
||||||
# trivy image --docker-host unix:///var/run/docker.sock --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3
|
# trivy image --docker-host unix:///var/run/docker.sock --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3
|
||||||
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
|
export TRIVY_SEVERITY=CRITICAL INPUT_SCAN_TYPE=image INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3 TRIVY_DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/image-scan/report
|
||||||
compare_files image.test ./test/data/image-scan/report
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy config with terraform variables" {
|
@test "trivy config with terraform variables" {
|
||||||
# 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
|
# 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
|
||||||
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
|
export TRIVY_FORMAT=json TRIVY_SEVERITY=MEDIUM INPUT_SCAN_TYPE=config INPUT_SCAN_REF=./test/data/with-tf-vars/main.tf TRIVY_TF_VARS=./test/data/with-tf-vars/dev.tfvars
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/with-tf-vars/report.json
|
||||||
compare_files tfvars.json ./test/data/with-tf-vars/report.json
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image via environment file" {
|
@test "trivy image via environment file" {
|
||||||
# trivy image --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3
|
# trivy image --severity CRITICAL --output image.test knqyf263/vuln-image:1.2.3
|
||||||
# Action injects inputs into the script via environment variables
|
# Action injects inputs into the script via environment variables
|
||||||
echo "export TRIVY_OUTPUT=image.test" >> trivy_envs.txt
|
|
||||||
echo "export TRIVY_SEVERITY=CRITICAL" >> trivy_envs.txt
|
echo "export TRIVY_SEVERITY=CRITICAL" >> trivy_envs.txt
|
||||||
echo "export INPUT_SCAN_TYPE=image" >> trivy_envs.txt
|
echo "export INPUT_SCAN_TYPE=image" >> trivy_envs.txt
|
||||||
echo "export INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3" >> trivy_envs.txt
|
echo "export INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3" >> trivy_envs.txt
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/image-scan/report
|
||||||
compare_files image.test ./test/data/image-scan/report
|
|
||||||
reset_envs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy image via environment file overrides env leakages" {
|
@test "trivy image via environment file overrides env leakages" {
|
||||||
@@ -177,11 +204,70 @@ function compare_files() {
|
|||||||
# If caller mixes old and new trivy-action version they could still have env leakage so verify that env vars already
|
# If caller mixes old and new trivy-action version they could still have env leakage so verify that env vars already
|
||||||
# in the env are overridden by those from the envs file
|
# in the env are overridden by those from the envs file
|
||||||
export INPUT_SCAN_REF=no/such-image:1.2.3
|
export INPUT_SCAN_REF=no/such-image:1.2.3
|
||||||
echo "export TRIVY_OUTPUT=image.test" >> trivy_envs.txt
|
|
||||||
echo "export TRIVY_SEVERITY=CRITICAL" >> trivy_envs.txt
|
echo "export TRIVY_SEVERITY=CRITICAL" >> trivy_envs.txt
|
||||||
echo "export INPUT_SCAN_TYPE=image" >> trivy_envs.txt
|
echo "export INPUT_SCAN_TYPE=image" >> trivy_envs.txt
|
||||||
echo "export INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3" >> trivy_envs.txt
|
echo "export INPUT_SCAN_REF=knqyf263/vuln-image:1.2.3" >> trivy_envs.txt
|
||||||
./entrypoint.sh
|
run_test_case_compare ./test/data/image-scan/report
|
||||||
compare_files image.test ./test/data/image-scan/report
|
}
|
||||||
reset_envs
|
|
||||||
}
|
@test "error if ignorefile does not exist" {
|
||||||
|
local missing_file="$BATS_TEST_TMPDIR/missing.ignore"
|
||||||
|
|
||||||
|
export INPUT_TRIVYIGNORES="$missing_file" \
|
||||||
|
INPUT_SCAN_TYPE=fs \
|
||||||
|
INPUT_SCAN_REF=./test/data/fs-scan
|
||||||
|
|
||||||
|
run_test_case_fails "cannot find ignorefile '$missing_file'"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "error with mixed yaml and plain ignore files" {
|
||||||
|
local plain_ignore="$BATS_TEST_TMPDIR/ignore-plain"
|
||||||
|
local yaml_ignore="$BATS_TEST_TMPDIR/ignore.yaml"
|
||||||
|
|
||||||
|
touch "$plain_ignore" "$yaml_ignore"
|
||||||
|
|
||||||
|
export INPUT_TRIVYIGNORES="$plain_ignore,$yaml_ignore" \
|
||||||
|
INPUT_SCAN_TYPE=fs \
|
||||||
|
INPUT_SCAN_REF=./test/data/fs-scan
|
||||||
|
|
||||||
|
run_test_case_fails "Cannot mix YAML and plain trivy ignore files"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "error if multiple YAML files provided" {
|
||||||
|
local yaml1="$BATS_TEST_TMPDIR/ignore1.yaml"
|
||||||
|
local yaml2="$BATS_TEST_TMPDIR/ignore2.yaml"
|
||||||
|
touch "$yaml1" "$yaml2"
|
||||||
|
|
||||||
|
export INPUT_TRIVYIGNORES="$yaml1,$yaml2" \
|
||||||
|
INPUT_SCAN_TYPE=fs \
|
||||||
|
INPUT_SCAN_REF=./test/data/fs-scan
|
||||||
|
|
||||||
|
run_test_case_fails "Multiple YAML ignore files provided"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "works with a single YAML file" {
|
||||||
|
local yaml="$BATS_TEST_TMPDIR/ignore.yaml"
|
||||||
|
touch "$yaml"
|
||||||
|
|
||||||
|
export INPUT_TRIVYIGNORES="$yaml" \
|
||||||
|
INPUT_SCAN_TYPE=fs \
|
||||||
|
INPUT_SCAN_REF=./test/data/fs-scan
|
||||||
|
|
||||||
|
run ./entrypoint.sh
|
||||||
|
assert_output --partial "Using YAML ignorefile '$yaml'"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "works with multiple plain ignore files" {
|
||||||
|
local plain1="$BATS_TEST_TMPDIR/ignore1"
|
||||||
|
local plain2="$BATS_TEST_TMPDIR/ignore2"
|
||||||
|
echo "CVE-1" > "$plain1"
|
||||||
|
echo "CVE-2" > "$plain2"
|
||||||
|
|
||||||
|
export INPUT_TRIVYIGNORES="$plain1,$plain2" \
|
||||||
|
INPUT_SCAN_TYPE=fs \
|
||||||
|
INPUT_SCAN_REF=./test/data/fs-scan
|
||||||
|
|
||||||
|
run ./entrypoint.sh
|
||||||
|
assert_output --partial "Found ignorefile '$plain1'"
|
||||||
|
assert_output --partial "Found ignorefile '$plain2'"
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
rules:
|
||||||
|
# GitHub environments are not currently used, so secrets are accessed outside of them.
|
||||||
|
# See: https://docs.zizmor.sh/audits/#secrets-outside-env
|
||||||
|
secrets-outside-env:
|
||||||
|
disable: true
|
||||||
Reference in New Issue
Block a user