mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-07 05:10:46 -08:00
Compare commits
128 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1be1e2e638 | ||
|
|
45bc9e0de4 | ||
|
|
3334e78fa3 | ||
|
|
27fb1bfdee | ||
|
|
845ae31e5d | ||
|
|
11a5b91a1a | ||
|
|
5eab464987 | ||
|
|
a00d00eb94 | ||
|
|
9bc326909f | ||
|
|
8559841677 | ||
|
|
0650e0e1d5 | ||
|
|
43b6496274 | ||
|
|
9181bc1f70 | ||
|
|
48e021ea6b | ||
|
|
107752df65 | ||
|
|
bd0c60364a | ||
|
|
76662d5dd7 | ||
|
|
be47b688c7 | ||
|
|
cc18f92cf3 | ||
|
|
572a6193e7 | ||
|
|
914c6f0921 | ||
|
|
3f02feeff3 | ||
|
|
57bb77c060 | ||
|
|
b19b56c341 | ||
|
|
b43b19ba54 | ||
|
|
14805002d3 | ||
|
|
83bb97ab13 | ||
|
|
79a1ba32d5 | ||
|
|
ff1c43a791 | ||
|
|
b608b116cc | ||
|
|
2c3b60f4c9 | ||
|
|
a6b8642134 | ||
|
|
90b80662c6 | ||
|
|
dcefc6bf3c | ||
|
|
601e25fb2f | ||
|
|
0bebec19f0 | ||
|
|
707ea94234 | ||
|
|
8e1fe769e4 | ||
|
|
4b36e97dce | ||
|
|
f0df725c5a | ||
|
|
009675c825 | ||
|
|
3ed86aa3d0 | ||
|
|
f31dea4bd6 | ||
|
|
d37c50a2b3 | ||
|
|
693d20516b | ||
|
|
65d89b99d1 | ||
|
|
a119ef86ea | ||
|
|
c8283cebde | ||
|
|
6c8b042548 | ||
|
|
c42f360f57 | ||
|
|
20c21caccf | ||
|
|
54388ffd16 | ||
|
|
99a2519816 | ||
|
|
d113b93139 | ||
|
|
5ab6d25880 | ||
|
|
0767cb8443 | ||
|
|
428ee19cae | ||
|
|
3e00dc346f | ||
|
|
cf2f0b2d1c | ||
|
|
70f507e1af | ||
|
|
befabc6b99 | ||
|
|
ee69abb78f | ||
|
|
8901f7be62 | ||
|
|
4e6bbbc8cc | ||
|
|
d70f346f53 | ||
|
|
3efb2fdeda | ||
|
|
ed590966a3 | ||
|
|
a2f39a34c5 | ||
|
|
5a10631023 | ||
|
|
4072115e5a | ||
|
|
7cad265b7a | ||
|
|
f8b5733112 | ||
|
|
10796a2910 | ||
|
|
abff1398c2 | ||
|
|
b40f60c405 | ||
|
|
67236f6aac | ||
|
|
00de24b16e | ||
|
|
5976d1fa07 | ||
|
|
f14bed4532 | ||
|
|
1ee05189f0 | ||
|
|
0000252ce4 | ||
|
|
ca0d972cdb | ||
|
|
0336555773 | ||
|
|
dd9cd9528f | ||
|
|
edb06826b4 | ||
|
|
c02b15b371 | ||
|
|
63ef760c69 | ||
|
|
3fa703c034 | ||
|
|
4d78747c40 | ||
|
|
67572dff6d | ||
|
|
e76d5ff98a | ||
|
|
011ea60db4 | ||
|
|
6445309de4 | ||
|
|
6e9c2c36da | ||
|
|
18eeea2f62 | ||
|
|
02b6914212 | ||
|
|
79096e1161 | ||
|
|
fc2e80cfe0 | ||
|
|
5f8d69d72e | ||
|
|
7916aafffb | ||
|
|
1b1ed39c7d | ||
|
|
234a360a7a | ||
|
|
b864b3b926 | ||
|
|
ad34c989de | ||
|
|
7148de3252 | ||
|
|
927acf9579 | ||
|
|
33074cfab3 | ||
|
|
ba9b0410c9 | ||
|
|
a754a04e2b | ||
|
|
9e4b57fb43 | ||
|
|
09fd299f96 | ||
|
|
09e13022c2 | ||
|
|
52cbfebcdd | ||
|
|
d6a2d6369a | ||
|
|
a12f58be57 | ||
|
|
ee518350c5 | ||
|
|
3987a679f9 | ||
|
|
2bb25e766b | ||
|
|
00c763bc10 | ||
|
|
cac5881bbb | ||
|
|
bd9c6e613e | ||
|
|
20f10673b9 | ||
|
|
1fac7bf1ba | ||
|
|
aaf265881e | ||
|
|
f8307635ad | ||
|
|
1aa3b7dc28 | ||
|
|
57904c0f97 | ||
|
|
bdccf72338 |
2
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
2
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
@@ -16,7 +16,7 @@ Briefly describe the problem you are having in a few paragraphs.
|
|||||||
## What happened instead?
|
## What happened instead?
|
||||||
|
|
||||||
|
|
||||||
## Output of run with `-debug`:
|
## Output of run with `--debug`:
|
||||||
|
|
||||||
```
|
```
|
||||||
(paste your output here)
|
(paste your output here)
|
||||||
|
|||||||
4
.github/workflows/canary.yaml
vendored
4
.github/workflows/canary.yaml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/reusable-release.yaml
|
uses: ./.github/workflows/reusable-release.yaml
|
||||||
with:
|
with:
|
||||||
goreleaser_config: goreleaser-canary.yml
|
goreleaser_config: goreleaser-canary.yml
|
||||||
goreleaser_options: '--snapshot --rm-dist --timeout 60m' # will not release
|
goreleaser_options: '--snapshot --clean --timeout 60m' # will not release
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
upload-binaries:
|
upload-binaries:
|
||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Restore Trivy binaries from cache
|
- name: Restore Trivy binaries from cache
|
||||||
uses: actions/cache@v3.2.6
|
uses: actions/cache@v3.3.1
|
||||||
with:
|
with:
|
||||||
path: dist/
|
path: dist/
|
||||||
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
||||||
|
|||||||
2
.github/workflows/publish-chart.yaml
vendored
2
.github/workflows/publish-chart.yaml
vendored
@@ -35,7 +35,7 @@ jobs:
|
|||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
- name: Setup Chart Linting
|
- name: Setup Chart Linting
|
||||||
id: lint
|
id: lint
|
||||||
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec
|
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76
|
||||||
- name: Setup Kubernetes cluster (KIND)
|
- name: Setup Kubernetes cluster (KIND)
|
||||||
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00
|
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00
|
||||||
with:
|
with:
|
||||||
|
|||||||
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/reusable-release.yaml
|
uses: ./.github/workflows/reusable-release.yaml
|
||||||
with:
|
with:
|
||||||
goreleaser_config: goreleaser.yml
|
goreleaser_config: goreleaser.yml
|
||||||
goreleaser_options: '--rm-dist --timeout 90m'
|
goreleaser_options: '--clean --timeout 90m'
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
deploy-packages:
|
deploy-packages:
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Restore Trivy binaries from cache
|
- name: Restore Trivy binaries from cache
|
||||||
uses: actions/cache@v3.2.6
|
uses: actions/cache@v3.3.1
|
||||||
with:
|
with:
|
||||||
path: dist/
|
path: dist/
|
||||||
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
||||||
|
|||||||
25
.github/workflows/reusable-release.yaml
vendored
25
.github/workflows/reusable-release.yaml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
contents: read # Not required for public repositories, but for clarity
|
contents: read # Not required for public repositories, but for clarity
|
||||||
steps:
|
steps:
|
||||||
- name: Cosign install
|
- name: Cosign install
|
||||||
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b
|
uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
@@ -65,7 +65,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
@@ -75,16 +75,29 @@ jobs:
|
|||||||
args: mod -licenses -json -output bom.json
|
args: mod -licenses -json -output bom.json
|
||||||
version: ^v1
|
version: ^v1
|
||||||
|
|
||||||
|
- name: "save gpg key"
|
||||||
|
env:
|
||||||
|
GPG_KEY: ${{ secrets.GPG_KEY }}
|
||||||
|
run: |
|
||||||
|
echo "$GPG_KEY" > gpg.key
|
||||||
|
|
||||||
- name: GoReleaser
|
- name: GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v4
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
version: v1.4.1
|
version: v1.16.2
|
||||||
args: release -f=${{ inputs.goreleaser_config}} ${{ inputs.goreleaser_options}}
|
args: release -f=${{ inputs.goreleaser_config}} ${{ inputs.goreleaser_options}}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
|
||||||
|
NFPM_DEFAULT_RPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
GPG_FILE: "gpg.key"
|
||||||
|
|
||||||
## push images to registries
|
- name: "remove gpg key"
|
||||||
## only for canary build
|
run: |
|
||||||
|
rm gpg.key
|
||||||
|
|
||||||
|
# Push images to registries (only for canary build)
|
||||||
|
# The custom Dockerfile.canary is necessary
|
||||||
|
# because GoReleaser Free doesn't support pushing images with the `--snapshot` flag.
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
if: ${{ inputs.goreleaser_config == 'goreleaser-canary.yml' }}
|
if: ${{ inputs.goreleaser_config == 'goreleaser-canary.yml' }}
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
@@ -99,7 +112,7 @@ jobs:
|
|||||||
public.ecr.aws/aquasecurity/trivy:canary
|
public.ecr.aws/aquasecurity/trivy:canary
|
||||||
|
|
||||||
- name: Cache Trivy binaries
|
- name: Cache Trivy binaries
|
||||||
uses: actions/cache@v3.2.6
|
uses: actions/cache@v3.3.1
|
||||||
with:
|
with:
|
||||||
path: dist/
|
path: dist/
|
||||||
# use 'github.sha' to create a unique cache folder for each run.
|
# use 'github.sha' to create a unique cache folder for each run.
|
||||||
|
|||||||
1
.github/workflows/semantic-pr.yaml
vendored
1
.github/workflows/semantic-pr.yaml
vendored
@@ -47,6 +47,7 @@ jobs:
|
|||||||
|
|
||||||
alpine
|
alpine
|
||||||
wolfi
|
wolfi
|
||||||
|
chainguard
|
||||||
redhat
|
redhat
|
||||||
alma
|
alma
|
||||||
rocky
|
rocky
|
||||||
|
|||||||
2
.github/workflows/stale-issues.yaml
vendored
2
.github/workflows/stale-issues.yaml
vendored
@@ -7,7 +7,7 @@ jobs:
|
|||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v7
|
- uses: actions/stale@v8
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: 'This issue is stale because it has been labeled with inactivity.'
|
stale-issue-message: 'This issue is stale because it has been labeled with inactivity.'
|
||||||
|
|||||||
46
.github/workflows/test.yaml
vendored
46
.github/workflows/test.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: oldstable
|
go-version: oldstable
|
||||||
|
|
||||||
@@ -41,18 +41,28 @@ jobs:
|
|||||||
- name: Lint
|
- name: Lint
|
||||||
uses: golangci/golangci-lint-action@v3.4.0
|
uses: golangci/golangci-lint-action@v3.4.0
|
||||||
with:
|
with:
|
||||||
version: v1.49
|
version: v1.52
|
||||||
args: --deadline=30m
|
args: --deadline=30m
|
||||||
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
|
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
|
||||||
if: matrix.operating-system == 'ubuntu-latest'
|
if: matrix.operating-system == 'ubuntu-latest'
|
||||||
|
|
||||||
# Install tools
|
- name: Install tools
|
||||||
- uses: aquaproj/aqua-installer@v2.0.2
|
uses: aquaproj/aqua-installer@v2.0.2
|
||||||
with:
|
with:
|
||||||
aqua_version: v1.25.0
|
aqua_version: v1.25.0
|
||||||
|
aqua_opts: ""
|
||||||
|
|
||||||
|
- name: Check if CLI references are up-to-date
|
||||||
|
run: |
|
||||||
|
mage docs:generate
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
echo "Run 'mage docs:generate' and push it"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if: matrix.operating-system == 'ubuntu-latest'
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: make test
|
run: mage test:unit
|
||||||
|
|
||||||
integration:
|
integration:
|
||||||
name: Integration Test
|
name: Integration Test
|
||||||
@@ -62,12 +72,17 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Install tools
|
||||||
|
uses: aquaproj/aqua-installer@v2.0.2
|
||||||
|
with:
|
||||||
|
aqua_version: v1.25.0
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: make test-integration
|
run: mage test:integration
|
||||||
|
|
||||||
module-test:
|
module-test:
|
||||||
name: Module Integration Test
|
name: Module Integration Test
|
||||||
@@ -77,19 +92,19 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
# Install tools
|
- name: Install tools
|
||||||
- uses: aquaproj/aqua-installer@v2.0.2
|
uses: aquaproj/aqua-installer@v2.0.2
|
||||||
with:
|
with:
|
||||||
aqua_version: v1.25.0
|
aqua_version: v1.25.0
|
||||||
|
|
||||||
- name: Run module integration tests
|
- name: Run module integration tests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
make test-module-integration
|
mage test:module
|
||||||
|
|
||||||
build-test:
|
build-test:
|
||||||
name: Build Test
|
name: Build Test
|
||||||
@@ -111,13 +126,14 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v4
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
version: v1.4.1
|
version: v1.16.2
|
||||||
args: release --skip-sign --snapshot --rm-dist --skip-publish --timeout 90m
|
args: release --skip-sign --snapshot --clean --skip-publish --timeout 90m
|
||||||
|
env:
|
||||||
|
GPG_FILE: "nogpg.key"
|
||||||
|
|||||||
8
.github/workflows/vm-test.yaml
vendored
8
.github/workflows/vm-test.yaml
vendored
@@ -24,9 +24,13 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
- name: Install tools
|
||||||
|
uses: aquaproj/aqua-installer@v2.0.2
|
||||||
|
with:
|
||||||
|
aqua_version: v1.25.0
|
||||||
- name: Run vm integration tests
|
- name: Run vm integration tests
|
||||||
run: |
|
run: |
|
||||||
make test-vm-integration
|
mage test:vm
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -34,4 +34,7 @@ integration/testdata/fixtures/vm-images
|
|||||||
dist
|
dist
|
||||||
|
|
||||||
# WebAssembly
|
# WebAssembly
|
||||||
*.wasm
|
*.wasm
|
||||||
|
|
||||||
|
# Signing
|
||||||
|
gpg.key
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3.17.2
|
FROM alpine:3.17.3
|
||||||
RUN apk --no-cache add ca-certificates git
|
RUN apk --no-cache add ca-certificates git
|
||||||
COPY trivy /usr/local/bin/trivy
|
COPY trivy /usr/local/bin/trivy
|
||||||
COPY contrib/*.tpl contrib/
|
COPY contrib/*.tpl contrib/
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
FROM alpine:3.17.2
|
FROM alpine:3.17.3
|
||||||
RUN apk --no-cache add ca-certificates git
|
RUN apk --no-cache add ca-certificates git
|
||||||
|
|
||||||
# binaries were created with GoReleaser
|
# binaries were created with GoReleaser
|
||||||
# need to copy binaries from folder with correct architecture
|
# need to copy binaries from folder with correct architecture
|
||||||
# example architecture folder: dist/trivy_canary_build_linux_arm64/trivy
|
# example architecture folder: dist/trivy_canary_build_linux_arm64/trivy
|
||||||
|
# GoReleaser adds _v* to the folder name, but only when GOARCH is amd64
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
COPY "dist/trivy_canary_build_linux_${TARGETARCH}/trivy" /usr/local/bin/trivy
|
COPY "dist/trivy_canary_build_linux_${TARGETARCH}*/trivy" /usr/local/bin/trivy
|
||||||
COPY contrib/*.tpl contrib/
|
COPY contrib/*.tpl contrib/
|
||||||
ENTRYPOINT ["trivy"]
|
ENTRYPOINT ["trivy"]
|
||||||
|
|||||||
@@ -10,3 +10,6 @@ RUN curl --retry 5 -OL https://github.com/protocolbuffers/protobuf/releases/down
|
|||||||
|
|
||||||
RUN go install github.com/twitchtv/twirp/protoc-gen-twirp@v8.1.0
|
RUN go install github.com/twitchtv/twirp/protoc-gen-twirp@v8.1.0
|
||||||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1
|
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1
|
||||||
|
RUN go install github.com/magefile/mage@v1.14.0
|
||||||
|
|
||||||
|
ENV TRIVY_PROTOC_CONTAINER=true
|
||||||
|
|||||||
135
Makefile
135
Makefile
@@ -1,135 +0,0 @@
|
|||||||
VERSION := $(patsubst v%,%,$(shell git describe --tags --always)) #Strips the v prefix from the tag
|
|
||||||
LDFLAGS := -ldflags "-s -w -X=main.version=$(VERSION)"
|
|
||||||
|
|
||||||
GOPATH := $(firstword $(subst :, ,$(shell go env GOPATH)))
|
|
||||||
GOBIN := $(GOPATH)/bin
|
|
||||||
GOSRC := $(GOPATH)/src
|
|
||||||
|
|
||||||
TEST_MODULE_DIR := pkg/module/testdata
|
|
||||||
TEST_MODULE_SRCS := $(wildcard $(TEST_MODULE_DIR)/*/*.go)
|
|
||||||
TEST_MODULES := $(patsubst %.go,%.wasm,$(TEST_MODULE_SRCS))
|
|
||||||
|
|
||||||
EXAMPLE_MODULE_DIR := examples/module
|
|
||||||
EXAMPLE_MODULE_SRCS := $(wildcard $(EXAMPLE_MODULE_DIR)/*/*.go)
|
|
||||||
EXAMPLE_MODULES := $(patsubst %.go,%.wasm,$(EXAMPLE_MODULE_SRCS))
|
|
||||||
|
|
||||||
MKDOCS_IMAGE := aquasec/mkdocs-material:dev
|
|
||||||
MKDOCS_PORT := 8000
|
|
||||||
|
|
||||||
export CGO_ENABLED := 0
|
|
||||||
|
|
||||||
u := $(if $(update),-u)
|
|
||||||
|
|
||||||
# Tools
|
|
||||||
$(GOBIN)/wire:
|
|
||||||
go install github.com/google/wire/cmd/wire@v0.5.0
|
|
||||||
|
|
||||||
$(GOBIN)/crane:
|
|
||||||
go install github.com/google/go-containerregistry/cmd/crane@v0.9.0
|
|
||||||
|
|
||||||
$(GOBIN)/golangci-lint:
|
|
||||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v1.49.0
|
|
||||||
|
|
||||||
$(GOBIN)/labeler:
|
|
||||||
go install github.com/knqyf263/labeler@latest
|
|
||||||
|
|
||||||
$(GOBIN)/easyjson:
|
|
||||||
go install github.com/mailru/easyjson/...@v0.7.7
|
|
||||||
|
|
||||||
.PHONY: wire
|
|
||||||
wire: $(GOBIN)/wire
|
|
||||||
wire gen ./pkg/commands/... ./pkg/rpc/...
|
|
||||||
|
|
||||||
.PHONY: mock
|
|
||||||
mock: $(GOBIN)/mockery
|
|
||||||
mockery -all -inpkg -case=snake -dir $(DIR)
|
|
||||||
|
|
||||||
.PHONY: deps
|
|
||||||
deps:
|
|
||||||
go get ${u} -d
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
.PHONY: generate-test-modules
|
|
||||||
generate-test-modules: $(TEST_MODULES)
|
|
||||||
|
|
||||||
# Compile WASM modules for unit and integration tests
|
|
||||||
%.wasm:%.go
|
|
||||||
@if !(type "tinygo" > /dev/null 2>&1); then \
|
|
||||||
echo "Need to install TinyGo. Follow https://tinygo.org/getting-started/install/"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
go generate $<
|
|
||||||
|
|
||||||
# Run unit tests
|
|
||||||
.PHONY: test
|
|
||||||
test: $(TEST_MODULES)
|
|
||||||
go test -v -short -coverprofile=coverage.txt -covermode=atomic ./...
|
|
||||||
|
|
||||||
integration/testdata/fixtures/images/*.tar.gz: $(GOBIN)/crane
|
|
||||||
mkdir -p integration/testdata/fixtures/images/
|
|
||||||
integration/scripts/download-images.sh
|
|
||||||
|
|
||||||
# Run integration tests
|
|
||||||
.PHONY: test-integration
|
|
||||||
test-integration: integration/testdata/fixtures/images/*.tar.gz
|
|
||||||
go test -v -tags=integration ./integration/... ./pkg/fanal/test/integration/...
|
|
||||||
|
|
||||||
# Run WASM integration tests
|
|
||||||
.PHONY: test-module-integration
|
|
||||||
test-module-integration: integration/testdata/fixtures/images/*.tar.gz $(EXAMPLE_MODULES)
|
|
||||||
go test -v -tags=module_integration ./integration/...
|
|
||||||
|
|
||||||
# Run VM integration tests
|
|
||||||
.PHONY: test-vm-integration
|
|
||||||
test-vm-integration: integration/testdata/fixtures/vm-images/*.img.gz
|
|
||||||
go test -v -tags=vm_integration ./integration/...
|
|
||||||
|
|
||||||
integration/testdata/fixtures/vm-images/*.img.gz:
|
|
||||||
integration/scripts/download-vm-images.sh
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: lint
|
|
||||||
lint: $(GOBIN)/golangci-lint
|
|
||||||
$(GOBIN)/golangci-lint run --timeout 5m
|
|
||||||
|
|
||||||
.PHONY: fmt
|
|
||||||
fmt:
|
|
||||||
find ./ -name "*.proto" | xargs clang-format -i
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build:
|
|
||||||
go build $(LDFLAGS) ./cmd/trivy
|
|
||||||
|
|
||||||
.PHONY: protoc
|
|
||||||
protoc:
|
|
||||||
docker build -t trivy-protoc - < Dockerfile.protoc
|
|
||||||
docker run --rm -it -v ${PWD}:/app -w /app trivy-protoc make _$@
|
|
||||||
|
|
||||||
_protoc:
|
|
||||||
for path in `find ./rpc/ -name "*.proto" -type f`; do \
|
|
||||||
protoc --twirp_out=. --twirp_opt=paths=source_relative --go_out=. --go_opt=paths=source_relative $${path} || exit; \
|
|
||||||
done
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install:
|
|
||||||
go install $(LDFLAGS) ./cmd/trivy
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf integration/testdata/fixtures/images
|
|
||||||
|
|
||||||
# Create labels on GitHub
|
|
||||||
.PHONY: label
|
|
||||||
label: $(GOBIN)/labeler
|
|
||||||
labeler apply misc/triage/labels.yaml -r aquasecurity/trivy -l 5
|
|
||||||
|
|
||||||
# Run MkDocs development server to preview the documentation page
|
|
||||||
.PHONY: mkdocs-serve
|
|
||||||
mkdocs-serve:
|
|
||||||
docker build -t $(MKDOCS_IMAGE) -f docs/build/Dockerfile docs/build
|
|
||||||
docker run --name mkdocs-serve --rm -v $(PWD):/docs -p $(MKDOCS_PORT):8000 $(MKDOCS_IMAGE)
|
|
||||||
|
|
||||||
# Generate JSON marshaler/unmarshaler for TinyGo/WebAssembly as TinyGo doesn't support encoding/json.
|
|
||||||
.PHONY: easyjson
|
|
||||||
easyjson: $(GOBIN)/easyjson
|
|
||||||
easyjson pkg/module/serialize/types.go
|
|
||||||
@@ -51,6 +51,11 @@ Trivy is integrated with many popular platforms and applications. The complete l
|
|||||||
- [VS Code plugin](https://github.com/aquasecurity/trivy-vscode-extension)
|
- [VS Code plugin](https://github.com/aquasecurity/trivy-vscode-extension)
|
||||||
- See [Ecosystem] for more
|
- See [Ecosystem] for more
|
||||||
|
|
||||||
|
### Canary builds
|
||||||
|
There are canary builds ([Docker Hub](https://hub.docker.com/r/aquasec/trivy/tags?page=1&name=canary), [GitHub](https://github.com/aquasecurity/trivy/pkgs/container/trivy/75776514?tag=canary), [ECR](https://gallery.ecr.aws/aquasecurity/trivy#canary) images and [binaries](https://github.com/aquasecurity/trivy/actions/workflows/canary.yaml)) as generated every push to main branch.
|
||||||
|
|
||||||
|
Please be aware: canary builds might have critical bugs, it's not recommended for use in production.
|
||||||
|
|
||||||
### General usage
|
### General usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
# https://aquaproj.github.io/
|
# https://aquaproj.github.io/
|
||||||
registries:
|
registries:
|
||||||
- type: standard
|
- type: standard
|
||||||
ref: v3.106.0 # renovate: depName=aquaproj/aqua-registry
|
ref: v3.157.0 # renovate: depName=aquaproj/aqua-registry
|
||||||
packages:
|
packages:
|
||||||
- name: tinygo-org/tinygo@v0.26.0
|
- name: tinygo-org/tinygo@v0.27.0
|
||||||
|
- name: WebAssembly/binaryen@version_112
|
||||||
|
- name: magefile/mage@v1.14.0
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ adjust_arch() {
|
|||||||
386) ARCH=32bit ;;
|
386) ARCH=32bit ;;
|
||||||
amd64) ARCH=64bit ;;
|
amd64) ARCH=64bit ;;
|
||||||
arm) ARCH=ARM ;;
|
arm) ARCH=ARM ;;
|
||||||
|
armv7) ARCH=ARM ;;
|
||||||
arm64) ARCH=ARM64 ;;
|
arm64) ARCH=ARM64 ;;
|
||||||
ppc64le) OS=PPC64LE ;;
|
ppc64le) OS=PPC64LE ;;
|
||||||
darwin) ARCH=macOS ;;
|
darwin) ARCH=macOS ;;
|
||||||
|
|||||||
@@ -9,11 +9,66 @@ Thank you for taking interest in contributing to Trivy!
|
|||||||
1. Your PR is more likely to be accepted if it includes tests (We have not historically been very strict about tests, but we would like to improve this!).
|
1. Your PR is more likely to be accepted if it includes tests (We have not historically been very strict about tests, but we would like to improve this!).
|
||||||
1. If your PR affects the user experience in some way, please update the README.md and the CLI help accordingly.
|
1. If your PR affects the user experience in some way, please update the README.md and the CLI help accordingly.
|
||||||
|
|
||||||
### Title
|
## Development
|
||||||
|
Install the necessary tools for development by following their respective installation instructions.
|
||||||
|
|
||||||
|
- [Go](https://go.dev/doc/install)
|
||||||
|
- [Mage](https://magefile.org/)
|
||||||
|
|
||||||
|
### Build
|
||||||
|
After making changes to the Go source code, build the project with the following command:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ mage build
|
||||||
|
$ ./trivy -h
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lint
|
||||||
|
You must pass the linter checks:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ mage lint
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, you need to have run `go mod tidy`, so execute the following command as well:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ mage tidy
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unit tests
|
||||||
|
Your PR must pass all the unit tests. You can test it as below.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mage test:unit
|
||||||
|
```
|
||||||
|
|
||||||
|
### Integration tests
|
||||||
|
Your PR must pass all the integration tests. You can test it as below.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mage test:integration
|
||||||
|
```
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
If you update CLI flags, you need to generate the CLI references.
|
||||||
|
The test will fail if they are not up-to-date.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ mage docs:generate
|
||||||
|
```
|
||||||
|
|
||||||
|
You can build the documents as below and view it at http://localhost:8000.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mage docs:serve
|
||||||
|
```
|
||||||
|
|
||||||
|
## Title
|
||||||
It is not that strict, but we use the title conventions in this repository.
|
It is not that strict, but we use the title conventions in this repository.
|
||||||
Each commit message doesn't have to follow the conventions as long as it is clear and descriptive since it will be squashed and merged.
|
Each commit message doesn't have to follow the conventions as long as it is clear and descriptive since it will be squashed and merged.
|
||||||
|
|
||||||
#### Format of the title
|
### Format of the title
|
||||||
|
|
||||||
```
|
```
|
||||||
<type>(<scope>): <subject>
|
<type>(<scope>): <subject>
|
||||||
@@ -122,7 +177,7 @@ others:
|
|||||||
|
|
||||||
The `<scope>` can be empty (e.g. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.
|
The `<scope>` can be empty (e.g. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.
|
||||||
|
|
||||||
#### Example titles
|
### Example titles
|
||||||
|
|
||||||
```
|
```
|
||||||
feat(alma): add support for AlmaLinux
|
feat(alma): add support for AlmaLinux
|
||||||
@@ -143,33 +198,15 @@ chore(deps): bump go.uber.org/zap from 1.19.1 to 1.20.0
|
|||||||
**NOTE**: please do not use `chore(deps): update fanal` and something like that if you add new features or fix bugs in Trivy-related projects.
|
**NOTE**: please do not use `chore(deps): update fanal` and something like that if you add new features or fix bugs in Trivy-related projects.
|
||||||
The PR title should describe what the PR adds or fixes even though it just updates the dependency in Trivy.
|
The PR title should describe what the PR adds or fixes even though it just updates the dependency in Trivy.
|
||||||
|
|
||||||
### Unit tests
|
## Commits
|
||||||
Your PR must pass all the unit tests. You can test it as below.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make test
|
|
||||||
```
|
|
||||||
|
|
||||||
### Integration tests
|
|
||||||
Your PR must pass all the integration tests. You can test it as below.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make test-integration
|
|
||||||
```
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
You can build the documents as below and view it at http://localhost:8000.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make mkdocs-serve
|
|
||||||
```
|
|
||||||
|
|
||||||
## Understand where your pull request belongs
|
## Understand where your pull request belongs
|
||||||
|
|
||||||
Trivy is composed of several repositories that work together:
|
Trivy is composed of several repositories that work together:
|
||||||
|
|
||||||
- [Trivy](https://github.com/aquasecurity/trivy) is the client-side, user-facing, command line tool.
|
- [Trivy](https://github.com/aquasecurity/trivy) is the client-side, user-facing, command line tool.
|
||||||
- [vuln-list](https://github.com/aquasecurity/vuln-list) is a vulnerabilities database, aggregated from different sources, and normalized for easy consumption. Think of this as the "server" side of the trivy command line tool. **There should be no pull requests to this repo**
|
- [vuln-list](https://github.com/aquasecurity/vuln-list) is a vulnerability database, aggregated from different sources, and normalized for easy consumption. Think of this as the "server" side of the trivy command line tool. **There should be no pull requests to this repo**
|
||||||
- [vuln-list-update](https://github.com/aquasecurity/vuln-list-update) is the code that maintains the vuln-list database.
|
- [vuln-list-update](https://github.com/aquasecurity/vuln-list-update) is the code that maintains the vuln-list database.
|
||||||
- [trivy-db](https://github.com/aquasecurity/trivy-db) maintains the vulnerability database pulled by Trivy CLI.
|
- [trivy-db](https://github.com/aquasecurity/trivy-db) maintains the vulnerability database pulled by Trivy CLI.
|
||||||
- [go-dep-parser](https://github.com/aquasecurity/go-dep-parser) is a library for parsing lock files such as package-lock.json and Gemfile.lock.
|
- [go-dep-parser](https://github.com/aquasecurity/go-dep-parser) is a library for parsing lock files such as package-lock.json and Gemfile.lock.
|
||||||
|
|||||||
@@ -139,4 +139,4 @@ $ trivy conf --skip-policy-update /path/to/conf
|
|||||||
[allowlist]: ../references/troubleshooting.md
|
[allowlist]: ../references/troubleshooting.md
|
||||||
[oras]: https://oras.land/cli/
|
[oras]: https://oras.land/cli/
|
||||||
|
|
||||||
[^1]: This is only required to scan `jar` files. More information about `Java index db` [here](../vulnerability/languages/java.md)
|
[^1]: This is only required to scan `jar` files. More information about `Java index db` [here](../scanner/vulnerability/language/java.md)
|
||||||
|
|||||||
@@ -1,7 +1,2 @@
|
|||||||
Docker Hub needs `TRIVY_USERNAME` and `TRIVY_PASSWORD`.
|
See [here](./index.md) for the detail.
|
||||||
You don't need to set ENV vars when download from public repository.
|
You don't need to provide a credential when download from public repository.
|
||||||
|
|
||||||
```bash
|
|
||||||
export TRIVY_USERNAME={DOCKERHUB_USERNAME}
|
|
||||||
export TRIVY_PASSWORD={DOCKERHUB_PASSWORD}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1,4 +1,49 @@
|
|||||||
Trivy can download images from a private registry, without installing `Docker` or any other 3rd party tools.
|
Trivy can download images from a private registry without the need for installing Docker or any other 3rd party tools.
|
||||||
That's because it's easy to run in a CI process.
|
This makes it easy to run within a CI process.
|
||||||
|
|
||||||
All you have to do is install `Trivy` and set ENV vars.
|
## Credential
|
||||||
|
To use Trivy with private images, simply install it and provide your credentials:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ TRIVY_USERNAME=YOUR_USERNAME TRIVY_PASSWORD=YOUR_PASSWORD trivy image YOUR_PRIVATE_IMAGE
|
||||||
|
```
|
||||||
|
|
||||||
|
Trivy also supports providing credentials through CLI flags:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ TRIVY_PASSWORD=YOUR_PASSWORD trivy image --username YOUR_USERNAME YOUR_PRIVATE_IMAGE
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
The CLI flag `--password` is available, but its use is not recommended for security reasons.
|
||||||
|
|
||||||
|
You can also store your credentials in `trivy.yaml`.
|
||||||
|
For more information, please refer to [the documentation](../../references/configuration/config-file.md).
|
||||||
|
|
||||||
|
It can handle multiple sets of credentials as well:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ export TRIVY_USERNAME=USERNAME1,USERNAME2
|
||||||
|
$ export TRIVY_PASSWORD=PASSWORD1,PASSWORD2
|
||||||
|
$ trivy image YOUR_PRIVATE_IMAGE
|
||||||
|
```
|
||||||
|
|
||||||
|
In the example above, Trivy attempts to use two pairs of credentials:
|
||||||
|
|
||||||
|
- USERNAME1/PASSWORD1
|
||||||
|
- USERNAME2/PASSWORD2
|
||||||
|
|
||||||
|
Please note that the number of usernames and passwords must be the same.
|
||||||
|
|
||||||
|
## docker login
|
||||||
|
If you have Docker configured locally and have set up the credentials, Trivy can access them.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ docker login ghcr.io
|
||||||
|
Username:
|
||||||
|
Password:
|
||||||
|
$ trivy image ghcr.io/your/private_image
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
`docker login` can be used with any container runtime, such as Podman.
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
# Cache
|
# Cache
|
||||||
|
The cache directory includes
|
||||||
|
|
||||||
|
- [Vulnerability Database][trivy-db][^1]
|
||||||
|
- [Java Index Database][trivy-java-db][^2]
|
||||||
|
- [Misconfiguration Policies][misconf-policies][^3]
|
||||||
|
- Cache of previous scans.
|
||||||
|
|
||||||
|
The cache option is common to all scanners.
|
||||||
|
|
||||||
## Clear Caches
|
## Clear Caches
|
||||||
The `--clear-cache` option removes caches.
|
The `--clear-cache` option removes caches.
|
||||||
@@ -44,7 +52,14 @@ Two options:
|
|||||||
$ trivy server --cache-backend redis://localhost:6379
|
$ trivy server --cache-backend redis://localhost:6379
|
||||||
```
|
```
|
||||||
|
|
||||||
Trivy also support for connecting to Redis using TLS, you only need to specify `--redis-ca` , `--redis-cert` , and `--redis-key` option.
|
If you want to use TLS with Redis, you can enable it by specifying the `--redis-tls` flag.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy server --cache-backend redis://localhost:6379 --redis-tls
|
||||||
|
```
|
||||||
|
|
||||||
|
Trivy also supports for connecting to Redis with your certificates.
|
||||||
|
You need to specify `--redis-ca` , `--redis-cert` , and `--redis-key` options.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy server --cache-backend redis://localhost:6379 \
|
$ trivy server --cache-backend redis://localhost:6379 \
|
||||||
@@ -53,4 +68,10 @@ $ trivy server --cache-backend redis://localhost:6379 \
|
|||||||
--redis-key /path/to/key.pem
|
--redis-key /path/to/key.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
TLS option for redis is hidden from Trivy command-line flag, but you still can use it.
|
[trivy-db]: ./db.md#vulnerability-database
|
||||||
|
[trivy-java-db]: ./db.md#java-index-database
|
||||||
|
[misconf-policies]: ../scanner/misconfiguration/policy/builtin.md
|
||||||
|
|
||||||
|
[^1]: Downloaded when scanning for vulnerabilities
|
||||||
|
[^2]: Downloaded when scanning `jar/war/par/ear` files
|
||||||
|
[^3]: Downloaded when scanning for misconfigurations
|
||||||
@@ -1,9 +1,19 @@
|
|||||||
# Vulnerability DB
|
# DB
|
||||||
|
|
||||||
## Skip update of vulnerability DB
|
| Scanner | Supported |
|
||||||
`Trivy` downloads its vulnerability database every 12 hours when it starts operating.
|
|:----------------:|:---------:|
|
||||||
This is usually fast, as the size of the DB is only 10~30MB.
|
| Vulnerability | ✓ |
|
||||||
But if you want to skip even that, use the `--skip-db-update` option.
|
| Misconfiguration | |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
|
The vulnerability database and the Java index database are needed only for vulnerability scanning.
|
||||||
|
See [here](../scanner/vulnerability/index.md) for the detail.
|
||||||
|
|
||||||
|
## Vulnerability Database
|
||||||
|
|
||||||
|
### Skip update of vulnerability DB
|
||||||
|
If you want to skip downloading the vulnerability database, use the `--skip-db-update` option.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image --skip-db-update python:3.4-alpine3.9
|
$ trivy image --skip-db-update python:3.4-alpine3.9
|
||||||
@@ -29,7 +39,7 @@ Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 0, CRITICAL: 0)
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Only download vulnerability database
|
### Only download vulnerability database
|
||||||
You can also ask `Trivy` to simply retrieve the vulnerability database.
|
You can also ask `Trivy` to simply retrieve the vulnerability database.
|
||||||
This is useful to initialize workers in Continuous Integration systems.
|
This is useful to initialize workers in Continuous Integration systems.
|
||||||
|
|
||||||
@@ -37,14 +47,14 @@ This is useful to initialize workers in Continuous Integration systems.
|
|||||||
$ trivy image --download-db-only
|
$ trivy image --download-db-only
|
||||||
```
|
```
|
||||||
|
|
||||||
## DB Repository
|
### DB Repository
|
||||||
`Trivy` could also download the vulnerability database from an external OCI registry by using `--db-repository` option.
|
`Trivy` could also download the vulnerability database from an external OCI registry by using `--db-repository` option.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image --db-repository registry.gitlab.com/gitlab-org/security-products/dependencies/trivy-db
|
$ trivy image --db-repository registry.gitlab.com/gitlab-org/security-products/dependencies/trivy-db
|
||||||
```
|
```
|
||||||
|
|
||||||
## Java Vulnerability DB
|
## Java Index Database
|
||||||
The same options are also available for the Java index DB, which is used for scanning Java applications.
|
The same options are also available for the Java index DB, which is used for scanning Java applications.
|
||||||
Skipping an update can be done by using the `--skip-java-db-update` option, while `--download-java-db-only` can be used to only download the Java index DB.
|
Skipping an update can be done by using the `--skip-java-db-update` option, while `--download-java-db-only` can be used to only download the Java index DB.
|
||||||
|
|
||||||
@@ -53,3 +63,10 @@ Downloading the Java index DB from an external OCI registry can be done by using
|
|||||||
```
|
```
|
||||||
$ trivy image --java-db-repository registry.gitlab.com/gitlab-org/security-products/dependencies/trivy-java-db --download-java-db-only
|
$ trivy image --java-db-repository registry.gitlab.com/gitlab-org/security-products/dependencies/trivy-java-db --download-java-db-only
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Remove DBs
|
||||||
|
The `--reset` flag removes all caches and databases.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy image --reset
|
||||||
|
```
|
||||||
@@ -1,8 +1,18 @@
|
|||||||
# Filter Vulnerabilities
|
# Filtering
|
||||||
|
Trivy provides various methods for filtering the results.
|
||||||
|
|
||||||
|
|
||||||
## Hide Unfixed Vulnerabilities
|
## Hide Unfixed Vulnerabilities
|
||||||
|
|
||||||
By default, `Trivy` also detects unpatched/unfixed vulnerabilities. This means you can't fix these vulnerabilities even if you update all packages.
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
|
By default, `Trivy` also detects unpatched/unfixed vulnerabilities.
|
||||||
|
This means you can't fix these vulnerabilities even if you update all packages.
|
||||||
If you would like to ignore them, use the `--ignore-unfixed` option.
|
If you would like to ignore them, use the `--ignore-unfixed` option.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -50,6 +60,13 @@ Total: 4730 (UNKNOWN: 1, LOW: 145, MEDIUM: 3487, HIGH: 1014, CRITICAL: 83)
|
|||||||
|
|
||||||
## By Severity
|
## By Severity
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
Use `--severity` option.
|
Use `--severity` option.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -113,7 +130,69 @@ Total: 1785 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 1680, CRITICAL: 105)
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## By Vulnerability IDs
|
```bash
|
||||||
|
trivy conf --severity HIGH,CRITICAL examples/misconf/mixed
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Result</summary>
|
||||||
|
|
||||||
|
```shell
|
||||||
|
2022-05-16T13:50:42.718+0100 INFO Detected config files: 3
|
||||||
|
|
||||||
|
Dockerfile (dockerfile)
|
||||||
|
=======================
|
||||||
|
Tests: 17 (SUCCESSES: 16, FAILURES: 1, EXCEPTIONS: 0)
|
||||||
|
Failures: 1 (HIGH: 1, CRITICAL: 0)
|
||||||
|
|
||||||
|
HIGH: Last USER command in Dockerfile should not be 'root'
|
||||||
|
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||||
|
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
|
||||||
|
|
||||||
|
See https://avd.aquasec.com/misconfig/ds002
|
||||||
|
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
|
Dockerfile:3
|
||||||
|
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
|
3 [ USER root
|
||||||
|
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
deployment.yaml (kubernetes)
|
||||||
|
============================
|
||||||
|
Tests: 8 (SUCCESSES: 8, FAILURES: 0, EXCEPTIONS: 0)
|
||||||
|
Failures: 0 (HIGH: 0, CRITICAL: 0)
|
||||||
|
|
||||||
|
|
||||||
|
main.tf (terraform)
|
||||||
|
===================
|
||||||
|
Tests: 1 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: 0)
|
||||||
|
Failures: 1 (HIGH: 0, CRITICAL: 1)
|
||||||
|
|
||||||
|
CRITICAL: Classic resources should not be used.
|
||||||
|
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||||
|
AWS Classic resources run in a shared environment with infrastructure owned by other AWS customers. You should run
|
||||||
|
resources in a VPC instead.
|
||||||
|
|
||||||
|
See https://avd.aquasec.com/misconfig/avd-aws-0081
|
||||||
|
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
|
main.tf:2-4
|
||||||
|
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
|
2 ┌ resource "aws_db_security_group" "sg" {
|
||||||
|
3 │
|
||||||
|
4 └ }
|
||||||
|
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## By Finding IDs
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | |
|
||||||
|
|
||||||
Use `.trivyignore`.
|
Use `.trivyignore`.
|
||||||
|
|
||||||
@@ -128,6 +207,15 @@ CVE-2019-14697 exp:2023-01-01
|
|||||||
# No impact in our settings
|
# No impact in our settings
|
||||||
CVE-2019-1543
|
CVE-2019-1543
|
||||||
|
|
||||||
|
# Ignore misconfigurations
|
||||||
|
AVD-DS-0002
|
||||||
|
|
||||||
|
# Ignore secrets
|
||||||
|
generic-unwanted-rule
|
||||||
|
aws-account-id
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
$ trivy image python:3.4-alpine3.9
|
$ trivy image python:3.4-alpine3.9
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -146,7 +234,14 @@ Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## By Type
|
## By Vulnerability Target
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
Use `--vuln-type` option.
|
Use `--vuln-type` option.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -154,6 +249,7 @@ $ trivy image --vuln-type os ruby:2.4.0
|
|||||||
```
|
```
|
||||||
|
|
||||||
Available values:
|
Available values:
|
||||||
|
|
||||||
- library
|
- library
|
||||||
- os
|
- os
|
||||||
|
|
||||||
@@ -169,7 +265,8 @@ Available values:
|
|||||||
2019-05-22T19:36:53.406+0200 [34mINFO[0m Detecting pipenv vulnerabilities...
|
2019-05-22T19:36:53.406+0200 [34mINFO[0m Detecting pipenv vulnerabilities...
|
||||||
|
|
||||||
ruby:2.4.0 (debian 8.7)
|
ruby:2.4.0 (debian 8.7)
|
||||||
Total: 4751 (UNKNOWN: 1, LOW: 150, MEDIUM: 3504, HIGH: 1013, CRITICAL: 83)
|
=======================
|
||||||
|
Total: 7 (UNKNOWN: 0, LOW: 1, MEDIUM: 1, HIGH: 3, CRITICAL: 2)
|
||||||
|
|
||||||
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
||||||
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
|
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
|
||||||
@@ -180,23 +277,6 @@ Total: 4751 (UNKNOWN: 1, LOW: 150, MEDIUM: 3504, HIGH: 1013, CRITICAL: 83)
|
|||||||
| | CVE-2018-16839 | HIGH | | 7.61.1-r1 | curl: Integer overflow leading |
|
| | CVE-2018-16839 | HIGH | | 7.61.1-r1 | curl: Integer overflow leading |
|
||||||
| | | | | | to heap-based buffer overflow in |
|
| | | | | | to heap-based buffer overflow in |
|
||||||
| | | | | | Curl_sasl_create_plain_message() |
|
| | | | | | Curl_sasl_create_plain_message() |
|
||||||
+ +------------------+ + +---------------+----------------------------------+
|
|
||||||
| | CVE-2019-3822 | | | 7.61.1-r2 | curl: NTLMv2 type-3 header |
|
|
||||||
| | | | | | stack buffer overflow |
|
|
||||||
+ +------------------+ + +---------------+----------------------------------+
|
|
||||||
| | CVE-2018-16840 | | | 7.61.1-r1 | curl: Use-after-free when |
|
|
||||||
| | | | | | closing "easy" handle in |
|
|
||||||
| | | | | | Curl_close() |
|
|
||||||
+ +------------------+----------+ +---------------+----------------------------------+
|
|
||||||
| | CVE-2019-3823 | MEDIUM | | 7.61.1-r2 | curl: SMTP end-of-response |
|
|
||||||
| | | | | | out-of-bounds read |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2018-16890 | | | | curl: NTLM type-2 heap |
|
|
||||||
| | | | | | out-of-bounds buffer read |
|
|
||||||
+ +------------------+ + +---------------+----------------------------------+
|
|
||||||
| | CVE-2018-16842 | | | 7.61.1-r1 | curl: Heap-based buffer |
|
|
||||||
| | | | | | over-read in the curl tool |
|
|
||||||
| | | | | | warning formatting |
|
|
||||||
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
||||||
| git | CVE-2018-17456 | HIGH | 2.15.2-r0 | 2.15.3-r0 | git: arbitrary code execution |
|
| git | CVE-2018-17456 | HIGH | 2.15.2-r0 | 2.15.3-r0 | git: arbitrary code execution |
|
||||||
| | | | | | via .gitmodules |
|
| | | | | | via .gitmodules |
|
||||||
@@ -208,67 +288,6 @@ Total: 4751 (UNKNOWN: 1, LOW: 150, MEDIUM: 3504, HIGH: 1013, CRITICAL: 83)
|
|||||||
| libssh2 | CVE-2019-3855 | CRITICAL | 1.8.0-r2 | 1.8.1-r0 | libssh2: Integer overflow in |
|
| libssh2 | CVE-2019-3855 | CRITICAL | 1.8.0-r2 | 1.8.1-r0 | libssh2: Integer overflow in |
|
||||||
| | | | | | transport read resulting in |
|
| | | | | | transport read resulting in |
|
||||||
| | | | | | out of bounds write... |
|
| | | | | | out of bounds write... |
|
||||||
+ +------------------+----------+ + +----------------------------------+
|
|
||||||
| | CVE-2019-3861 | MEDIUM | | | libssh2: Out-of-bounds reads |
|
|
||||||
| | | | | | with specially crafted SSH |
|
|
||||||
| | | | | | packets |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3857 | | | | libssh2: Integer overflow in |
|
|
||||||
| | | | | | SSH packet processing channel |
|
|
||||||
| | | | | | resulting in out of... |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3856 | | | | libssh2: Integer overflow in |
|
|
||||||
| | | | | | keyboard interactive handling |
|
|
||||||
| | | | | | resulting in out of bounds... |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3863 | | | | libssh2: Integer overflow |
|
|
||||||
| | | | | | in user authenticate |
|
|
||||||
| | | | | | keyboard interactive allows |
|
|
||||||
| | | | | | out-of-bounds writes |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3862 | | | | libssh2: Out-of-bounds memory |
|
|
||||||
| | | | | | comparison with specially |
|
|
||||||
| | | | | | crafted message channel |
|
|
||||||
| | | | | | request |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3860 | | | | libssh2: Out-of-bounds reads |
|
|
||||||
| | | | | | with specially crafted SFTP |
|
|
||||||
| | | | | | packets |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3858 | | | | libssh2: Zero-byte allocation |
|
|
||||||
| | | | | | with a specially crafted SFTP |
|
|
||||||
| | | | | | packed leading to an... |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-3859 | | | | libssh2: Unchecked use of |
|
|
||||||
| | | | | | _libssh2_packet_require and |
|
|
||||||
| | | | | | _libssh2_packet_requirev |
|
|
||||||
| | | | | | resulting in out-of-bounds |
|
|
||||||
| | | | | | read |
|
|
||||||
+---------+------------------+ +-------------------+---------------+----------------------------------+
|
|
||||||
| libxml2 | CVE-2018-14404 | | 2.9.7-r0 | 2.9.8-r1 | libxml2: NULL pointer |
|
|
||||||
| | | | | | dereference in |
|
|
||||||
| | | | | | xpath.c:xmlXPathCompOpEval() |
|
|
||||||
| | | | | | can allow attackers to cause |
|
|
||||||
| | | | | | a... |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2018-14567 | | | | libxml2: Infinite loop when |
|
|
||||||
| | | | | | --with-lzma is used allows for |
|
|
||||||
| | | | | | denial of service... |
|
|
||||||
+ +------------------+----------+ + +----------------------------------+
|
|
||||||
| | CVE-2018-9251 | LOW | | | libxml2: infinite loop in |
|
|
||||||
| | | | | | xz_decomp function in xzlib.c |
|
|
||||||
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
|
||||||
| openssh | CVE-2019-6109 | MEDIUM | 7.5_p1-r9 | 7.5_p1-r10 | openssh: Missing character |
|
|
||||||
| | | | | | encoding in progress display |
|
|
||||||
| | | | | | allows for spoofing of scp... |
|
|
||||||
+ +------------------+ + + +----------------------------------+
|
|
||||||
| | CVE-2019-6111 | | | | openssh: Improper validation |
|
|
||||||
| | | | | | of object names allows |
|
|
||||||
| | | | | | malicious server to overwrite |
|
|
||||||
| | | | | | files... |
|
|
||||||
+ +------------------+----------+ + +----------------------------------+
|
|
||||||
| | CVE-2018-20685 | LOW | | | openssh: scp client improper |
|
|
||||||
| | | | | | directory name validation |
|
|
||||||
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
+---------+------------------+----------+-------------------+---------------+----------------------------------+
|
||||||
| sqlite | CVE-2018-20346 | MEDIUM | 3.21.0-r1 | 3.25.3-r0 | CVE-2018-20505 CVE-2018-20506 |
|
| sqlite | CVE-2018-20346 | MEDIUM | 3.21.0-r1 | 3.25.3-r0 | CVE-2018-20505 CVE-2018-20506 |
|
||||||
| | | | | | sqlite: Multiple flaws in |
|
| | | | | | sqlite: Multiple flaws in |
|
||||||
@@ -283,13 +302,20 @@ Total: 4751 (UNKNOWN: 1, LOW: 150, MEDIUM: 3504, HIGH: 1013, CRITICAL: 83)
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
## By Open Policy Agent
|
## By Open Policy Agent
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
!!! warning "EXPERIMENTAL"
|
!!! warning "EXPERIMENTAL"
|
||||||
This feature might change without preserving backwards compatibility.
|
This feature might change without preserving backwards compatibility.
|
||||||
|
|
||||||
Trivy supports Open Policy Agent (OPA) to filter vulnerabilities. You can specify a Rego file with `--ignore-policy` option.
|
Trivy supports Open Policy Agent (OPA) to filter vulnerabilities.
|
||||||
|
You can specify a Rego file with `--ignore-policy` option.
|
||||||
|
|
||||||
The Rego package name must be `trivy` and it must include a rule called `ignore` which determines if each individual vulnerability should be excluded (ignore=true) or not (ignore=false). In the policy, each vulnerability will be available for inspection as the `input` variable. The structure of each vulnerability input is the same as for the Trivy JSON output.
|
The Rego package name must be `trivy` and it must include a rule called `ignore` which determines if each individual vulnerability should be excluded (ignore=true) or not (ignore=false). In the policy, each vulnerability will be available for inspection as the `input` variable. The structure of each vulnerability input is the same as for the Trivy JSON output.
|
||||||
There is a built-in Rego library with helper functions that you can import into your policy using: `import data.lib.trivy`. For more info about the helper functions, look at the library [here][helper]
|
There is a built-in Rego library with helper functions that you can import into your policy using: `import data.lib.trivy`. For more info about the helper functions, look at the library [here][helper]
|
||||||
@@ -357,3 +383,28 @@ Total: 9 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 4, CRITICAL: 5)
|
|||||||
|
|
||||||
[helper]: https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/pkg/result/module.go
|
[helper]: https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/pkg/result/module.go
|
||||||
[policy]: https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/contrib/example_policy
|
[policy]: https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/contrib/example_policy
|
||||||
|
|
||||||
|
## By Inline Comments
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
|
Some configuration file formats (e.g. Terraform) support inline comments.
|
||||||
|
|
||||||
|
In cases where trivy can detect comments of a specific format immediately adjacent to resource definitions, it is possible to filter/ignore findings from a single point of resource definition (in contrast to `.trivyignore`, which has a directory-wide scope on all of the files scanned).
|
||||||
|
|
||||||
|
The format for these comments is `trivy:ignore:<Vulnerability ID>` immediately following the format-specific line-comment token.
|
||||||
|
|
||||||
|
For example, to filter a Vulnerability ID "AVD-GCP-0051" in a Terraform HCL file:
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
#trivy:ignore:AVD-GCP-0051
|
||||||
|
resource "google_container_cluster" "one_off_test" {
|
||||||
|
name = var.cluster_name
|
||||||
|
location = var.region
|
||||||
|
}
|
||||||
|
```
|
||||||
31
docs/docs/configuration/index.md
Normal file
31
docs/docs/configuration/index.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Configuration
|
||||||
|
Trivy can be configured using the following ways. Each item takes precedence over the item below it:
|
||||||
|
|
||||||
|
- CLI flags
|
||||||
|
- Environment variables
|
||||||
|
- Configuration file
|
||||||
|
|
||||||
|
## CLI Flags
|
||||||
|
You can view the list of available flags using the `--help` option.
|
||||||
|
For more details, please refer to [the CLI reference](../references/configuration/cli/trivy.md).
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
Trivy can be customized by environment variables.
|
||||||
|
The environment variable key is the flag name converted by the following procedure.
|
||||||
|
|
||||||
|
- Add `TRIVY_` prefix
|
||||||
|
- Make it all uppercase
|
||||||
|
- Replace `-` with `_`
|
||||||
|
|
||||||
|
For example,
|
||||||
|
|
||||||
|
- `--debug` => `TRIVY_DEBUG`
|
||||||
|
- `--cache-dir` => `TRIVY_CACHE_DIR`
|
||||||
|
|
||||||
|
```
|
||||||
|
$ TRIVY_DEBUG=true TRIVY_SEVERITY=CRITICAL trivy image alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration File
|
||||||
|
By default, Trivy reads the `trivy.yaml` file.
|
||||||
|
For more details, please refer to [the page](../references/configuration/config-file.md).
|
||||||
@@ -1,24 +1,91 @@
|
|||||||
# Others
|
# Others
|
||||||
|
|
||||||
|
## Enable/Disable Scanners
|
||||||
|
You can enable/disable scanners with the `--scanners` flag.
|
||||||
|
|
||||||
|
Supported values:
|
||||||
|
|
||||||
|
- vuln
|
||||||
|
- config
|
||||||
|
- secret
|
||||||
|
- license
|
||||||
|
|
||||||
|
For example, container image scanning enables vulnerability and secret scanners by default.
|
||||||
|
If you don't need secret scanning, it can be disabled.
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
$ trivy image --scanners vuln alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
## Skip Files
|
## Skip Files
|
||||||
Trivy traversals directories and looks for all lock files by default.
|
| Scanner | Supported |
|
||||||
If your image contains lock files which are not maintained by you, you can skip the file.
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
|
By default, Trivy traverses directories and searches for all necessary files for scanning.
|
||||||
|
You can skip files that you don't maintain using the `--skip-files` flag.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image --skip-files "/Gemfile.lock" --skip-files "/var/lib/gems/2.5.0/gems/http_parser.rb-0.6.0/Gemfile.lock" quay.io/fluentd_elasticsearch/fluentd:v2.9.0
|
$ trivy image --skip-files "/Gemfile.lock" --skip-files "/var/lib/gems/2.5.0/gems/http_parser.rb-0.6.0/Gemfile.lock" quay.io/fluentd_elasticsearch/fluentd:v2.9.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
It's possible to specify globs as part of the value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ trivy image --skip-files "./testdata/*/bar" .
|
||||||
|
```
|
||||||
|
|
||||||
|
Will skip any file named `bar` in the subdirectories of testdata.
|
||||||
|
|
||||||
## Skip Directories
|
## Skip Directories
|
||||||
Trivy traversals directories and look for all lock files by default.
|
| Scanner | Supported |
|
||||||
If your image contains lock files which are not maintained by you, you can skip traversal in the specific directory.
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
|
By default, Trivy traverses directories and searches for all necessary files for scanning.
|
||||||
|
You can skip directories that you don't maintain using the `--skip-dirs` flag.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image --skip-dirs /var/lib/gems/2.5.0/gems/fluent-plugin-detect-exceptions-0.0.13 --skip-dirs "/var/lib/gems/2.5.0/gems/http_parser.rb-0.6.0" quay.io/fluentd_elasticsearch/fluentd:v2.9.0
|
$ trivy image --skip-dirs /var/lib/gems/2.5.0/gems/fluent-plugin-detect-exceptions-0.0.13 --skip-dirs "/var/lib/gems/2.5.0/gems/http_parser.rb-0.6.0" quay.io/fluentd_elasticsearch/fluentd:v2.9.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
It's possible to specify globs as part of the value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ trivy image --skip-dirs "./testdata/*" .
|
||||||
|
```
|
||||||
|
|
||||||
|
Will skip all subdirectories of the testdata directory.
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
Glob patterns work with any trivy subcommand (image, config, etc.) and can be specified to skip both directories (with `--skip-dirs`) and files (with `--skip-files`).
|
||||||
|
|
||||||
|
|
||||||
|
### Advanced globbing
|
||||||
|
Trivy also supports the [globstar](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Pattern-Matching) pattern matching.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ trivy image --skip-files "**/foo"``` image:tag
|
||||||
|
```
|
||||||
|
|
||||||
|
Will skip the file `foo` that happens to be nested under any parent(s).
|
||||||
|
|
||||||
## File patterns
|
## File patterns
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
When a directory is given as an input, Trivy will recursively look for and test all files based on file patterns.
|
When a directory is given as an input, Trivy will recursively look for and test all files based on file patterns.
|
||||||
The default file patterns are [here](../../misconfiguration/custom/index.md).
|
The default file patterns are [here](../scanner/misconfiguration/custom/index.md).
|
||||||
|
|
||||||
In addition to the default file patterns, the `--file-patterns` option takes regexp patterns to look for your files.
|
In addition to the default file patterns, the `--file-patterns` option takes regexp patterns to look for your files.
|
||||||
For example, it may be useful when your file name of Dockerfile doesn't match the default patterns.
|
For example, it may be useful when your file name of Dockerfile doesn't match the default patterns.
|
||||||
@@ -30,10 +97,17 @@ A file pattern contains the analyzer it is used for, and the pattern itself, joi
|
|||||||
--file-patterns "dockerfile:.*.docker" --file-patterns "yaml:deployment" --file-patterns "pip:requirements-.*\.txt"
|
--file-patterns "dockerfile:.*.docker" --file-patterns "yaml:deployment" --file-patterns "pip:requirements-.*\.txt"
|
||||||
```
|
```
|
||||||
|
|
||||||
For more details, see [an example](https://github.com/aquasecurity/trivy/tree/{{ git.commit }}/examples/misconf/file-patterns)
|
The prefixes are listed [here](https://github.com/aquasecurity/trivy/tree/{{ git.commit }}/pkg/fanal/analyzer/const.go)
|
||||||
|
|
||||||
## Exit Code
|
## Exit Code
|
||||||
By default, `Trivy` exits with code 0 even when vulnerabilities are detected.
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
|
By default, `Trivy` exits with code 0 even when security issues are detected.
|
||||||
Use the `--exit-code` option if you want to exit with a non-zero exit code.
|
Use the `--exit-code` option if you want to exit with a non-zero exit code.
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -69,6 +143,13 @@ $ trivy image --exit-code 1 --severity CRITICAL ruby:2.4.0
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Exit on EOL
|
## Exit on EOL
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
Sometimes you may surprisingly get 0 vulnerabilities in an old image:
|
Sometimes you may surprisingly get 0 vulnerabilities in an old image:
|
||||||
|
|
||||||
- Enabling `--ignore-unfixed` option while all packages have no fixed versions.
|
- Enabling `--ignore-unfixed` option while all packages have no fixed versions.
|
||||||
@@ -118,20 +199,3 @@ The following example will fail when a critical vulnerability is found or the OS
|
|||||||
```
|
```
|
||||||
$ trivy image --exit-code 1 --exit-on-eol 1 --severity CRITICAL alpine:3.16.3
|
$ trivy image --exit-code 1 --exit-on-eol 1 --severity CRITICAL alpine:3.16.3
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reset
|
|
||||||
The `--reset` option removes all caches and database.
|
|
||||||
After this, it takes a long time as the vulnerability database needs to be rebuilt locally.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy image --reset
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Result</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
2019-05-16T13:05:31.935+0900 INFO Resetting...
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
@@ -1,13 +1,35 @@
|
|||||||
# Report Formats
|
# Reporting
|
||||||
|
|
||||||
|
Trivy supports the following formats:
|
||||||
|
|
||||||
|
- Table
|
||||||
|
- JSON
|
||||||
|
- [SARIF](https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning)
|
||||||
|
- Template
|
||||||
|
- SBOM
|
||||||
|
|
||||||
## Table (Default)
|
## Table (Default)
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image -f table golang:1.12-alpine
|
$ trivy image -f table golang:1.12-alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
### Show origins of vulnerable dependencies
|
### Show origins of vulnerable dependencies
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
!!! warning "EXPERIMENTAL"
|
!!! warning "EXPERIMENTAL"
|
||||||
This feature might change without preserving backwards compatibility.
|
This feature might change without preserving backwards compatibility.
|
||||||
|
|
||||||
@@ -25,6 +47,7 @@ The following packages/languages are currently supported:
|
|||||||
- rpm
|
- rpm
|
||||||
- Node.js
|
- Node.js
|
||||||
- npm: package-lock.json
|
- npm: package-lock.json
|
||||||
|
- pnpm: pnpm-lock.yaml
|
||||||
- yarn: yarn.lock
|
- yarn: yarn.lock
|
||||||
- .NET
|
- .NET
|
||||||
- NuGet: packages.lock.json
|
- NuGet: packages.lock.json
|
||||||
@@ -34,8 +57,10 @@ The following packages/languages are currently supported:
|
|||||||
- Bundler: Gemfile.lock
|
- Bundler: Gemfile.lock
|
||||||
- Rust
|
- Rust
|
||||||
- Binaries built with [cargo-auditable][cargo-auditable]
|
- Binaries built with [cargo-auditable][cargo-auditable]
|
||||||
- Go
|
- Go
|
||||||
- Modules: go.mod
|
- Modules: go.mod
|
||||||
|
- PHP
|
||||||
|
- Composer
|
||||||
|
|
||||||
This tree is the reverse of the npm list command.
|
This tree is the reverse of the npm list command.
|
||||||
However, if you want to resolve a vulnerability in a particular indirect dependency, the reversed tree is useful to know where that dependency comes from and identify which package you actually need to update.
|
However, if you want to resolve a vulnerability in a particular indirect dependency, the reversed tree is useful to know where that dependency comes from and identify which package you actually need to update.
|
||||||
@@ -82,13 +107,17 @@ Then, you can try to update **axios@0.21.4** and **cra-append-sw@2.7.0** to reso
|
|||||||
|
|
||||||
## JSON
|
## JSON
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image -f json -o results.json golang:1.12-alpine
|
$ trivy image -f json -o results.json golang:1.12-alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! caution
|
|
||||||
v0.20.0 changes the JSON schema. For more details, see [here][new-json].
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Result</summary>
|
<summary>Result</summary>
|
||||||
|
|
||||||
@@ -211,7 +240,14 @@ $ trivy image -f json -o results.json golang:1.12-alpine
|
|||||||
`VulnerabilityID`, `PkgName`, `InstalledVersion`, and `Severity` in `Vulnerabilities` are always filled with values, but other fields might be empty.
|
`VulnerabilityID`, `PkgName`, `InstalledVersion`, and `Severity` in `Vulnerabilities` are always filled with values, but other fields might be empty.
|
||||||
|
|
||||||
## SARIF
|
## SARIF
|
||||||
[Sarif][sarif] can be generated with the `--format sarif` option.
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | |
|
||||||
|
|
||||||
|
[SARIF][sarif] can be generated with the `--format sarif` flag.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image --format sarif -o report.sarif golang:1.12-alpine
|
$ trivy image --format sarif -o report.sarif golang:1.12-alpine
|
||||||
@@ -221,6 +257,13 @@ This SARIF file can be uploaded to GitHub code scanning results, and there is a
|
|||||||
|
|
||||||
## Template
|
## Template
|
||||||
|
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | ✓ |
|
||||||
|
|
||||||
### Custom Template
|
### Custom Template
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
@@ -269,16 +312,36 @@ $ trivy image --format template --template "@/path/to/template" golang:1.12-alpi
|
|||||||
|
|
||||||
If Trivy is installed using rpm then default templates can be found at `/usr/local/share/trivy/templates`.
|
If Trivy is installed using rpm then default templates can be found at `/usr/local/share/trivy/templates`.
|
||||||
|
|
||||||
#### XML
|
#### JUnit
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
In the following example using the template `junit.tpl` XML can be generated.
|
In the following example using the template `junit.tpl` XML can be generated.
|
||||||
```
|
```
|
||||||
$ trivy image --format template --template "@contrib/junit.tpl" -o junit-report.xml golang:1.12-alpine
|
$ trivy image --format template --template "@contrib/junit.tpl" -o junit-report.xml golang:1.12-alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
#### ASFF
|
#### ASFF
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | ✓ |
|
||||||
|
| License | |
|
||||||
|
|
||||||
Trivy also supports an [ASFF template for reporting findings to AWS Security Hub][asff]
|
Trivy also supports an [ASFF template for reporting findings to AWS Security Hub][asff]
|
||||||
|
|
||||||
#### HTML
|
#### HTML
|
||||||
|
| Scanner | Supported |
|
||||||
|
|:----------------:|:---------:|
|
||||||
|
| Vulnerability | ✓ |
|
||||||
|
| Misconfiguration | ✓ |
|
||||||
|
| Secret | |
|
||||||
|
| License | |
|
||||||
|
|
||||||
```
|
```
|
||||||
$ trivy image --format template --template "@contrib/html.tpl" -o report.html golang:1.12-alpine
|
$ trivy image --format template --template "@contrib/html.tpl" -o report.html golang:1.12-alpine
|
||||||
@@ -290,9 +353,11 @@ The following example shows use of default HTML template when Trivy is installed
|
|||||||
$ trivy image --format template --template "@/usr/local/share/trivy/templates/html.tpl" -o report.html golang:1.12-alpine
|
$ trivy image --format template --template "@/usr/local/share/trivy/templates/html.tpl" -o report.html golang:1.12-alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## SBOM
|
||||||
|
See [here](../supply-chain/sbom.md) for details.
|
||||||
|
|
||||||
[cargo-auditable]: https://github.com/rust-secure-code/cargo-auditable/
|
[cargo-auditable]: https://github.com/rust-secure-code/cargo-auditable/
|
||||||
[new-json]: https://github.com/aquasecurity/trivy/discussions/1050
|
|
||||||
[action]: https://github.com/aquasecurity/trivy-action
|
[action]: https://github.com/aquasecurity/trivy-action
|
||||||
[asff]: ../../../tutorials/integrations/aws-security-hub.md
|
[asff]: ../../tutorials/integrations/aws-security-hub.md
|
||||||
[sarif]: https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-results-from-code-scanning
|
[sarif]: https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-results-from-code-scanning
|
||||||
[sprig]: http://masterminds.github.io/sprig/
|
[sprig]: http://masterminds.github.io/sprig/
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
# Filter Misconfigurations
|
|
||||||
|
|
||||||
## By Severity
|
|
||||||
|
|
||||||
Use `--severity` option.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
trivy conf --severity HIGH,CRITICAL examples/misconf/mixed
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Result</summary>
|
|
||||||
|
|
||||||
```shell
|
|
||||||
2022-05-16T13:50:42.718+0100 INFO Detected config files: 3
|
|
||||||
|
|
||||||
Dockerfile (dockerfile)
|
|
||||||
=======================
|
|
||||||
Tests: 17 (SUCCESSES: 16, FAILURES: 1, EXCEPTIONS: 0)
|
|
||||||
Failures: 1 (HIGH: 1, CRITICAL: 0)
|
|
||||||
|
|
||||||
HIGH: Last USER command in Dockerfile should not be 'root'
|
|
||||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
||||||
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
|
|
||||||
|
|
||||||
See https://avd.aquasec.com/misconfig/ds002
|
|
||||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
||||||
Dockerfile:3
|
|
||||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
||||||
3 [ USER root
|
|
||||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deployment.yaml (kubernetes)
|
|
||||||
============================
|
|
||||||
Tests: 8 (SUCCESSES: 8, FAILURES: 0, EXCEPTIONS: 0)
|
|
||||||
Failures: 0 (HIGH: 0, CRITICAL: 0)
|
|
||||||
|
|
||||||
|
|
||||||
main.tf (terraform)
|
|
||||||
===================
|
|
||||||
Tests: 1 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: 0)
|
|
||||||
Failures: 1 (HIGH: 0, CRITICAL: 1)
|
|
||||||
|
|
||||||
CRITICAL: Classic resources should not be used.
|
|
||||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
||||||
AWS Classic resources run in a shared environment with infrastructure owned by other AWS customers. You should run
|
|
||||||
resources in a VPC instead.
|
|
||||||
|
|
||||||
See https://avd.aquasec.com/misconfig/avd-aws-0081
|
|
||||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
||||||
main.tf:2-4
|
|
||||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
||||||
2 ┌ resource "aws_db_security_group" "sg" {
|
|
||||||
3 │
|
|
||||||
4 └ }
|
|
||||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Others
|
|
||||||
|
|
||||||
!!! hint
|
|
||||||
See also [Others](../../vulnerability/examples/others.md) in Vulnerability section.
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# Policy
|
|
||||||
|
|
||||||
## Pass custom policies
|
|
||||||
You can pass directories including your custom policies through `--policy` option.
|
|
||||||
This can be repeated for specifying multiple directories.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd examplex/misconf/
|
|
||||||
trivy conf --policy custom-policy/policy --policy combine/policy --namespaces user misconf/mixed
|
|
||||||
```
|
|
||||||
|
|
||||||
For more details, see [Custom Policies](../custom/index.md).
|
|
||||||
|
|
||||||
!!! tip
|
|
||||||
You also need to specify `--namespaces` option.
|
|
||||||
|
|
||||||
## Pass custom data
|
|
||||||
You can pass directories including your custom data through `--data` option.
|
|
||||||
This can be repeated for specifying multiple directories.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd examples/misconf/custom-data
|
|
||||||
trivy conf --policy ./policy --data ./data --namespaces user ./configs
|
|
||||||
```
|
|
||||||
|
|
||||||
For more details, see [Custom Data](../custom/data.md).
|
|
||||||
|
|
||||||
## Pass namespaces
|
|
||||||
By default, Trivy evaluates policies defined in `builtin.*`.
|
|
||||||
If you want to evaluate custom policies in other packages, you have to specify package prefixes through `--namespaces` option.
|
|
||||||
This can be repeated for specifying multiple packages.
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
trivy conf --policy ./policy --namespaces main --namespaces user ./configs
|
|
||||||
```
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# Report Formats
|
|
||||||
|
|
||||||
See [Reports Formats](../../vulnerability/examples/report.md) in Vulnerability section.
|
|
||||||
|
|
||||||
!!! caution
|
|
||||||
Misconfiguration scanning doesn't support default templates such as XML for now.
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
# Value Overrides
|
|
||||||
|
|
||||||
Value files can be passed for supported scannable config files.
|
|
||||||
|
|
||||||
## Terraform value overrides
|
|
||||||
You can pass `tf-vars` files to Trivy to override default values found in the Terraform HCL code.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
trivy conf --tf-vars dev.terraform.tfvars ./infrastructure/tf
|
|
||||||
```
|
|
||||||
|
|
||||||
## Helm value overrides
|
|
||||||
There are a number of options for overriding values in Helm charts. When override values are passed to the Helm scanner, the values will be used during the Manifest rendering process and will become part of the scanned artifact.
|
|
||||||
|
|
||||||
### Setting inline value overrides
|
|
||||||
Overrides can be set inline on the command line
|
|
||||||
|
|
||||||
```bash
|
|
||||||
trivy conf --helm-set securityContext.runAsUser=0 ./charts/mySql
|
|
||||||
```
|
|
||||||
|
|
||||||
### Setting value file overrides
|
|
||||||
Overrides can be in a file that has the key=value set.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Example override file (overrides.yaml)
|
|
||||||
|
|
||||||
securityContext:
|
|
||||||
runAsUser: 0
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
trivy conf --helm-values overrides.yaml ./charts/mySql
|
|
||||||
```
|
|
||||||
|
|
||||||
### Setting value as explicit string
|
|
||||||
the `--helm-set-string` is the same as `--helm-set` but explicitly retains the value as a string
|
|
||||||
|
|
||||||
```bash
|
|
||||||
trivy config --helm-set-string name=false ./infrastructure/tf
|
|
||||||
```
|
|
||||||
|
|
||||||
### Setting specific values from files
|
|
||||||
Specific override values can come from specific files
|
|
||||||
|
|
||||||
```bash
|
|
||||||
trivy conf --helm-set-file environment=dev.values.yaml ./charts/mySql
|
|
||||||
```
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
# Client
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Usage:
|
|
||||||
trivy client [flags] IMAGE_NAME
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
client, c
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--offline-scan do not issue API requests to identify dependencies
|
|
||||||
--scanners string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
--exit-on-eol int exit with the specified code when the os of image ends of service/life
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
|
||||||
-o, --output string output file name
|
|
||||||
--report string specify a report format for the output. (all,summary) (default "all")
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--download-java-db-only download/update java indexes database but don't run a scan
|
|
||||||
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
--skip-java-db-update skip updating java indexes database
|
|
||||||
|
|
||||||
Vulnerability Flags
|
|
||||||
--ignore-unfixed display only fixed vulnerabilities
|
|
||||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
|
||||||
|
|
||||||
Misconfiguration Flags
|
|
||||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
|
||||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
|
||||||
--file-patterns strings specify config file patterns, available with '--scanners config'
|
|
||||||
--include-non-failures include successes and exceptions, available with '--scanners config'
|
|
||||||
--policy-namespaces strings Rego namespaces
|
|
||||||
--trace enable more verbose trace output for custom queries
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--custom-headers strings custom headers in client mode
|
|
||||||
--remote string server address (default "http://localhost:4954")
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Completion
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Generate the autocompletion script for trivy for the specified shell.
|
|
||||||
See each sub-command's help for details on how to use the generated script.
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy completion [command]
|
|
||||||
|
|
||||||
Available Commands:
|
|
||||||
bash Generate the autocompletion script for bash
|
|
||||||
fish Generate the autocompletion script for fish
|
|
||||||
powershell Generate the autocompletion script for powershell
|
|
||||||
zsh Generate the autocompletion script for zsh
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
-h, --help help for completion
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/didier/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Config
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
Scan config files for misconfigurations
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy config [flags] DIR
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
config, conf
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
-o, --output string output file name
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
Misconfiguration Flags
|
|
||||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
|
||||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
|
||||||
--file-patterns strings specify config file patterns, available with '--scanners config'
|
|
||||||
--include-non-failures include successes and exceptions, available with '--scanners config'
|
|
||||||
--policy-namespaces strings Rego namespaces
|
|
||||||
--trace enable more verbose trace output for custom queries
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
# Filesystem
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Scan local filesystem
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy filesystem [flags] PATH
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
filesystem, fs
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Scan a local project including language-specific files
|
|
||||||
$ trivy fs /path/to/your_project
|
|
||||||
|
|
||||||
# Scan a single file
|
|
||||||
$ trivy fs ./trivy-ci-test/Pipfile.lock
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--offline-scan do not issue API requests to identify dependencies
|
|
||||||
--scanners string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
|
||||||
-o, --output string output file name
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--download-java-db-only download/update java indexes database but don't run a scan
|
|
||||||
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
--skip-java-db-update skip updating java indexes database
|
|
||||||
|
|
||||||
Vulnerability Flags
|
|
||||||
--ignore-unfixed display only fixed vulnerabilities
|
|
||||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
|
||||||
|
|
||||||
Misconfiguration Flags
|
|
||||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
|
||||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
|
||||||
--file-patterns strings specify config file patterns, available with '--scanners config'
|
|
||||||
--include-non-failures include successes and exceptions, available with '--scanners config'
|
|
||||||
--policy-namespaces strings Rego namespaces
|
|
||||||
--trace enable more verbose trace output for custom queries
|
|
||||||
|
|
||||||
Secret Flags
|
|
||||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
|
||||||
|
|
||||||
License Flags
|
|
||||||
--ignored-licenses strings specify a list of license to ignore
|
|
||||||
--license-full eagerly look for licenses in source code headers and license files
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--custom-headers strings custom headers in client mode
|
|
||||||
--server string server address in client mode
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
# Image
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Scan a container image
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy image [flags] IMAGE_NAME
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
image, i
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Scan a container image
|
|
||||||
$ trivy image python:3.4-alpine
|
|
||||||
|
|
||||||
# Scan a container image from a tar archive
|
|
||||||
$ trivy image --input ruby-3.1.tar
|
|
||||||
|
|
||||||
# Filter by severities
|
|
||||||
$ trivy image --severity HIGH,CRITICAL alpine:3.15
|
|
||||||
|
|
||||||
# Ignore unfixed/unpatched vulnerabilities
|
|
||||||
$ trivy image --ignore-unfixed alpine:3.15
|
|
||||||
|
|
||||||
# Scan a container image in client mode
|
|
||||||
$ trivy image --server http://127.0.0.1:4954 alpine:latest
|
|
||||||
|
|
||||||
# Generate json result
|
|
||||||
$ trivy image --format json --output result.json alpine:3.15
|
|
||||||
|
|
||||||
# Generate a report in the CycloneDX format
|
|
||||||
$ trivy image --format cyclonedx --output result.cdx alpine:3.15
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--offline-scan do not issue API requests to identify dependencies
|
|
||||||
--scanners string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
--exit-on-eol int exit with the specified code when the os of image ends of service/life
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
|
||||||
-o, --output string output file name
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--download-java-db-only download/update java indexes database but don't run a scan
|
|
||||||
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
--skip-java-db-update skip updating java indexes database
|
|
||||||
|
|
||||||
Image Flags
|
|
||||||
--input string input file path instead of image name
|
|
||||||
--removed-pkgs detect vulnerabilities of removed packages (only for Alpine)
|
|
||||||
|
|
||||||
Vulnerability Flags
|
|
||||||
--ignore-unfixed display only fixed vulnerabilities
|
|
||||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
|
||||||
|
|
||||||
Misconfiguration Flags
|
|
||||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
|
||||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
|
||||||
--file-patterns strings specify config file patterns, available with '--scanners config'
|
|
||||||
--include-non-failures include successes and exceptions, available with '--scanners config'
|
|
||||||
--policy-namespaces strings Rego namespaces
|
|
||||||
--trace enable more verbose trace output for custom queries
|
|
||||||
|
|
||||||
Secret Flags
|
|
||||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
|
||||||
|
|
||||||
License Flags
|
|
||||||
--ignored-licenses strings specify a list of license to ignore
|
|
||||||
--license-full eagerly look for licenses in source code headers and license files
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--custom-headers strings custom headers in client mode
|
|
||||||
--server string server address in client mode
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
Trivy has several sub commands, image, fs, repo, client and server.
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
Scanner for vulnerabilities in container images, file systems, and Git repositories, as well as for configuration issues and hard-coded secrets
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy [global flags] command [flags] target
|
|
||||||
trivy [command]
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Scan a container image
|
|
||||||
$ trivy image python:3.4-alpine
|
|
||||||
|
|
||||||
# Scan a container image from a tar archive
|
|
||||||
$ trivy image --input ruby-3.1.tar
|
|
||||||
|
|
||||||
# Scan local filesystem
|
|
||||||
$ trivy fs .
|
|
||||||
|
|
||||||
# Run in server mode
|
|
||||||
$ trivy server
|
|
||||||
|
|
||||||
Available Commands:
|
|
||||||
completion Generate the autocompletion script for the specified shell
|
|
||||||
config Scan config files for misconfigurations
|
|
||||||
filesystem Scan local filesystem
|
|
||||||
help Help about any command
|
|
||||||
image Scan a container image
|
|
||||||
kubernetes scan kubernetes cluster
|
|
||||||
module Manage modules
|
|
||||||
plugin Manage plugins
|
|
||||||
repository Scan a remote repository
|
|
||||||
rootfs Scan rootfs
|
|
||||||
sbom Scan SBOM for vulnerabilities
|
|
||||||
server Server mode
|
|
||||||
version Print the version
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
-f, --format string version format (json)
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
-h, --help help for trivy
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
|
|
||||||
Use "trivy [command] --help" for more information about a command.
|
|
||||||
```
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
# Plugin
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Manage plugins
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy plugin [command]
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
plugin, p
|
|
||||||
|
|
||||||
Available Commands:
|
|
||||||
info Show information about the specified plugin
|
|
||||||
install Install a plugin
|
|
||||||
list List installed plugin
|
|
||||||
run Run a plugin on the fly
|
|
||||||
uninstall Uninstall a plugin
|
|
||||||
update Update an existing plugin
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
-h, --help help for plugin
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
|
|
||||||
Use "trivy plugin [command] --help" for more information about a command.
|
|
||||||
```
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
# Repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Scan a remote repository
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy repository [flags] REPO_URL
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
repository, repo
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Scan your remote git repository
|
|
||||||
$ trivy repo https://github.com/knqyf263/trivy-ci-test
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--offline-scan do not issue API requests to identify dependencies
|
|
||||||
--scanners string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
|
||||||
-o, --output string output file name
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--download-java-db-only download/update java indexes database but don't run a scan
|
|
||||||
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
--skip-java-db-update skip updating java indexes database
|
|
||||||
|
|
||||||
Vulnerability Flags
|
|
||||||
--ignore-unfixed display only fixed vulnerabilities
|
|
||||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
|
||||||
|
|
||||||
Misconfiguration Flags
|
|
||||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
|
||||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
|
||||||
--file-patterns strings specify config file patterns, available with '--scanners config'
|
|
||||||
--include-non-failures include successes and exceptions, available with '--scanners config'
|
|
||||||
--policy-namespaces strings Rego namespaces
|
|
||||||
--trace enable more verbose trace output for custom queries
|
|
||||||
|
|
||||||
Secret Flags
|
|
||||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
|
||||||
|
|
||||||
License Flags
|
|
||||||
--ignored-licenses strings specify a list of license to ignore
|
|
||||||
--license-full eagerly look for licenses in source code headers and license files
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--custom-headers strings custom headers in client mode
|
|
||||||
--server string server address in client mode
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Repository Flags
|
|
||||||
--branch string pass the branch name to be scanned
|
|
||||||
--commit string pass the commit hash to be scanned
|
|
||||||
--tag string pass the tag name to be scanned
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
# Rootfs
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Scan rootfs
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy rootfs [flags] ROOTDIR
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Scan unpacked filesystem
|
|
||||||
$ docker export $(docker create alpine:3.10.2) | tar -C /tmp/rootfs -xvf -
|
|
||||||
$ trivy rootfs /tmp/rootfs
|
|
||||||
|
|
||||||
# Scan from inside a container
|
|
||||||
$ docker run --rm -it alpine:3.11
|
|
||||||
/ # curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
|
||||||
/ # trivy rootfs /
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--file-patterns strings specify config file patterns
|
|
||||||
--offline-scan do not issue API requests to identify dependencies
|
|
||||||
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
|
||||||
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (rekor)
|
|
||||||
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
|
||||||
-o, --output string output file name
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--download-java-db-only download/update java indexes database but don't run a scan
|
|
||||||
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
--skip-java-db-update skip updating java indexes database
|
|
||||||
|
|
||||||
Vulnerability Flags
|
|
||||||
--ignore-unfixed display only fixed vulnerabilities
|
|
||||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
|
||||||
|
|
||||||
Misconfiguration Flags
|
|
||||||
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
|
||||||
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
|
||||||
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
|
||||||
--helm-values strings specify paths to override the Helm values.yaml files
|
|
||||||
--include-non-failures include successes and exceptions, available with '--scanners config'
|
|
||||||
--tf-vars strings specify paths to override the Terraform tfvars files
|
|
||||||
|
|
||||||
Secret Flags
|
|
||||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
|
||||||
|
|
||||||
License Flags
|
|
||||||
--ignored-licenses strings specify a list of license to ignore
|
|
||||||
--license-full eagerly look for licenses in source code headers and license files
|
|
||||||
|
|
||||||
Rego Flags
|
|
||||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
|
||||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
|
||||||
--policy-namespaces strings Rego namespaces
|
|
||||||
--trace enable more verbose trace output for custom queries
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--custom-headers strings custom headers in client mode
|
|
||||||
--server string server address in client mode
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
# SBOM
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Scan SBOM for vulnerabilities
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy sbom [flags] SBOM_PATH
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Scan CycloneDX and show the result in tables
|
|
||||||
$ trivy sbom /path/to/report.cdx
|
|
||||||
|
|
||||||
# Scan CycloneDX and generate a CycloneDX report
|
|
||||||
$ trivy sbom --format cyclonedx /path/to/report.cdx
|
|
||||||
|
|
||||||
# Scan CycloneDX-type attestation and show the result in tables
|
|
||||||
$ trivy sbom /path/to/report.cdx.intoto.jsonl
|
|
||||||
|
|
||||||
|
|
||||||
Scan Flags
|
|
||||||
--offline-scan do not issue API requests to identify dependencies
|
|
||||||
--scanners string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
|
||||||
--skip-dirs strings specify the directories where the traversal is skipped
|
|
||||||
--skip-files strings specify the file paths to skip traversal
|
|
||||||
|
|
||||||
Report Flags
|
|
||||||
--exit-code int specify exit code when any security issues are found
|
|
||||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
|
||||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
|
||||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
|
||||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
|
||||||
-o, --output string output file name
|
|
||||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
|
||||||
-t, --template string output template
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--download-java-db-only download/update java indexes database but don't run a scan
|
|
||||||
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
--skip-java-db-update skip updating java indexes database
|
|
||||||
|
|
||||||
Vulnerability Flags
|
|
||||||
--ignore-unfixed display only fixed vulnerabilities
|
|
||||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--custom-headers strings custom headers in client mode
|
|
||||||
--server string server address in client mode
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Server
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Server mode
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
trivy server [flags]
|
|
||||||
|
|
||||||
Aliases:
|
|
||||||
server, s
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
# Run a server
|
|
||||||
$ trivy server
|
|
||||||
|
|
||||||
# Listen on 0.0.0.0:10000
|
|
||||||
$ trivy server --listen 0.0.0.0:10000
|
|
||||||
|
|
||||||
|
|
||||||
Cache Flags
|
|
||||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
|
||||||
--cache-ttl duration cache TTL when using redis as cache backend
|
|
||||||
--clear-cache clear image caches without scanning
|
|
||||||
--redis-ca string redis ca file location, if using redis as cache backend
|
|
||||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
|
||||||
--redis-key string redis key file location, if using redis as cache backend
|
|
||||||
|
|
||||||
DB Flags
|
|
||||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
|
||||||
--download-db-only download/update vulnerability database but don't run a scan
|
|
||||||
--no-progress suppress progress bar
|
|
||||||
--reset remove all caches and database
|
|
||||||
--skip-db-update skip updating vulnerability database
|
|
||||||
|
|
||||||
Client/Server Flags
|
|
||||||
--listen string listen address in server mode (default "localhost:4954")
|
|
||||||
--token string for authentication in client/server mode
|
|
||||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
|
||||||
|
|
||||||
Global Flags:
|
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
|
||||||
-c, --config string config path (default "trivy.yaml")
|
|
||||||
-d, --debug debug mode
|
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
|
||||||
--insecure allow insecure server connections when using TLS
|
|
||||||
-q, --quiet suppress progress bar and log output
|
|
||||||
--timeout duration timeout (default 5m0s)
|
|
||||||
-v, --version show version
|
|
||||||
```
|
|
||||||
59
docs/docs/references/configuration/cli/trivy.md
Normal file
59
docs/docs/references/configuration/cli/trivy.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
## trivy
|
||||||
|
|
||||||
|
Unified security scanner
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
Scanner for vulnerabilities in container images, file systems, and Git repositories, as well as for configuration issues and hard-coded secrets
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy [global flags] command [flags] target
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan a container image
|
||||||
|
$ trivy image python:3.4-alpine
|
||||||
|
|
||||||
|
# Scan a container image from a tar archive
|
||||||
|
$ trivy image --input ruby-3.1.tar
|
||||||
|
|
||||||
|
# Scan local filesystem
|
||||||
|
$ trivy fs .
|
||||||
|
|
||||||
|
# Run in server mode
|
||||||
|
$ trivy server
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
-f, --format string version format (json)
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
-h, --help help for trivy
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy aws](trivy_aws.md) - [EXPERIMENTAL] Scan AWS account
|
||||||
|
* [trivy config](trivy_config.md) - Scan config files for misconfigurations
|
||||||
|
* [trivy filesystem](trivy_filesystem.md) - Scan local filesystem
|
||||||
|
* [trivy image](trivy_image.md) - Scan a container image
|
||||||
|
* [trivy kubernetes](trivy_kubernetes.md) - [EXPERIMENTAL] Scan kubernetes cluster
|
||||||
|
* [trivy module](trivy_module.md) - Manage modules
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
* [trivy repository](trivy_repository.md) - Scan a remote repository
|
||||||
|
* [trivy rootfs](trivy_rootfs.md) - Scan rootfs
|
||||||
|
* [trivy sbom](trivy_sbom.md) - Scan SBOM for vulnerabilities
|
||||||
|
* [trivy server](trivy_server.md) - Server mode
|
||||||
|
* [trivy version](trivy_version.md) - Print the version
|
||||||
|
* [trivy vm](trivy_vm.md) - [EXPERIMENTAL] Scan a virtual machine image
|
||||||
|
|
||||||
116
docs/docs/references/configuration/cli/trivy_aws.md
Normal file
116
docs/docs/references/configuration/cli/trivy_aws.md
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
## trivy aws
|
||||||
|
|
||||||
|
[EXPERIMENTAL] Scan AWS account
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
Scan an AWS account for misconfigurations. Trivy uses the same authentication methods as the AWS CLI. See https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
|
||||||
|
|
||||||
|
The following services are supported:
|
||||||
|
- accessanalyzer
|
||||||
|
- api-gateway
|
||||||
|
- athena
|
||||||
|
- cloudfront
|
||||||
|
- cloudtrail
|
||||||
|
- cloudwatch
|
||||||
|
- codebuild
|
||||||
|
- documentdb
|
||||||
|
- dynamodb
|
||||||
|
- ec2
|
||||||
|
- ecr
|
||||||
|
- ecs
|
||||||
|
- efs
|
||||||
|
- eks
|
||||||
|
- elasticache
|
||||||
|
- elasticsearch
|
||||||
|
- elb
|
||||||
|
- emr
|
||||||
|
- iam
|
||||||
|
- kinesis
|
||||||
|
- kms
|
||||||
|
- lambda
|
||||||
|
- mq
|
||||||
|
- msk
|
||||||
|
- neptune
|
||||||
|
- rds
|
||||||
|
- redshift
|
||||||
|
- s3
|
||||||
|
- sns
|
||||||
|
- sqs
|
||||||
|
- ssm
|
||||||
|
- workspaces
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy aws [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# basic scanning
|
||||||
|
$ trivy aws --region us-east-1
|
||||||
|
|
||||||
|
# limit scan to a single service:
|
||||||
|
$ trivy aws --region us-east-1 --service s3
|
||||||
|
|
||||||
|
# limit scan to multiple services:
|
||||||
|
$ trivy aws --region us-east-1 --service s3 --service ec2
|
||||||
|
|
||||||
|
# force refresh of cache for fresh results
|
||||||
|
$ trivy aws --region us-east-1 --update-cache
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--account string The AWS account to scan. It's useful to specify this when reviewing cached results for multiple accounts.
|
||||||
|
--arn string The AWS ARN to show results for. Useful to filter results once a scan is cached.
|
||||||
|
--compliance string compliance report to generate (aws-cis-1.2, aws-cis-1.4)
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--endpoint string AWS Endpoint override
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for aws
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--max-cache-age duration The maximum age of the cloud cache. Cached data will be requeried from the cloud provider if it is older than this. (default 24h0m0s)
|
||||||
|
-o, --output string output file name
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--region string AWS Region to scan
|
||||||
|
--report string specify a report format for the output. (all,summary) (default "all")
|
||||||
|
--service strings Only scan AWS Service(s) specified with this flag. Can specify multiple services using --service A --service B etc.
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--update-cache Update the cache for the applicable cloud provider instead of using cached results.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
66
docs/docs/references/configuration/cli/trivy_config.md
Normal file
66
docs/docs/references/configuration/cli/trivy_config.md
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
## trivy config
|
||||||
|
|
||||||
|
Scan config files for misconfigurations
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy config [flags] DIR
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--compliance string compliance report to generate
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for config
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--k8s-version string specify k8s version to validate outdated api by it (example: 1.21.0)
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
-o, --output string output file name
|
||||||
|
--password strings password. Comma-separated passwords allowed. TRIVY_PASSWORD should be used for security reasons.
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--registry-token string registry token
|
||||||
|
--report string specify a compliance report format for the output. (all,summary) (default "all")
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--username strings username. Comma-separated usernames allowed.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
101
docs/docs/references/configuration/cli/trivy_filesystem.md
Normal file
101
docs/docs/references/configuration/cli/trivy_filesystem.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
## trivy filesystem
|
||||||
|
|
||||||
|
Scan local filesystem
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy filesystem [flags] PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan a local project including language-specific files
|
||||||
|
$ trivy fs /path/to/your_project
|
||||||
|
|
||||||
|
# Scan a single file
|
||||||
|
$ trivy fs ./trivy-ci-test/Pipfile.lock
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--compliance string compliance report to generate
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--custom-headers strings custom headers in client mode
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for filesystem
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignored-licenses strings specify a list of license to ignore
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--license-confidence-level float specify license classifier's confidence level (default 0.9)
|
||||||
|
--license-full eagerly look for licenses in source code headers and license files
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--password strings password. Comma-separated passwords allowed. TRIVY_PASSWORD should be used for security reasons.
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--registry-token string registry token
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--report string specify a compliance report format for the output. (all,summary) (default "all")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
||||||
|
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||||
|
--server string server address in client mode
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--username strings username. Comma-separated usernames allowed.
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
122
docs/docs/references/configuration/cli/trivy_image.md
Normal file
122
docs/docs/references/configuration/cli/trivy_image.md
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
## trivy image
|
||||||
|
|
||||||
|
Scan a container image
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy image [flags] IMAGE_NAME
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan a container image
|
||||||
|
$ trivy image python:3.4-alpine
|
||||||
|
|
||||||
|
# Scan a container image from a tar archive
|
||||||
|
$ trivy image --input ruby-3.1.tar
|
||||||
|
|
||||||
|
# Filter by severities
|
||||||
|
$ trivy image --severity HIGH,CRITICAL alpine:3.15
|
||||||
|
|
||||||
|
# Ignore unfixed/unpatched vulnerabilities
|
||||||
|
$ trivy image --ignore-unfixed alpine:3.15
|
||||||
|
|
||||||
|
# Scan a container image in client mode
|
||||||
|
$ trivy image --server http://127.0.0.1:4954 alpine:latest
|
||||||
|
|
||||||
|
# Generate json result
|
||||||
|
$ trivy image --format json --output result.json alpine:3.15
|
||||||
|
|
||||||
|
# Generate a report in the CycloneDX format
|
||||||
|
$ trivy image --format cyclonedx --output result.cdx alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--compliance string compliance report to generate (docker-cis)
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--custom-headers strings custom headers in client mode
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--docker-host string unix domain socket path to use for docker scanning
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--exit-on-eol int exit with the specified code when the OS reaches end of service/life
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for image
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignored-licenses strings specify a list of license to ignore
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--image-config-scanners string comma-separated list of what security issues to detect on container image configurations (config,secret)
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--input string input file path instead of image name
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--license-confidence-level float specify license classifier's confidence level (default 0.9)
|
||||||
|
--license-full eagerly look for licenses in source code headers and license files
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--password strings password. Comma-separated passwords allowed. TRIVY_PASSWORD should be used for security reasons.
|
||||||
|
--platform string set platform in the form os/arch if image is multi-platform capable
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--registry-token string registry token
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--removed-pkgs detect vulnerabilities of removed packages (only for Alpine)
|
||||||
|
--report string specify a format for the compliance report. (default "summary")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
||||||
|
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||||
|
--server string server address in client mode
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--username strings username. Comma-separated usernames allowed.
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
105
docs/docs/references/configuration/cli/trivy_kubernetes.md
Normal file
105
docs/docs/references/configuration/cli/trivy_kubernetes.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
## trivy kubernetes
|
||||||
|
|
||||||
|
[EXPERIMENTAL] Scan kubernetes cluster
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy kubernetes [flags] { cluster | all | specific resources like kubectl. eg: pods, pod/NAME }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# cluster scanning
|
||||||
|
$ trivy k8s --report summary cluster
|
||||||
|
|
||||||
|
# namespace scanning:
|
||||||
|
$ trivy k8s -n kube-system --report summary all
|
||||||
|
|
||||||
|
# resources scanning:
|
||||||
|
$ trivy k8s --report=summary deploy
|
||||||
|
$ trivy k8s --namespace=kube-system --report=summary deploy,configmaps
|
||||||
|
|
||||||
|
# resource scanning:
|
||||||
|
$ trivy k8s deployment/orion
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-A, --all-namespaces fetch resources from all cluster namespaces
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--compliance string compliance report to generate (k8s-nsa,k8s-cis, k8s-pss-baseline, k8s-pss-restricted)
|
||||||
|
--components strings specify which components to scan (default [workload,infra])
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--context string specify a context to scan
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for kubernetes
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--k8s-version string specify k8s version to validate outdated api by it (example: 1.21.0)
|
||||||
|
--kubeconfig string specify the kubeconfig file path to use
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
-n, --namespace string specify a namespace to scan
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--parallel int number (between 1-20) of goroutines enabled for parallel scanning (default 5)
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--report string specify a report format for the output. (all,summary) (default "all")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners string comma-separated list of what security issues to detect (vuln,config,secret,license) (default "vuln,config,secret,rbac")
|
||||||
|
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--tolerations strings specify node-collector job tolerations (example: key1=value1:NoExecute,key2=value2:NoSchedule)
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
31
docs/docs/references/configuration/cli/trivy_module.md
Normal file
31
docs/docs/references/configuration/cli/trivy_module.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## trivy module
|
||||||
|
|
||||||
|
Manage modules
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
-h, --help help for module
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
* [trivy module install](trivy_module_install.md) - Install a module
|
||||||
|
* [trivy module uninstall](trivy_module_uninstall.md) - Uninstall a module
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
## trivy module install
|
||||||
|
|
||||||
|
Install a module
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy module install [flags] REPOSITORY
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy module](trivy_module.md) - Manage modules
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
## trivy module uninstall
|
||||||
|
|
||||||
|
Uninstall a module
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy module uninstall [flags] REPOSITORY
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy module](trivy_module.md) - Manage modules
|
||||||
|
|
||||||
33
docs/docs/references/configuration/cli/trivy_plugin.md
Normal file
33
docs/docs/references/configuration/cli/trivy_plugin.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
## trivy plugin
|
||||||
|
|
||||||
|
Manage plugins
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
* [trivy plugin info](trivy_plugin_info.md) - Show information about the specified plugin
|
||||||
|
* [trivy plugin install](trivy_plugin_install.md) - Install a plugin
|
||||||
|
* [trivy plugin list](trivy_plugin_list.md) - List installed plugin
|
||||||
|
* [trivy plugin run](trivy_plugin_run.md) - Run a plugin on the fly
|
||||||
|
* [trivy plugin uninstall](trivy_plugin_uninstall.md) - Uninstall a plugin
|
||||||
|
* [trivy plugin update](trivy_plugin_update.md) - Update an existing plugin
|
||||||
|
|
||||||
@@ -1,30 +1,31 @@
|
|||||||
# Module
|
## trivy plugin info
|
||||||
|
|
||||||
```bash
|
Show information about the specified plugin
|
||||||
Manage modules
|
|
||||||
|
|
||||||
Usage:
|
```
|
||||||
trivy module [command]
|
trivy plugin info PLUGIN_NAME
|
||||||
|
```
|
||||||
|
|
||||||
Aliases:
|
### Options
|
||||||
module, m
|
|
||||||
|
|
||||||
Available Commands:
|
```
|
||||||
install Install a module
|
-h, --help help for info
|
||||||
uninstall Uninstall a module
|
```
|
||||||
|
|
||||||
Flags:
|
### Options inherited from parent commands
|
||||||
-h, --help help for module
|
|
||||||
|
|
||||||
Global Flags:
|
```
|
||||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
-c, --config string config path (default "trivy.yaml")
|
-c, --config string config path (default "trivy.yaml")
|
||||||
-d, --debug debug mode
|
-d, --debug debug mode
|
||||||
--generate-default-config write the default config to trivy-default.yaml
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
--insecure allow insecure server connections when using TLS
|
--insecure allow insecure server connections
|
||||||
-q, --quiet suppress progress bar and log output
|
-q, --quiet suppress progress bar and log output
|
||||||
--timeout duration timeout (default 5m0s)
|
--timeout duration timeout (default 5m0s)
|
||||||
-v, --version show version
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
|
||||||
Use "trivy module [command] --help" for more information about a command.
|
|
||||||
```
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
## trivy plugin install
|
||||||
|
|
||||||
|
Install a plugin
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy plugin install URL | FILE_PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
|
||||||
31
docs/docs/references/configuration/cli/trivy_plugin_list.md
Normal file
31
docs/docs/references/configuration/cli/trivy_plugin_list.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## trivy plugin list
|
||||||
|
|
||||||
|
List installed plugin
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy plugin list
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for list
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
|
||||||
31
docs/docs/references/configuration/cli/trivy_plugin_run.md
Normal file
31
docs/docs/references/configuration/cli/trivy_plugin_run.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## trivy plugin run
|
||||||
|
|
||||||
|
Run a plugin on the fly
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy plugin run URL | FILE_PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for run
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
## trivy plugin uninstall
|
||||||
|
|
||||||
|
Uninstall a plugin
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy plugin uninstall PLUGIN_NAME
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
## trivy plugin update
|
||||||
|
|
||||||
|
Update an existing plugin
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy plugin update PLUGIN_NAME
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help help for update
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy plugin](trivy_plugin.md) - Manage plugins
|
||||||
|
|
||||||
99
docs/docs/references/configuration/cli/trivy_repository.md
Normal file
99
docs/docs/references/configuration/cli/trivy_repository.md
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
## trivy repository
|
||||||
|
|
||||||
|
Scan a remote repository
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy repository [flags] REPO_URL
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan your remote git repository
|
||||||
|
$ trivy repo https://github.com/knqyf263/trivy-ci-test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--branch string pass the branch name to be scanned
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--commit string pass the commit hash to be scanned
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--custom-headers strings custom headers in client mode
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for repository
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignored-licenses strings specify a list of license to ignore
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--license-confidence-level float specify license classifier's confidence level (default 0.9)
|
||||||
|
--license-full eagerly look for licenses in source code headers and license files
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--password strings password. Comma-separated passwords allowed. TRIVY_PASSWORD should be used for security reasons.
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--registry-token string registry token
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
||||||
|
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||||
|
--server string server address in client mode
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
--tag string pass the tag name to be scanned
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--username strings username. Comma-separated usernames allowed.
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
103
docs/docs/references/configuration/cli/trivy_rootfs.md
Normal file
103
docs/docs/references/configuration/cli/trivy_rootfs.md
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
## trivy rootfs
|
||||||
|
|
||||||
|
Scan rootfs
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy rootfs [flags] ROOTDIR
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan unpacked filesystem
|
||||||
|
$ docker export $(docker create alpine:3.10.2) | tar -C /tmp/rootfs -xvf -
|
||||||
|
$ trivy rootfs /tmp/rootfs
|
||||||
|
|
||||||
|
# Scan from inside a container
|
||||||
|
$ docker run --rm -it alpine:3.11
|
||||||
|
/ # curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||||
|
/ # trivy rootfs /
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||||
|
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||||
|
--custom-headers strings custom headers in client mode
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--exit-on-eol int exit with the specified code when the OS reaches end of service/life
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for rootfs
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignored-licenses strings specify a list of license to ignore
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--license-confidence-level float specify license classifier's confidence level (default 0.9)
|
||||||
|
--license-full eagerly look for licenses in source code headers and license files
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--password strings password. Comma-separated passwords allowed. TRIVY_PASSWORD should be used for security reasons.
|
||||||
|
--policy-namespaces strings Rego namespaces
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--registry-token string registry token
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
||||||
|
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||||
|
--server string server address in client mode
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--skip-policy-update skip fetching rego policy updates
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--trace enable more verbose trace output for custom queries
|
||||||
|
--username strings username. Comma-separated usernames allowed.
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
85
docs/docs/references/configuration/cli/trivy_sbom.md
Normal file
85
docs/docs/references/configuration/cli/trivy_sbom.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
## trivy sbom
|
||||||
|
|
||||||
|
Scan SBOM for vulnerabilities
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy sbom [flags] SBOM_PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan CycloneDX and show the result in tables
|
||||||
|
$ trivy sbom /path/to/report.cdx
|
||||||
|
|
||||||
|
# Scan CycloneDX and generate a CycloneDX report
|
||||||
|
$ trivy sbom --format cyclonedx /path/to/report.cdx
|
||||||
|
|
||||||
|
# Scan CycloneDX-type attestation and show the result in tables
|
||||||
|
$ trivy sbom /path/to/report.cdx.intoto.jsonl
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--compliance string compliance report to generate
|
||||||
|
--custom-headers strings custom headers in client mode
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--exit-on-eol int exit with the specified code when the OS reaches end of service/life
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
-h, --help help for sbom
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
||||||
|
--server string server address in client mode
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
-t, --template string output template
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--vex string [EXPERIMENTAL] file path to VEX
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
65
docs/docs/references/configuration/cli/trivy_server.md
Normal file
65
docs/docs/references/configuration/cli/trivy_server.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
## trivy server
|
||||||
|
|
||||||
|
Server mode
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy server [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Run a server
|
||||||
|
$ trivy server
|
||||||
|
|
||||||
|
# Listen on 0.0.0.0:10000
|
||||||
|
$ trivy server --listen 0.0.0.0:10000
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
-h, --help help for server
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--listen string listen address in server mode (default "localhost:4954")
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--password strings password. Comma-separated passwords allowed. TRIVY_PASSWORD should be used for security reasons.
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--registry-token string registry token
|
||||||
|
--reset remove all caches and database
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--username strings username. Comma-separated usernames allowed.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
32
docs/docs/references/configuration/cli/trivy_version.md
Normal file
32
docs/docs/references/configuration/cli/trivy_version.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
## trivy version
|
||||||
|
|
||||||
|
Print the version
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy version [flags]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-f, --format string version format (json)
|
||||||
|
-h, --help help for version
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
92
docs/docs/references/configuration/cli/trivy_vm.md
Normal file
92
docs/docs/references/configuration/cli/trivy_vm.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
## trivy vm
|
||||||
|
|
||||||
|
[EXPERIMENTAL] Scan a virtual machine image
|
||||||
|
|
||||||
|
```
|
||||||
|
trivy vm [flags] VM_IMAGE
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
# Scan your AWS AMI
|
||||||
|
$ trivy vm --scanners vuln ami:${your_ami_id}
|
||||||
|
|
||||||
|
# Scan your AWS EBS snapshot
|
||||||
|
$ trivy vm ebs:${your_ebs_snapshot_id}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
```
|
||||||
|
--aws-region string AWS region to scan
|
||||||
|
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||||
|
--cache-ttl duration cache TTL when using redis as cache backend
|
||||||
|
--clear-cache clear image caches without scanning
|
||||||
|
--compliance string compliance report to generate
|
||||||
|
--custom-headers strings custom headers in client mode
|
||||||
|
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||||
|
--dependency-tree [EXPERIMENTAL] show dependency origin tree of vulnerable packages
|
||||||
|
--download-db-only download/update vulnerability database but don't run a scan
|
||||||
|
--download-java-db-only download/update Java index database but don't run a scan
|
||||||
|
--enable-modules strings [EXPERIMENTAL] module names to enable
|
||||||
|
--exit-code int specify exit code when any security issues are found
|
||||||
|
--exit-on-eol int exit with the specified code when the OS reaches end of service/life
|
||||||
|
--file-patterns strings specify config file patterns
|
||||||
|
-f, --format string format (table, json, template, sarif, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||||
|
--helm-set strings specify Helm values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-set-file strings specify Helm values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
|
||||||
|
--helm-set-string strings specify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
|
||||||
|
--helm-values strings specify paths to override the Helm values.yaml files
|
||||||
|
-h, --help help for vm
|
||||||
|
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||||
|
--ignore-unfixed display only fixed vulnerabilities
|
||||||
|
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||||
|
--include-non-failures include successes and exceptions, available with '--scanners config'
|
||||||
|
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
|
||||||
|
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||||
|
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
|
||||||
|
--no-progress suppress progress bar
|
||||||
|
--offline-scan do not issue API requests to identify dependencies
|
||||||
|
-o, --output string output file name
|
||||||
|
--redis-ca string redis ca file location, if using redis as cache backend
|
||||||
|
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||||
|
--redis-key string redis key file location, if using redis as cache backend
|
||||||
|
--redis-tls enable redis TLS with public certificates, if using redis as cache backend
|
||||||
|
--rekor-url string [EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
|
||||||
|
--reset remove all caches and database
|
||||||
|
--sbom-sources strings [EXPERIMENTAL] try to retrieve SBOM from the specified sources (oci,rekor)
|
||||||
|
--scanners strings comma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
|
||||||
|
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||||
|
--server string server address in client mode
|
||||||
|
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||||
|
--skip-db-update skip updating vulnerability database
|
||||||
|
--skip-dirs strings specify the directories where the traversal is skipped
|
||||||
|
--skip-files strings specify the file paths to skip traversal
|
||||||
|
--skip-java-db-update skip updating Java index database
|
||||||
|
--slow scan over time with lower CPU and memory utilization
|
||||||
|
-t, --template string output template
|
||||||
|
--tf-vars strings specify paths to override the Terraform tfvars files
|
||||||
|
--token string for authentication in client/server mode
|
||||||
|
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||||
|
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options inherited from parent commands
|
||||||
|
|
||||||
|
```
|
||||||
|
--cache-dir string cache directory (default "/path/to/cache")
|
||||||
|
-c, --config string config path (default "trivy.yaml")
|
||||||
|
-d, --debug debug mode
|
||||||
|
--generate-default-config write the default config to trivy-default.yaml
|
||||||
|
--insecure allow insecure server connections
|
||||||
|
-q, --quiet suppress progress bar and log output
|
||||||
|
--timeout duration timeout (default 5m0s)
|
||||||
|
-v, --version show version
|
||||||
|
```
|
||||||
|
|
||||||
|
### SEE ALSO
|
||||||
|
|
||||||
|
* [trivy](trivy.md) - Unified security scanner
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
# Config file
|
# Config file
|
||||||
|
|
||||||
Trivy can be customized by tweaking a `trivy.yaml` file. The config path can be overridden by the `--config` flag.
|
Trivy can be customized by tweaking a `trivy.yaml` file.
|
||||||
|
The config path can be overridden by the `--config` flag.
|
||||||
|
|
||||||
An example is [here][example].
|
An example is [here][example].
|
||||||
|
|
||||||
@@ -25,7 +26,8 @@ timeout: 10m
|
|||||||
|
|
||||||
# Same as '--cache-dir'
|
# Same as '--cache-dir'
|
||||||
# Default is your system cache dir
|
# Default is your system cache dir
|
||||||
cache-dir: $HOME/.cache/trivy
|
cache:
|
||||||
|
dir: $HOME/.cache/trivy
|
||||||
```
|
```
|
||||||
|
|
||||||
## Report Options
|
## Report Options
|
||||||
@@ -162,6 +164,23 @@ db:
|
|||||||
java-repository: ghcr.io/aquasecurity/trivy-java-db
|
java-repository: ghcr.io/aquasecurity/trivy-java-db
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Registry Options
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
registry:
|
||||||
|
# Same as '--username'
|
||||||
|
# Default is empty
|
||||||
|
username:
|
||||||
|
|
||||||
|
# Same as '--password'
|
||||||
|
# Default is empty
|
||||||
|
password:
|
||||||
|
|
||||||
|
# Same as '--registry-token'
|
||||||
|
# Default is empty
|
||||||
|
registry-token:
|
||||||
|
```
|
||||||
|
|
||||||
## Image Options
|
## Image Options
|
||||||
Available with container image scanning
|
Available with container image scanning
|
||||||
|
|
||||||
@@ -174,6 +193,15 @@ image:
|
|||||||
# Same as '--removed-pkgs'
|
# Same as '--removed-pkgs'
|
||||||
# Default is false
|
# Default is false
|
||||||
removed-pkgs: false
|
removed-pkgs: false
|
||||||
|
|
||||||
|
# Same as '--platform'
|
||||||
|
# Default is empty
|
||||||
|
platform:
|
||||||
|
|
||||||
|
docker:
|
||||||
|
# Same as '--docker-host'
|
||||||
|
# Default is empty
|
||||||
|
host:
|
||||||
```
|
```
|
||||||
|
|
||||||
## Vulnerability Options
|
## Vulnerability Options
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Environment variables
|
|
||||||
|
|
||||||
Trivy can be customized by environment variables.
|
|
||||||
The environment variable key is the flag name converted by the following procedure.
|
|
||||||
|
|
||||||
- Add `TRIVY_` prefix
|
|
||||||
- Make it all uppercase
|
|
||||||
- Replace `-` with `_`
|
|
||||||
|
|
||||||
For example,
|
|
||||||
|
|
||||||
- `--debug` => `TRIVY_DEBUG`
|
|
||||||
- `--cache-dir` => `TRIVY_CACHE_DIR`
|
|
||||||
|
|
||||||
```
|
|
||||||
$ TRIVY_DEBUG=true TRIVY_SEVERITY=CRITICAL trivy image alpine:3.15
|
|
||||||
```
|
|
||||||
@@ -1,249 +0,0 @@
|
|||||||
# CycloneDX generation
|
|
||||||
Trivy can generate SBOM in the [CycloneDX][cyclonedx] format.
|
|
||||||
Note that XML format is not supported at the moment.
|
|
||||||
|
|
||||||
You can use the regular subcommands (like `image`, `fs` and `rootfs`) and specify `cyclonedx` with the `--format` option.
|
|
||||||
|
|
||||||
CycloneDX can represent either or both SBOM or BOV.
|
|
||||||
|
|
||||||
- [Software Bill of Materials (SBOM)][sbom]
|
|
||||||
- [Bill of Vulnerabilities (BOV)][bov]
|
|
||||||
|
|
||||||
By default, `--format cyclonedx` represents SBOM and doesn't include vulnerabilities in the CycloneDX output.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy image --format cyclonedx --output result.json alpine:3.15
|
|
||||||
2022-07-19T07:47:27.624Z INFO "--format cyclonedx" disables security scanning. Specify "--scanners vuln" explicitly if you want to include vulnerabilities in the CycloneDX report.
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Result</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cat result.json | jq .
|
|
||||||
{
|
|
||||||
"bomFormat": "CycloneDX",
|
|
||||||
"specVersion": "1.4",
|
|
||||||
"serialNumber": "urn:uuid:2be5773d-7cd3-4b4b-90a5-e165474ddace",
|
|
||||||
"version": 1,
|
|
||||||
"metadata": {
|
|
||||||
"timestamp": "2022-02-22T15:11:40.270597Z",
|
|
||||||
"tools": [
|
|
||||||
{
|
|
||||||
"vendor": "aquasecurity",
|
|
||||||
"name": "trivy",
|
|
||||||
"version": "dev"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"component": {
|
|
||||||
"bom-ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
|
||||||
"type": "container",
|
|
||||||
"name": "alpine:3.15",
|
|
||||||
"version": "",
|
|
||||||
"purl": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SchemaVersion",
|
|
||||||
"value": "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:ImageID",
|
|
||||||
"value": "sha256:c059bfaa849c4d8e4aecaeb3a10c2d9b3d85f5165c66ad3a4d937758128c4d18"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:RepoDigest",
|
|
||||||
"value": "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:DiffID",
|
|
||||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:RepoTag",
|
|
||||||
"value": "alpine:3.15"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"bom-ref": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
|
||||||
"type": "library",
|
|
||||||
"name": "alpine-baselayout",
|
|
||||||
"version": "3.2.0-r18",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"expression": "GPL-2.0-only"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"purl": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcName",
|
|
||||||
"value": "alpine-baselayout"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcVersion",
|
|
||||||
"value": "3.2.0-r18"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDigest",
|
|
||||||
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDiffID",
|
|
||||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...(snip)...
|
|
||||||
{
|
|
||||||
"bom-ref": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
|
||||||
"type": "library",
|
|
||||||
"name": "zlib",
|
|
||||||
"version": "1.2.11-r3",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"expression": "Zlib"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"purl": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcName",
|
|
||||||
"value": "zlib"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcVersion",
|
|
||||||
"value": "1.2.11-r3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDigest",
|
|
||||||
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDiffID",
|
|
||||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"bom-ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
|
||||||
"type": "operating-system",
|
|
||||||
"name": "alpine",
|
|
||||||
"version": "3.15.0",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:Type",
|
|
||||||
"value": "alpine"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:Class",
|
|
||||||
"value": "os-pkgs"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
{
|
|
||||||
"ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
|
||||||
"dependsOn": [
|
|
||||||
"pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/alpine-keys@2.4-r1?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/apk-tools@2.12.7-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/busybox@1.34.1-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/ca-certificates-bundle@20191127-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libc-utils@0.7.2-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libcrypto1.1@1.1.1l-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libretls@3.3.4-r2?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libssl1.1@1.1.1l-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/musl@1.2.2-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/musl-utils@1.2.2-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/scanelf@1.3.3-r0?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/ssl_client@1.34.1-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
|
||||||
"dependsOn": [
|
|
||||||
"3da6a469-964d-4b4e-b67d-e94ec7c88d37"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vulnerabilities": [
|
|
||||||
{
|
|
||||||
"id": "CVE-2021-42386",
|
|
||||||
"source": {
|
|
||||||
"name": "alpine",
|
|
||||||
"url": "https://secdb.alpinelinux.org/"
|
|
||||||
},
|
|
||||||
"ratings": [
|
|
||||||
{
|
|
||||||
"source": {
|
|
||||||
"name": "nvd"
|
|
||||||
},
|
|
||||||
"score": 7.2,
|
|
||||||
"severity": "high",
|
|
||||||
"method": "CVSSv31",
|
|
||||||
"vector": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": {
|
|
||||||
"name": "nvd"
|
|
||||||
},
|
|
||||||
"score": 6.5,
|
|
||||||
"severity": "medium",
|
|
||||||
"method": "CVSSv2",
|
|
||||||
"vector": "AV:N/AC:L/Au:S/C:P/I:P/A:P"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": {
|
|
||||||
"name": "redhat"
|
|
||||||
},
|
|
||||||
"score": 6.6,
|
|
||||||
"severity": "medium",
|
|
||||||
"method": "CVSSv31",
|
|
||||||
"vector": "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"cwes": [
|
|
||||||
416
|
|
||||||
],
|
|
||||||
"description": "A use-after-free in Busybox's awk applet leads to denial of service and possibly code execution when processing a crafted awk pattern in the nvalloc function",
|
|
||||||
"advisories": [
|
|
||||||
{
|
|
||||||
"url": "https://access.redhat.com/security/cve/CVE-2021-42386"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42386"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"published": "2021-11-15 21:15:00 +0000 UTC",
|
|
||||||
"updated": "2022-01-04 17:14:00 +0000 UTC",
|
|
||||||
"affects": [
|
|
||||||
{
|
|
||||||
"ref": "pkg:apk/alpine/busybox@1.33.1-r3?distro=3.14.2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ref": "pkg:apk/alpine/ssl_client@1.33.1-r3?distro=3.14.2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
If you want to include vulnerabilities, you can enable vulnerability scanning via `--scanners vuln`.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy image --scanners vuln --format cyclonedx --output result.json alpine:3.15
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
[cyclonedx]: https://cyclonedx.org/
|
|
||||||
[sbom]: https://cyclonedx.org/capabilities/sbom/
|
|
||||||
[bov]: https://cyclonedx.org/capabilities/bov/
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
# SBOM generation
|
|
||||||
|
|
||||||
Trivy can generate the following SBOM formats.
|
|
||||||
|
|
||||||
- [CycloneDX][cyclonedx]
|
|
||||||
- [SPDX][spdx]
|
|
||||||
|
|
||||||
## CLI commands
|
|
||||||
To generate SBOM, you can use the `--format` option for each subcommand such as `image`, `fs` and `vm`.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy image --format spdx-json --output result.json alpine:3.15
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy fs --format cyclonedx --output result.json /app/myproject
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Result</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
|
||||||
"bomFormat": "CycloneDX",
|
|
||||||
"specVersion": "1.3",
|
|
||||||
"serialNumber": "urn:uuid:2be5773d-7cd3-4b4b-90a5-e165474ddace",
|
|
||||||
"version": 1,
|
|
||||||
"metadata": {
|
|
||||||
"timestamp": "2022-02-22T15:11:40.270597Z",
|
|
||||||
"tools": [
|
|
||||||
{
|
|
||||||
"vendor": "aquasecurity",
|
|
||||||
"name": "trivy",
|
|
||||||
"version": "dev"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"component": {
|
|
||||||
"bom-ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
|
||||||
"type": "container",
|
|
||||||
"name": "alpine:3.15",
|
|
||||||
"version": "",
|
|
||||||
"purl": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SchemaVersion",
|
|
||||||
"value": "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:ImageID",
|
|
||||||
"value": "sha256:c059bfaa849c4d8e4aecaeb3a10c2d9b3d85f5165c66ad3a4d937758128c4d18"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:RepoDigest",
|
|
||||||
"value": "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:DiffID",
|
|
||||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:RepoTag",
|
|
||||||
"value": "alpine:3.15"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"bom-ref": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
|
||||||
"type": "library",
|
|
||||||
"name": "alpine-baselayout",
|
|
||||||
"version": "3.2.0-r18",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"expression": "GPL-2.0-only"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"purl": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcName",
|
|
||||||
"value": "alpine-baselayout"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcVersion",
|
|
||||||
"value": "3.2.0-r18"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDigest",
|
|
||||||
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDiffID",
|
|
||||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...(snip)...
|
|
||||||
{
|
|
||||||
"bom-ref": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
|
||||||
"type": "library",
|
|
||||||
"name": "zlib",
|
|
||||||
"version": "1.2.11-r3",
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"expression": "Zlib"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"purl": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcName",
|
|
||||||
"value": "zlib"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:SrcVersion",
|
|
||||||
"value": "1.2.11-r3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDigest",
|
|
||||||
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:LayerDiffID",
|
|
||||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"bom-ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
|
||||||
"type": "operating-system",
|
|
||||||
"name": "alpine",
|
|
||||||
"version": "3.15.0",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:Type",
|
|
||||||
"value": "alpine"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "aquasecurity:trivy:Class",
|
|
||||||
"value": "os-pkgs"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
{
|
|
||||||
"ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
|
||||||
"dependsOn": [
|
|
||||||
"pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/alpine-keys@2.4-r1?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/apk-tools@2.12.7-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/busybox@1.34.1-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/ca-certificates-bundle@20191127-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libc-utils@0.7.2-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libcrypto1.1@1.1.1l-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libretls@3.3.4-r2?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/libssl1.1@1.1.1l-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/musl@1.2.2-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/musl-utils@1.2.2-r7?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/scanelf@1.3.3-r0?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/ssl_client@1.34.1-r3?distro=3.15.0",
|
|
||||||
"pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
|
||||||
"dependsOn": [
|
|
||||||
"3da6a469-964d-4b4e-b67d-e94ec7c88d37"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Supported packages
|
|
||||||
Trivy supports the following packages.
|
|
||||||
|
|
||||||
- [OS packages][os_packages]
|
|
||||||
- [Language-specific packages][language_packages]
|
|
||||||
|
|
||||||
In addition to the above packages, Trivy also supports the following packages for generating SBOM.
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
These packages are not supported for vulnerability scanning.
|
|
||||||
|
|
||||||
| Language | File | Dependency location[^1] |
|
|
||||||
|----------|-------------------|:-----------------------:|
|
|
||||||
| Python | conda package[^2] | - |
|
|
||||||
| Swift | Podfile.lock | - |
|
|
||||||
|
|
||||||
[^1]: Use `startline == 1 and endline == 1` for unsupported file types
|
|
||||||
[^2]: `envs/*/conda-meta/*.json`
|
|
||||||
|
|
||||||
[cyclonedx]: cyclonedx.md
|
|
||||||
[spdx]: spdx.md
|
|
||||||
|
|
||||||
[os_packages]: ../vulnerability/detection/os.md
|
|
||||||
[language_packages]: ../vulnerability/detection/language.md
|
|
||||||
@@ -1,298 +0,0 @@
|
|||||||
# SPDX generation
|
|
||||||
|
|
||||||
Trivy can generate SBOM in the [SPDX][spdx] format.
|
|
||||||
|
|
||||||
You can use the regular subcommands (like `image`, `fs` and `rootfs`) and specify `spdx` with the `--format` option.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy image --format spdx --output result.spdx alpine:3.15
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Result</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cat result.spdx
|
|
||||||
SPDXVersion: SPDX-2.2
|
|
||||||
DataLicense: CC0-1.0
|
|
||||||
SPDXID: SPDXRef-DOCUMENT
|
|
||||||
DocumentName: alpine:3.15
|
|
||||||
DocumentNamespace: http://aquasecurity.github.io/trivy/container_image/alpine:3.15-bebf6b19-a94c-4e2c-af44-065f63923f48
|
|
||||||
Creator: Organization: aquasecurity
|
|
||||||
Creator: Tool: trivy-0.38.1
|
|
||||||
Created: 2022-04-28T07:32:57.142806Z
|
|
||||||
|
|
||||||
##### Package: zlib
|
|
||||||
|
|
||||||
PackageName: zlib
|
|
||||||
SPDXID: SPDXRef-12bc938ac028a5e1
|
|
||||||
PackageVersion: 1.2.12-r0
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: Zlib
|
|
||||||
PackageLicenseDeclared: Zlib
|
|
||||||
|
|
||||||
##### Package: apk-tools
|
|
||||||
|
|
||||||
PackageName: apk-tools
|
|
||||||
SPDXID: SPDXRef-26c274652190d87f
|
|
||||||
PackageVersion: 2.12.7-r3
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: GPL-2.0-only
|
|
||||||
PackageLicenseDeclared: GPL-2.0-only
|
|
||||||
|
|
||||||
##### Package: libretls
|
|
||||||
|
|
||||||
PackageName: libretls
|
|
||||||
SPDXID: SPDXRef-2b021966d19a8211
|
|
||||||
PackageVersion: 3.3.4-r3
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: ISC AND (BSD-3-Clause OR MIT)
|
|
||||||
PackageLicenseDeclared: ISC AND (BSD-3-Clause OR MIT)
|
|
||||||
|
|
||||||
##### Package: busybox
|
|
||||||
|
|
||||||
PackageName: busybox
|
|
||||||
SPDXID: SPDXRef-317ce3476703f20d
|
|
||||||
PackageVersion: 1.34.1-r5
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: GPL-2.0-only
|
|
||||||
PackageLicenseDeclared: GPL-2.0-only
|
|
||||||
|
|
||||||
##### Package: libcrypto1.1
|
|
||||||
|
|
||||||
PackageName: libcrypto1.1
|
|
||||||
SPDXID: SPDXRef-34f407fb4dbd67f4
|
|
||||||
PackageVersion: 1.1.1n-r0
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: OpenSSL
|
|
||||||
PackageLicenseDeclared: OpenSSL
|
|
||||||
|
|
||||||
##### Package: libc-utils
|
|
||||||
|
|
||||||
PackageName: libc-utils
|
|
||||||
SPDXID: SPDXRef-4bbc1cb449d54083
|
|
||||||
PackageVersion: 0.7.2-r3
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: BSD-2-Clause AND BSD-3-Clause
|
|
||||||
PackageLicenseDeclared: BSD-2-Clause AND BSD-3-Clause
|
|
||||||
|
|
||||||
##### Package: alpine-keys
|
|
||||||
|
|
||||||
PackageName: alpine-keys
|
|
||||||
SPDXID: SPDXRef-a3bdd174be1456b6
|
|
||||||
PackageVersion: 2.4-r1
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: MIT
|
|
||||||
PackageLicenseDeclared: MIT
|
|
||||||
|
|
||||||
##### Package: ca-certificates-bundle
|
|
||||||
|
|
||||||
PackageName: ca-certificates-bundle
|
|
||||||
SPDXID: SPDXRef-ac6472ba26fb991c
|
|
||||||
PackageVersion: 20211220-r0
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: MPL-2.0 AND MIT
|
|
||||||
PackageLicenseDeclared: MPL-2.0 AND MIT
|
|
||||||
|
|
||||||
##### Package: libssl1.1
|
|
||||||
|
|
||||||
PackageName: libssl1.1
|
|
||||||
SPDXID: SPDXRef-b2d1b1d70fe90f7d
|
|
||||||
PackageVersion: 1.1.1n-r0
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: OpenSSL
|
|
||||||
PackageLicenseDeclared: OpenSSL
|
|
||||||
|
|
||||||
##### Package: scanelf
|
|
||||||
|
|
||||||
PackageName: scanelf
|
|
||||||
SPDXID: SPDXRef-c617077ba6649520
|
|
||||||
PackageVersion: 1.3.3-r0
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: GPL-2.0-only
|
|
||||||
PackageLicenseDeclared: GPL-2.0-only
|
|
||||||
|
|
||||||
##### Package: musl
|
|
||||||
|
|
||||||
PackageName: musl
|
|
||||||
SPDXID: SPDXRef-ca80b810029cde0e
|
|
||||||
PackageVersion: 1.2.2-r7
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: MIT
|
|
||||||
PackageLicenseDeclared: MIT
|
|
||||||
|
|
||||||
##### Package: alpine-baselayout
|
|
||||||
|
|
||||||
PackageName: alpine-baselayout
|
|
||||||
SPDXID: SPDXRef-d782e64751ba9faa
|
|
||||||
PackageVersion: 3.2.0-r18
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: GPL-2.0-only
|
|
||||||
PackageLicenseDeclared: GPL-2.0-only
|
|
||||||
|
|
||||||
##### Package: musl-utils
|
|
||||||
|
|
||||||
PackageName: musl-utils
|
|
||||||
SPDXID: SPDXRef-e5e8a237f6162e22
|
|
||||||
PackageVersion: 1.2.2-r7
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: MIT BSD GPL2+
|
|
||||||
PackageLicenseDeclared: MIT BSD GPL2+
|
|
||||||
|
|
||||||
##### Package: ssl_client
|
|
||||||
|
|
||||||
PackageName: ssl_client
|
|
||||||
SPDXID: SPDXRef-fdf0ce84f6337be4
|
|
||||||
PackageVersion: 1.34.1-r5
|
|
||||||
FilesAnalyzed: false
|
|
||||||
PackageLicenseConcluded: GPL-2.0-only
|
|
||||||
PackageLicenseDeclared: GPL-2.0-only
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
SPDX-JSON format is also supported by using `spdx-json` with the `--format` option.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ trivy image --format spdx-json --output result.spdx.json alpine:3.15
|
|
||||||
```
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Result</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cat result.spdx.json | jq .
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-DOCUMENT",
|
|
||||||
"creationInfo": {
|
|
||||||
"created": "2022-04-28T08:16:55.328255Z",
|
|
||||||
"creators": [
|
|
||||||
"Tool: trivy-0.38.1",
|
|
||||||
"Organization: aquasecurity"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"dataLicense": "CC0-1.0",
|
|
||||||
"documentNamespace": "http://aquasecurity.github.io/trivy/container_image/alpine:3.15-d9549e3a-a4c5-4ee3-8bde-8c78d451fbe7",
|
|
||||||
"name": "alpine:3.15",
|
|
||||||
"packages": [
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-12bc938ac028a5e1",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "Zlib",
|
|
||||||
"licenseDeclared": "Zlib",
|
|
||||||
"name": "zlib",
|
|
||||||
"versionInfo": "1.2.12-r0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-26c274652190d87f",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "GPL-2.0-only",
|
|
||||||
"licenseDeclared": "GPL-2.0-only",
|
|
||||||
"name": "apk-tools",
|
|
||||||
"versionInfo": "2.12.7-r3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-2b021966d19a8211",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "ISC AND (BSD-3-Clause OR MIT)",
|
|
||||||
"licenseDeclared": "ISC AND (BSD-3-Clause OR MIT)",
|
|
||||||
"name": "libretls",
|
|
||||||
"versionInfo": "3.3.4-r3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-317ce3476703f20d",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "GPL-2.0-only",
|
|
||||||
"licenseDeclared": "GPL-2.0-only",
|
|
||||||
"name": "busybox",
|
|
||||||
"versionInfo": "1.34.1-r5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-34f407fb4dbd67f4",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "OpenSSL",
|
|
||||||
"licenseDeclared": "OpenSSL",
|
|
||||||
"name": "libcrypto1.1",
|
|
||||||
"versionInfo": "1.1.1n-r0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-4bbc1cb449d54083",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "BSD-2-Clause AND BSD-3-Clause",
|
|
||||||
"licenseDeclared": "BSD-2-Clause AND BSD-3-Clause",
|
|
||||||
"name": "libc-utils",
|
|
||||||
"versionInfo": "0.7.2-r3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-a3bdd174be1456b6",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "MIT",
|
|
||||||
"licenseDeclared": "MIT",
|
|
||||||
"name": "alpine-keys",
|
|
||||||
"versionInfo": "2.4-r1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-ac6472ba26fb991c",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "MPL-2.0 AND MIT",
|
|
||||||
"licenseDeclared": "MPL-2.0 AND MIT",
|
|
||||||
"name": "ca-certificates-bundle",
|
|
||||||
"versionInfo": "20211220-r0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-b2d1b1d70fe90f7d",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "OpenSSL",
|
|
||||||
"licenseDeclared": "OpenSSL",
|
|
||||||
"name": "libssl1.1",
|
|
||||||
"versionInfo": "1.1.1n-r0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-c617077ba6649520",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "GPL-2.0-only",
|
|
||||||
"licenseDeclared": "GPL-2.0-only",
|
|
||||||
"name": "scanelf",
|
|
||||||
"versionInfo": "1.3.3-r0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-ca80b810029cde0e",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "MIT",
|
|
||||||
"licenseDeclared": "MIT",
|
|
||||||
"name": "musl",
|
|
||||||
"versionInfo": "1.2.2-r7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-d782e64751ba9faa",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "GPL-2.0-only",
|
|
||||||
"licenseDeclared": "GPL-2.0-only",
|
|
||||||
"name": "alpine-baselayout",
|
|
||||||
"versionInfo": "3.2.0-r18"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-e5e8a237f6162e22",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "MIT BSD GPL2+",
|
|
||||||
"licenseDeclared": "MIT BSD GPL2+",
|
|
||||||
"name": "musl-utils",
|
|
||||||
"versionInfo": "1.2.2-r7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SPDXID": "SPDXRef-fdf0ce84f6337be4",
|
|
||||||
"filesAnalyzed": false,
|
|
||||||
"licenseConcluded": "GPL-2.0-only",
|
|
||||||
"licenseDeclared": "GPL-2.0-only",
|
|
||||||
"name": "ssl_client",
|
|
||||||
"versionInfo": "1.34.1-r5"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"spdxVersion": "SPDX-2.2"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
|
||||||
[spdx]: https://spdx.dev/wp-content/uploads/sites/41/2020/08/SPDX-specification-2-2.pdf
|
|
||||||
@@ -20,16 +20,18 @@ By default, Trivy scans licenses for packages installed by `apk`, `apt-get`, `dn
|
|||||||
To enable extended license scanning, you can use `--license-full`.
|
To enable extended license scanning, you can use `--license-full`.
|
||||||
In addition to package licenses, Trivy scans source code files, Markdown documents, text files and `LICENSE` documents to identify license usage within the image or filesystem.
|
In addition to package licenses, Trivy scans source code files, Markdown documents, text files and `LICENSE` documents to identify license usage within the image or filesystem.
|
||||||
|
|
||||||
|
By default, Trivy only classifies licenses that are matched with a confidence level of 0.9 or more by the classifer.
|
||||||
|
To configure the confidence level, you can use `--license-confidence-level`. This enables us to classify licenses that might be matched with a lower confidence level by the classifer.
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
The full license scanning is expensive. It takes a while.
|
The full license scanning is expensive. It takes a while.
|
||||||
|
|
||||||
Currently, the standard license scanning doesn't support filesystem and repository scanning.
|
Currently, the standard license scanning doesn't support filesystem and repository scanning.
|
||||||
|
|
||||||
| License scanning | Image | Rootfs | Filesystem | Repository |
|
| License scanning | Image | Rootfs | Filesystem | Repository |
|
||||||
|:---------------------:|:-----:|:---------:|:----------:|:----------:|
|
|:---------------------:|:-----:|:------:|:----------:|:----------:|
|
||||||
| Standard | ✅ | ✅ | - | - |
|
| Standard | ✅ | ✅ | - | - |
|
||||||
| Full (--license-full) | ✅ | ✅ | ✅ | ✅ |
|
| Full (--license-full) | ✅ | ✅ | ✅ | ✅ |
|
||||||
|
|
||||||
|
|
||||||
License checking classifies the identified licenses and map the classification to severity.
|
License checking classifies the identified licenses and map the classification to severity.
|
||||||
|
|
||||||
@@ -158,6 +160,30 @@ Total: 2 (HIGH: 2, CRITICAL: 0)
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configuring Classifier Confidence Level
|
||||||
|
You can use the `--license-confidence-level` flag to adjust the confidence level between 0.0 to 1.0 (default 0.9).
|
||||||
|
For example, when you run the scanner with the default confidence level on [SPDX license list data](https://github.com/spdx/license-list-data/tree/main/text), it is able to detect only 258 licenses.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy fs --scanners license --license-full <path/to/spdx/list/data>
|
||||||
|
2023-04-18T10:05:13.601-0700 INFO Full license scanning is enabled
|
||||||
|
|
||||||
|
Loose File License(s) (license)
|
||||||
|
===============================
|
||||||
|
Total: 258 (UNKNOWN: 70, LOW: 90, MEDIUM: 18, HIGH: 58, CRITICAL: 22)
|
||||||
|
```
|
||||||
|
|
||||||
|
However, by configuring the confidence level to 0.8, the scanner is now able to detect 282 licenses.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy fs --scanners license --license-full --license-confidence-level 0.8 <path/to/spdx/list/data>
|
||||||
|
2023-04-18T10:21:39.637-0700 INFO Full license scanning is enabled
|
||||||
|
|
||||||
|
Loose File License(s) (license)
|
||||||
|
===============================
|
||||||
|
Total: 282 (UNKNOWN: 81, LOW: 97, MEDIUM: 24, HIGH: 58, CRITICAL: 22)
|
||||||
|
```
|
||||||
|
|
||||||
### Custom Classification
|
### Custom Classification
|
||||||
You can generate the default config by the `--generate-default-config` flag and customize the license classification.
|
You can generate the default config by the `--generate-default-config` flag and customize the license classification.
|
||||||
For example, if you want to forbid only AGPL-3.0, you can leave it under `forbidden` and move other licenses to another classification.
|
For example, if you want to forbid only AGPL-3.0, you can leave it under `forbidden` and move other licenses to another classification.
|
||||||
@@ -196,7 +196,7 @@ You can specify input format via the `custom.input` annotation.
|
|||||||
`type` accepts `kubernetes`, `dockerfile`, `cloudformation`, `terraform`, `terraformplan`, `json`, or `yaml`.
|
`type` accepts `kubernetes`, `dockerfile`, `cloudformation`, `terraform`, `terraformplan`, `json`, or `yaml`.
|
||||||
|
|
||||||
### Schemas
|
### Schemas
|
||||||
See [here](./schema.md) for the detail.
|
See [here](schema.md) for the detail.
|
||||||
|
|
||||||
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
||||||
[package]: https://www.openpolicyagent.org/docs/latest/policy-language/#packages
|
[package]: https://www.openpolicyagent.org/docs/latest/policy-language/#packages
|
||||||
51
docs/docs/scanner/misconfiguration/custom/selectors.md
Normal file
51
docs/docs/scanner/misconfiguration/custom/selectors.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Input Selectors
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Sometimes you might want to limit a certain policy to only be run on certain resources. This can be
|
||||||
|
achieved with input selectors.
|
||||||
|
|
||||||
|
## Use case
|
||||||
|
For instance, if you have a custom policy that you only want to be evaluated if a certain resource type is being scanned.
|
||||||
|
In such a case you could utilize input selectors to limit its evaluation on only those resources.
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
```
|
||||||
|
# METADATA
|
||||||
|
# title: "RDS Publicly Accessible"
|
||||||
|
# description: "Ensures RDS instances are not launched into the public cloud."
|
||||||
|
# custom:
|
||||||
|
# input:
|
||||||
|
# selector:
|
||||||
|
# - type: cloud
|
||||||
|
# subtypes:
|
||||||
|
# - provider: aws
|
||||||
|
# service: rds
|
||||||
|
package builtin.aws.rds.aws0999
|
||||||
|
|
||||||
|
deny[res] {
|
||||||
|
instance := input.aws.rds.instances[_]
|
||||||
|
instance.publicaccess.value
|
||||||
|
res := result.new("Instance has Public Access enabled", instance.publicaccess)
|
||||||
|
```
|
||||||
|
|
||||||
|
Observe the following `subtypes` defined:
|
||||||
|
```yaml
|
||||||
|
# subtypes:
|
||||||
|
# - provider: aws
|
||||||
|
# service: rds
|
||||||
|
```
|
||||||
|
|
||||||
|
They will ensure that the policy is only run when the input to such a policy contains an `RDS` instance.
|
||||||
|
|
||||||
|
## Enabling selectors and subtypes
|
||||||
|
Currently, the following are supported:
|
||||||
|
|
||||||
|
| Selector | Subtype fields required | Example |
|
||||||
|
|--------------------------|-------------------------|---------------------------------|
|
||||||
|
| Cloud (AWS, Azure, etc.) | `provider`, `service` | `provider: aws`, `service: rds` |
|
||||||
|
| Kubernetes | | `type: kubernetes` |
|
||||||
|
| Dockerfile | | `type: dockerfile` |
|
||||||
|
|
||||||
|
|
||||||
|
## Default behaviour
|
||||||
|
If no subtypes or selectors are specified, the policy will be evaluated regardless of input.
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
Trivy provides built-in policies to detect configuration issues in popular Infrastructure as Code files, such as: Docker, Kubernetes, Terraform, CloudFormation, and more.
|
Trivy provides built-in policies to detect configuration issues in popular Infrastructure as Code files, such as: Docker, Kubernetes, Terraform, CloudFormation, and more.
|
||||||
In addition to built-in policies, you can write your own custom policies, as you can see [here][custom].
|
In addition to built-in policies, you can write your own custom policies, as you can see [here][custom].
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
Simply specify a directory containing IaC files such as Terraform, CloudFormation, Azure ARM templates, Helm Charts and Dockerfile.
|
Simply specify a directory containing IaC files such as Terraform, CloudFormation, Azure ARM templates, Helm Charts and Dockerfile.
|
||||||
@@ -313,7 +311,87 @@ Tests: 20 (SUCCESSES: 18, FAILURES: 2, EXCEPTIONS: 0)
|
|||||||
Failures: 2 (MEDIUM: 2, HIGH: 0, CRITICAL: 0)
|
Failures: 2 (MEDIUM: 2, HIGH: 0, CRITICAL: 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
## Configuration
|
||||||
See [here](https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/examples/misconf/mixed)
|
This section describes misconfiguration-specific configuration.
|
||||||
|
Other common options are documented [here](../../configuration/index.md).
|
||||||
|
|
||||||
[custom]: ./custom/index.md
|
### Pass custom policies
|
||||||
|
You can pass directories including your custom policies through `--policy` option.
|
||||||
|
This can be repeated for specifying multiple directories.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd examplex/misconf/
|
||||||
|
trivy conf --policy custom-policy/policy --policy combine/policy --namespaces user misconf/mixed
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, see [Custom Policies](./custom/index.md).
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
You also need to specify `--namespaces` option.
|
||||||
|
|
||||||
|
### Pass custom data
|
||||||
|
You can pass directories including your custom data through `--data` option.
|
||||||
|
This can be repeated for specifying multiple directories.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd examples/misconf/custom-data
|
||||||
|
trivy conf --policy ./policy --data ./data --namespaces user ./configs
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, see [Custom Data](./custom/data.md).
|
||||||
|
|
||||||
|
### Pass namespaces
|
||||||
|
By default, Trivy evaluates policies defined in `builtin.*`.
|
||||||
|
If you want to evaluate custom policies in other packages, you have to specify package prefixes through `--namespaces` option.
|
||||||
|
This can be repeated for specifying multiple packages.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
trivy conf --policy ./policy --namespaces main --namespaces user ./configs
|
||||||
|
```
|
||||||
|
|
||||||
|
### Terraform value overrides
|
||||||
|
You can pass `tf-vars` files to Trivy to override default values found in the Terraform HCL code.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
trivy conf --tf-vars dev.terraform.tfvars ./infrastructure/tf
|
||||||
|
```
|
||||||
|
|
||||||
|
### Helm value overrides
|
||||||
|
There are a number of options for overriding values in Helm charts. When override values are passed to the Helm scanner, the values will be used during the Manifest rendering process and will become part of the scanned artifact.
|
||||||
|
|
||||||
|
#### Setting inline value overrides
|
||||||
|
Overrides can be set inline on the command line
|
||||||
|
|
||||||
|
```bash
|
||||||
|
trivy conf --helm-set securityContext.runAsUser=0 ./charts/mySql
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Setting value file overrides
|
||||||
|
Overrides can be in a file that has the key=value set.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example override file (overrides.yaml)
|
||||||
|
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
trivy conf --helm-values overrides.yaml ./charts/mySql
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Setting value as explicit string
|
||||||
|
the `--helm-set-string` is the same as `--helm-set` but explicitly retains the value as a string
|
||||||
|
|
||||||
|
```bash
|
||||||
|
trivy config --helm-set-string name=false ./infrastructure/tf
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Setting specific values from files
|
||||||
|
Specific override values can come from specific files
|
||||||
|
|
||||||
|
```bash
|
||||||
|
trivy conf --helm-set-file environment=dev.values.yaml ./charts/mySql
|
||||||
|
```
|
||||||
|
|
||||||
|
[custom]: custom/index.md
|
||||||
@@ -13,7 +13,6 @@ Those policies are managed under [defsec repository][defsec].
|
|||||||
| CloudFormation | [defsec][defsec] |
|
| CloudFormation | [defsec][defsec] |
|
||||||
| Azure ARM Template | [defsec][defsec] |
|
| Azure ARM Template | [defsec][defsec] |
|
||||||
| Helm Chart | [defsec][kubernetes] |
|
| Helm Chart | [defsec][kubernetes] |
|
||||||
| RBAC | [defsec][rbac] |
|
|
||||||
|
|
||||||
For suggestions or issues regarding policy content, please open an issue under the [defsec][defsec] repository.
|
For suggestions or issues regarding policy content, please open an issue under the [defsec][defsec] repository.
|
||||||
|
|
||||||
@@ -30,7 +29,6 @@ Trivy checks for updates to OPA bundle on GHCR every 24 hours and pulls it if th
|
|||||||
|
|
||||||
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
||||||
[defsec]: https://github.com/aquasecurity/defsec
|
[defsec]: https://github.com/aquasecurity/defsec
|
||||||
[kubernetes]: https://github.com/aquasecurity/defsec/tree/master/internal/rules/kubernetes
|
[kubernetes]: https://github.com/aquasecurity/defsec/tree/master/rules/kubernetes/policies
|
||||||
[kubernetes]: https://github.com/aquasecurity/defsec/tree/master/internal/rules/rbac
|
[docker]: https://github.com/aquasecurity/defsec/tree/master/rules/docker/policies
|
||||||
[docker]: https://github.com/aquasecurity/defsec/tree/master/internal/rules/policies/docker
|
|
||||||
[ghcr]: https://github.com/aquasecurity/defsec/pkgs/container/defsec
|
[ghcr]: https://github.com/aquasecurity/defsec/pkgs/container/defsec
|
||||||
312
docs/docs/scanner/secret.md
Normal file
312
docs/docs/scanner/secret.md
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
# Secret Scanning
|
||||||
|
|
||||||
|
Trivy scans any container image, filesystem and git repository to detect exposed secrets like passwords, api keys, and tokens.
|
||||||
|
Secret scanning is enabled by default.
|
||||||
|
|
||||||
|
Trivy will scan every plaintext file, according to builtin rules or configuration. There are plenty of builtin rules:
|
||||||
|
|
||||||
|
- AWS access key
|
||||||
|
- GCP service account
|
||||||
|
- GitHub personal access token
|
||||||
|
- GitLab personal access token
|
||||||
|
- Slack access token
|
||||||
|
- etc.
|
||||||
|
|
||||||
|
You can see a full list of [built-in rules][builtin] and [built-in allow rules][builtin-allow].
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
If your secret is not detected properly, please make sure that your file including the secret is not in [the allowed paths][builtin-allow].
|
||||||
|
You can disable allow rules via [disable-allow-rules](#disable-rules).
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
This section shows how to scan secrets in container image and filesystem. Other subcommands should be the same.
|
||||||
|
|
||||||
|
### Container image
|
||||||
|
Specify an image name.
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
$ trivy image myimage:1.0.0
|
||||||
|
2022-04-21T18:56:44.099+0300 INFO Detected OS: alpine
|
||||||
|
2022-04-21T18:56:44.099+0300 INFO Detecting Alpine vulnerabilities...
|
||||||
|
2022-04-21T18:56:44.101+0300 INFO Number of language-specific files: 0
|
||||||
|
|
||||||
|
myimage:1.0.0 (alpine 3.15.0)
|
||||||
|
=============================
|
||||||
|
Total: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 2)
|
||||||
|
|
||||||
|
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|
||||||
|
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
|
||||||
|
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|
||||||
|
| busybox | CVE-2022-28391 | CRITICAL | 1.34.1-r3 | 1.34.1-r5 | CVE-2022-28391 affecting |
|
||||||
|
| | | | | | package busybox 1.35.0 |
|
||||||
|
| | | | | | -->avd.aquasec.com/nvd/cve-2022-28391 |
|
||||||
|
+--------------+------------------| |-------------------+---------------+---------------------------------------+
|
||||||
|
| ssl_client | CVE-2022-28391 | | 1.34.1-r3 | 1.34.1-r5 | CVE-2022-28391 affecting |
|
||||||
|
| | | | | | package busybox 1.35.0 |
|
||||||
|
| | | | | | -->avd.aquasec.com/nvd/cve-2022-28391 |
|
||||||
|
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|
||||||
|
|
||||||
|
app/secret.sh (secrets)
|
||||||
|
=======================
|
||||||
|
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 1)
|
||||||
|
|
||||||
|
+----------+-------------------+----------+---------+--------------------------------+
|
||||||
|
| CATEGORY | DESCRIPTION | SEVERITY | LINE NO | MATCH |
|
||||||
|
+----------+-------------------+----------+---------+--------------------------------+
|
||||||
|
| AWS | AWS Access Key ID | CRITICAL | 10 | export AWS_ACCESS_KEY_ID=***** |
|
||||||
|
+----------+-------------------+----------+---------+--------------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
Trivy tries to detect a base image and skip those layers for secret scanning.
|
||||||
|
A base image usually contains a lot of files and makes secret scanning much slower.
|
||||||
|
If a secret is not detected properly, you can see base layers with the `--debug` flag.
|
||||||
|
|
||||||
|
### Filesystem
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
$ trivy fs /path/to/your_project
|
||||||
|
...(snip)...
|
||||||
|
|
||||||
|
certs/key.pem (secrets)
|
||||||
|
========================
|
||||||
|
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)
|
||||||
|
|
||||||
|
+----------------------+------------------------+----------+---------+---------------------------------+
|
||||||
|
| CATEGORY | DESCRIPTION | SEVERITY | LINE NO | MATCH |
|
||||||
|
+----------------------+------------------------+----------+---------+---------------------------------+
|
||||||
|
| AsymmetricPrivateKey | Asymmetric Private Key | HIGH | 1 | -----BEGIN RSA PRIVATE KEY----- |
|
||||||
|
+----------------------+------------------------+----------+---------+---------------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
Your project may have some secrets for testing. You can skip them with `--skip-dirs` or `--skip-files`.
|
||||||
|
We would recommend specifying these options so that the secret scanning can be faster if those files don't need to be scanned.
|
||||||
|
Also, you can specify paths to be allowed in a configuration file. See the detail [here](#configuration).
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
This section describes secret-specific configuration.
|
||||||
|
Other common options are documented [here](../configuration/index.md).
|
||||||
|
|
||||||
|
Trivy has a set of builtin rules for secret scanning, which can be extended or modified by a configuration file.
|
||||||
|
Trivy tries to load `trivy-secret.yaml` in the current directory by default.
|
||||||
|
If the file doesn't exist, only built-in rules are used.
|
||||||
|
You can customize the config file path via the `--secret-config` flag.
|
||||||
|
|
||||||
|
### Custom Rules
|
||||||
|
Trivy allows defining custom rules.
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
rules:
|
||||||
|
- id: rule1
|
||||||
|
category: general
|
||||||
|
title: Generic Rule
|
||||||
|
severity: HIGH
|
||||||
|
path: .*\.sh
|
||||||
|
keywords:
|
||||||
|
- secret
|
||||||
|
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
||||||
|
secret-group-name: secret
|
||||||
|
allow-rules:
|
||||||
|
- id: skip-text
|
||||||
|
description: skip text files
|
||||||
|
path: .*\.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
`id` (required)
|
||||||
|
: - Unique identifier for this rule.
|
||||||
|
|
||||||
|
`category` (required)
|
||||||
|
: - String used for metadata and reporting purposes.
|
||||||
|
|
||||||
|
`title` (required)
|
||||||
|
: - Short human-readable title of the rule.
|
||||||
|
|
||||||
|
`severity` (required)
|
||||||
|
: - How critical this rule is.
|
||||||
|
- Allowed values:
|
||||||
|
- CRITICAL
|
||||||
|
- HIGH
|
||||||
|
- MEDIUM
|
||||||
|
- LOW
|
||||||
|
|
||||||
|
`regex` (required)
|
||||||
|
: - Golang regular expression used to detect secrets.
|
||||||
|
|
||||||
|
`path` (optional)
|
||||||
|
: - Golang regular expression used to match paths.
|
||||||
|
|
||||||
|
`keywords` (optional, recommended)
|
||||||
|
: - Keywords are used for pre-regex check filtering.
|
||||||
|
- Rules that contain keywords will perform a quick string compare check to make sure the keyword(s) are in the content being scanned.
|
||||||
|
- Ideally these values should either be part of the identifier or unique strings specific to the rule's regex.
|
||||||
|
- It is recommended to define for better performance.
|
||||||
|
|
||||||
|
`allow-rules` (optional)
|
||||||
|
: - Allow rules for a single rule to reduce false positives with known secrets.
|
||||||
|
- The details are below.
|
||||||
|
|
||||||
|
### Allow Rules
|
||||||
|
If the detected secret is matched with the specified `regex`, then that secret will be skipped and not detected.
|
||||||
|
The same logic applies for `path`.
|
||||||
|
|
||||||
|
`allow-rules` can be defined globally and per each rule. The fields are the same.
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
rules:
|
||||||
|
- id: rule1
|
||||||
|
category: general
|
||||||
|
title: Generic Rule
|
||||||
|
severity: HIGH
|
||||||
|
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
||||||
|
allow-rules:
|
||||||
|
- id: skip-text
|
||||||
|
description: skip text files
|
||||||
|
path: .*\.txt
|
||||||
|
allow-rules:
|
||||||
|
- id: social-security-number
|
||||||
|
description: skip social security number
|
||||||
|
regex: 219-09-9999
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
`id` (required)
|
||||||
|
: - Unique identifier for this allow rule.
|
||||||
|
|
||||||
|
`description` (optional)
|
||||||
|
: - Short human-readable description of this allow rule.
|
||||||
|
|
||||||
|
`regex` (optional)
|
||||||
|
: - Golang regular expression used to allow detected secrets.
|
||||||
|
- `regex` or `path` must be specified.
|
||||||
|
|
||||||
|
`path` (optional)
|
||||||
|
: - Golang regular expression used to allow matched paths.
|
||||||
|
- `regex` or `path` must be specified.
|
||||||
|
|
||||||
|
### Enable Rules
|
||||||
|
Trivy provides plenty of out-of-box rules and allow rules, but you may not need all of them.
|
||||||
|
In that case, `enable-builtin-rules` will be helpful.
|
||||||
|
If you just need AWS secret detection, you can enable only relevant rules as shown below.
|
||||||
|
It specifies AWS-related rule IDs in `enable-builtin-rules`.
|
||||||
|
All other rules are disabled, so the scanning will be much faster.
|
||||||
|
We would strongly recommend using this option if you don't need all rules.
|
||||||
|
|
||||||
|
You can see a full list of [built-in rule IDs][builtin] and [built-in allow rule IDs][builtin-allow].
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
enable-builtin-rules:
|
||||||
|
- aws-access-key-id
|
||||||
|
- aws-account-id
|
||||||
|
- aws-secret-access-key
|
||||||
|
```
|
||||||
|
|
||||||
|
### Disable Rules
|
||||||
|
Trivy offers built-in rules and allow rules, but you may want to disable some of them.
|
||||||
|
For example, you don't use Slack, so Slack doesn't have to be scanned.
|
||||||
|
You can specify the Slack rule IDs, `slack-access-token` and `slack-web-hook` in `disable-rules` so that those rules will be disabled for less false positives.
|
||||||
|
|
||||||
|
You should specify either `enable-builtin-rules` or `disable-rules`.
|
||||||
|
If they both are specified, `disable-rules` takes precedence.
|
||||||
|
In case `github-pat` is specified in `enable-builtin-rules` and `disable-rules`, it will be disabled.
|
||||||
|
|
||||||
|
In addition, there are some allow rules.
|
||||||
|
Markdown files are ignored by default, but you may want to scan markdown files as well.
|
||||||
|
You can disable the allow rule by adding `markdown` to `disable-allow-rules`.
|
||||||
|
|
||||||
|
You can see a full list of [built-in rule IDs][builtin] and [built-in allow rule IDs][builtin-allow].
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
disable-rules:
|
||||||
|
- slack-access-token
|
||||||
|
- slack-web-hook
|
||||||
|
disable-allow-rules:
|
||||||
|
- markdown
|
||||||
|
```
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
We would recommend specifying `--skip-dirs` for faster secret scanning.
|
||||||
|
In container image scanning, Trivy walks the file tree rooted `/` and scans all the files other than [built-in allowed paths][builtin-allow].
|
||||||
|
It will take a while if your image contains a lot of files even though Trivy tries to avoid scanning layers from a base image.
|
||||||
|
If you want to make scanning faster, `--skip-dirs` and `--skip-files` helps so that Trivy will skip scanning those files and directories.
|
||||||
|
You can see more options [here](../configuration/others.md).
|
||||||
|
|
||||||
|
`allow-rules` is also helpful. See the [allow-rules](#allow-rules) section.
|
||||||
|
|
||||||
|
In addition, all the built-in rules are enabled by default, so it takes some time to scan all of them.
|
||||||
|
If you don't need all those rules, you can use `enable-builtin-rules` or `disable-rules` in the configuration file.
|
||||||
|
You should use `enable-builtin-rules` if you need only AWS secret detection, for example.
|
||||||
|
All rules are disabled except for the ones you specify, so it runs very fast.
|
||||||
|
On the other hand, you should use `disable-rules` if you just want to disable some built-in rules.
|
||||||
|
See the [enable-rules](#enable-rules) and [disable-rules](#disable-rules) sections for the detail.
|
||||||
|
|
||||||
|
If you don't need secret scanning, you can disable it via the `--scanners` flag.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy image --scanners vuln alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
`trivy-secret.yaml` in the working directory is loaded by default.
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
$ cat trivy-secret.yaml
|
||||||
|
rules:
|
||||||
|
- id: rule1
|
||||||
|
category: general
|
||||||
|
title: Generic Rule
|
||||||
|
severity: HIGH
|
||||||
|
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
||||||
|
allow-rules:
|
||||||
|
- id: social-security-number
|
||||||
|
description: skip social security number
|
||||||
|
regex: 219-09-9999
|
||||||
|
- id: log-dir
|
||||||
|
description: skip log directory
|
||||||
|
path: ^\/var\/log\/
|
||||||
|
disable-rules:
|
||||||
|
- slack-access-token
|
||||||
|
- slack-web-hook
|
||||||
|
disable-allow-rules:
|
||||||
|
- markdown
|
||||||
|
|
||||||
|
# The following command automatically loads the above configuration.
|
||||||
|
$ trivy image YOUR_IMAGE
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, you can customize the config file path via `--secret-config`.
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
$ cat ./secret-config/trivy.yaml
|
||||||
|
rules:
|
||||||
|
- id: rule1
|
||||||
|
category: general
|
||||||
|
title: Generic Rule
|
||||||
|
severity: HIGH
|
||||||
|
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
||||||
|
allow-rules:
|
||||||
|
- id: skip-text
|
||||||
|
description: skip text files
|
||||||
|
path: .*\.txt
|
||||||
|
enable-builtin-rules:
|
||||||
|
- aws-access-key-id
|
||||||
|
- aws-account-id
|
||||||
|
- aws-secret-access-key
|
||||||
|
disable-allow-rules:
|
||||||
|
- usr-dirs
|
||||||
|
|
||||||
|
# Pass the above config with `--secret-config`.
|
||||||
|
$ trivy fs --secret-config ./secret-config/trivy.yaml /path/to/your_project
|
||||||
|
```
|
||||||
|
|
||||||
|
## Credit
|
||||||
|
This feature is inspired by [gitleaks][gitleaks].
|
||||||
|
|
||||||
|
[builtin]: https://github.com/aquasecurity/trivy/blob/{{ git.tag }}/pkg/fanal/secret/builtin-rules.go
|
||||||
|
[builtin-allow]: https://github.com/aquasecurity/trivy/blob/{{ git.tag }}/pkg/fanal/secret/builtin-allow-rules.go
|
||||||
|
[gitleaks]: https://github.com/gitleaks/gitleaks
|
||||||
|
|
||||||
|
[builtin]: https://github.com/aquasecurity/trivy/blob/main/pkg/fanal/secret/builtin-rules.go
|
||||||
|
[builtin-allow]: https://github.com/aquasecurity/trivy/blob/main/pkg/fanal/secret/builtin-allow-rules.go
|
||||||
51
docs/docs/scanner/vulnerability/index.md
Normal file
51
docs/docs/scanner/vulnerability/index.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Vulnerability Scanning
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This section describes the overview of vulnerability scanning.
|
||||||
|
Trivy detects known vulnerabilities according to the versions of installed packages.
|
||||||
|
|
||||||
|
The following packages are supported.
|
||||||
|
|
||||||
|
- [OS packages](os.md)
|
||||||
|
- [Language-specific packages](language/index.md)
|
||||||
|
|
||||||
|
Trivy downloads [the vulnerabillity database](https://github.com/aquasecurity/trivy-db) every 6 hours.
|
||||||
|
|
||||||
|
## Database
|
||||||
|
Trivy uses two types of databases for vulnerability detection:
|
||||||
|
|
||||||
|
- Vulnerability Database
|
||||||
|
- Java Index Database
|
||||||
|
|
||||||
|
This page provides detailed information about these databases.
|
||||||
|
|
||||||
|
### Vulnerability Database
|
||||||
|
Trivy utilizes a database containing vulnerability information.
|
||||||
|
This database is built every six hours on [GitHub](https://github.com/aquasecurity/trivy-db) and is distributed via [GitHub Container registry (GHCR)](https://ghcr.io/aquasecurity/trivy-db).
|
||||||
|
The database is cached and updated as needed.
|
||||||
|
As Trivy updates the database automatically during execution, users don't need to be concerned about it.
|
||||||
|
|
||||||
|
For CLI flags related to the database, please refer to [this page](../../configuration/db.md).
|
||||||
|
|
||||||
|
#### Private Hosting
|
||||||
|
If you host the database on your own OCI registry, you can specify a different repository with the `--db-repository` flag.
|
||||||
|
The default is `ghcr.io/aquasecurity/trivy-db`.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy image --db-repository YOUR_REPO YOUR_IMAGE
|
||||||
|
```
|
||||||
|
|
||||||
|
If authentication is required, it can be configured in the same way as for private images.
|
||||||
|
Please refer to [the documentation](../../advanced/private-registries/index.md) for more details.
|
||||||
|
|
||||||
|
### Java Index Database
|
||||||
|
This database is only downloaded when scanning JAR files so that Trivy can identify the groupId, artifactId, and version of JAR files.
|
||||||
|
It is built once a day on [GitHub](https://github.com/aquasecurity/trivy-java-db) and distributed via [GitHub Container registry (GHCR)](https://ghcr.io/aquasecurity/trivy-java-db).
|
||||||
|
Like the vulnerability database, it is automatically downloaded and updated when needed, so users don't need to worry about it.
|
||||||
|
|
||||||
|
#### Private Hosting
|
||||||
|
If you host the database on your own OCI registry, you can specify a different repository with the `--java-db-repository` flag.
|
||||||
|
The default is `ghcr.io/aquasecurity/trivy-java-db`.
|
||||||
|
|
||||||
|
If authentication is required, you need to run `docker login YOUR_REGISTRY`.
|
||||||
|
Currently, specifying a username and password is not supported.
|
||||||
@@ -6,8 +6,8 @@ The following table provides an outline of the features Trivy offers.
|
|||||||
|
|
||||||
| Artifact | Offline[^1] | Dev dependencies | License | Dependency graph |
|
| Artifact | Offline[^1] | Dev dependencies | License | Dependency graph |
|
||||||
|----------|:-----------:|:-----------------|:-------:|:----------------:|
|
|----------|:-----------:|:-----------------|:-------:|:----------------:|
|
||||||
| Modules | ✓ | Include | ✓[^2] | ✓[^2] |
|
| Modules | ✅ | Include | ✅[^2] | ✅[^2] |
|
||||||
| Binaries | ✓ | Exclude | - | - |
|
| Binaries | ✅ | Exclude | - | - |
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
Trivy scans only dependencies of the Go project.
|
Trivy scans only dependencies of the Go project.
|
||||||
@@ -19,8 +19,8 @@ Depending on Go versions, the required files are different.
|
|||||||
|
|
||||||
| Version | Required files | Offline |
|
| Version | Required files | Offline |
|
||||||
|---------|:--------------:|:-------:|
|
|---------|:--------------:|:-------:|
|
||||||
| \>=1.17 | go.mod | ✓ |
|
| \>=1.17 | go.mod | ✅ |
|
||||||
| <1.17 | go.mod, go.sum | ✓ |
|
| <1.17 | go.mod, go.sum | ✅ |
|
||||||
|
|
||||||
In Go 1.17+ projects, Trivy uses `go.mod` for direct/indirect dependencies.
|
In Go 1.17+ projects, Trivy uses `go.mod` for direct/indirect dependencies.
|
||||||
On the other hand, it uses `go.mod` for direct dependencies and `go.sum` for indirect dependencies in Go 1.16 or less.
|
On the other hand, it uses `go.mod` for direct dependencies and `go.sum` for indirect dependencies in Go 1.16 or less.
|
||||||
@@ -51,7 +51,7 @@ If you want to have better detection, please consider updating the Go version in
|
|||||||
|
|
||||||
To identify licenses and dependency relationships, you need to download modules to local cache beforehand,
|
To identify licenses and dependency relationships, you need to download modules to local cache beforehand,
|
||||||
such as `go mod download`, `go mod tidy`, etc.
|
such as `go mod download`, `go mod tidy`, etc.
|
||||||
Trivy traverses `$GOPATH/pkg/mod` and collect those extra information.
|
Trivy traverses `$GOPATH/pkg/mod` and collects those extra information.
|
||||||
|
|
||||||
### Go binaries
|
### Go binaries
|
||||||
Trivy scans binaries built by Go.
|
Trivy scans binaries built by Go.
|
||||||
93
docs/docs/scanner/vulnerability/language/index.md
Normal file
93
docs/docs/scanner/vulnerability/language/index.md
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
# Language-specific Packages
|
||||||
|
|
||||||
|
`Trivy` automatically detects the following files and scans vulnerabilities in the application dependencies.
|
||||||
|
|
||||||
|
## Supported languages
|
||||||
|
|
||||||
|
| Language | File | Image[^7] | Rootfs[^8] | Filesystem[^9] | Repository[^10] | Dev dependencies | Dependency location[^11] |
|
||||||
|
|----------------------|--------------------------------------------------------------------------------------------|:---------:|:----------:|:--------------:|:---------------:|------------------|:------------------------:|
|
||||||
|
| Ruby | Gemfile.lock | - | - | ✅ | ✅ | included | - |
|
||||||
|
| | gemspec | ✅ | ✅ | - | - | included | - |
|
||||||
|
| [Python](python.md) | Pipfile.lock | - | - | ✅ | ✅ | excluded | ✅ |
|
||||||
|
| | poetry.lock | - | - | ✅ | ✅ | excluded | - |
|
||||||
|
| | requirements.txt | - | - | ✅ | ✅ | included | - |
|
||||||
|
| | egg package[^1] | ✅ | ✅ | - | - | excluded | - |
|
||||||
|
| | wheel package[^2] | ✅ | ✅ | - | - | excluded | - |
|
||||||
|
| [PHP](php.md) | composer.lock | ✅ | ✅ | ✅ | ✅ | excluded | ✅ |
|
||||||
|
| [Node.js](nodejs.md) | package-lock.json | - | - | ✅ | ✅ | excluded | ✅ |
|
||||||
|
| | yarn.lock | - | - | ✅ | ✅ | included | ✅ |
|
||||||
|
| | pnpm-lock.yaml | - | - | ✅ | ✅ | excluded | - |
|
||||||
|
| | package.json | ✅ | ✅ | - | - | excluded | - |
|
||||||
|
| .NET | packages.lock.json | ✅ | ✅ | ✅ | ✅ | included | ✅ |
|
||||||
|
| | packages.config | ✅ | ✅ | ✅ | ✅ | excluded | - |
|
||||||
|
| | .deps.json | ✅ | ✅ | ✅ | ✅ | excluded | ✅ |
|
||||||
|
| [Java](java.md) | JAR/WAR/PAR/EAR[^3] | ✅ | ✅ | - | - | included | - |
|
||||||
|
| | pom.xml[^4] | - | - | ✅ | ✅ | excluded | - |
|
||||||
|
| | *gradle.lockfile | - | - | ✅ | ✅ | excluded | - |
|
||||||
|
| [Go](golang.md) | Binaries built by Go[^5] | ✅ | ✅ | - | - | excluded | - |
|
||||||
|
| | go.mod[^6] | - | - | ✅ | ✅ | included | - |
|
||||||
|
| [Rust](rust.md) | Cargo.lock | ✅ | ✅ | ✅ | ✅ | excluded | ✅ |
|
||||||
|
| | Binaries built with [cargo-auditable](https://github.com/rust-secure-code/cargo-auditable) | ✅ | ✅ | - | - | excluded | - |
|
||||||
|
| C/C++ | conan.lock[^12] | - | - | ✅ | ✅ | excluded | - |
|
||||||
|
| Elixir | mix.lock[^12] | - | - | ✅ | ✅ | excluded | ✅ |
|
||||||
|
| Dart | pubspec.lock | ✅ | ✅ | - | - | included | - |
|
||||||
|
|
||||||
|
The path of these files does not matter.
|
||||||
|
|
||||||
|
Example: [Dockerfile](https://github.com/aquasecurity/trivy-ci-test/blob/main/Dockerfile)
|
||||||
|
|
||||||
|
[^1]: `*.egg-info`, `*.egg-info/PKG-INFO`, `*.egg` and `EGG-INFO/PKG-INFO`
|
||||||
|
[^2]: `.dist-info/META-DATA`
|
||||||
|
[^3]: `*.jar`, `*.war`, `*.par` and `*.ear`
|
||||||
|
[^4]: It requires Internet access when the POM doesn't exist in your local repository
|
||||||
|
[^5]: UPX-compressed binaries don't work
|
||||||
|
[^6]: If smaller than go 1.17, go.sum is also required
|
||||||
|
[^7]: ✅ means "enabled" and `-` means "disabled" in the image scanning
|
||||||
|
[^8]: ✅ means "enabled" and `-` means "disabled" in the rootfs scanning
|
||||||
|
[^9]: ✅ means "enabled" and `-` means "disabled" in the filesystem scanning
|
||||||
|
[^10]: ✅ means "enabled" and `-` means "disabled" in the git repository scanning
|
||||||
|
[^11]: ✅ means that Trivy detects line numbers where each dependency is declared in the scanned file. Only supported in [json](../../../configuration/reporting.md#json) and [sarif](../../../configuration/reporting.md#sarif) formats. SARIF uses `startline == 1 and endline == 1` for unsupported file types
|
||||||
|
[^12]: To scan a filename other than the default filename use [file-patterns](../../../configuration/others.md#file-patterns)
|
||||||
|
[^13]: When you scan `Cargo.lock` and `Cargo.toml` together. See about it [here](./rust.md#cargo).
|
||||||
|
|
||||||
|
## Data Sources
|
||||||
|
|
||||||
|
| Language | Source | Commercial Use | Delay[^1] |
|
||||||
|
|----------|-----------------------------------------------------|:--------------:|:---------:|
|
||||||
|
| PHP | [PHP Security Advisories Database][php] | ✅ | - |
|
||||||
|
| | [GitHub Advisory Database (Composer)][php-ghsa] | ✅ | - |
|
||||||
|
| Python | [GitHub Advisory Database (pip)][python-ghsa] | ✅ | - |
|
||||||
|
| | [Open Source Vulnerabilities (PyPI)][python-osv] | ✅ | - |
|
||||||
|
| Ruby | [Ruby Advisory Database][ruby] | ✅ | - |
|
||||||
|
| | [GitHub Advisory Database (RubyGems)][ruby-ghsa] | ✅ | - |
|
||||||
|
| Node.js | [Ecosystem Security Working Group][nodejs] | ✅ | - |
|
||||||
|
| | [GitHub Advisory Database (npm)][nodejs-ghsa] | ✅ | - |
|
||||||
|
| Java | [GitLab Advisories Community][gitlab] | ✅ | 1 month |
|
||||||
|
| | [GitHub Advisory Database (Maven)][java-ghsa] | ✅ | - |
|
||||||
|
| Go | [GitLab Advisories Community][gitlab] | ✅ | 1 month |
|
||||||
|
| | [The Go Vulnerability Database][go] | ✅ | - |
|
||||||
|
| Rust | [Open Source Vulnerabilities (crates.io)][rust-osv] | ✅ | - |
|
||||||
|
| .NET | [GitHub Advisory Database (NuGet)][dotnet-ghsa] | ✅ | - |
|
||||||
|
| C/C++ | [GitLab Advisories Community][gitlab] | ✅ | 1 month |
|
||||||
|
| Dart | [GitHub Advisory Database (Pub)][pub-ghsa] | ✅ | - |
|
||||||
|
| Elixir | [GitHub Advisory Database (Erlang)][erlang-ghsa] | ✅ | |
|
||||||
|
|
||||||
|
[^1]: Intentional delay between vulnerability disclosure and registration in the DB
|
||||||
|
|
||||||
|
[php-ghsa]: https://github.com/advisories?query=ecosystem%3Acomposer
|
||||||
|
[python-ghsa]: https://github.com/advisories?query=ecosystem%3Apip
|
||||||
|
[ruby-ghsa]: https://github.com/advisories?query=ecosystem%3Arubygems
|
||||||
|
[nodejs-ghsa]: https://github.com/advisories?query=ecosystem%3Anpm
|
||||||
|
[java-ghsa]: https://github.com/advisories?query=ecosystem%3Amaven
|
||||||
|
[dotnet-ghsa]: https://github.com/advisories?query=ecosystem%3Anuget
|
||||||
|
[pub-ghsa]: https://github.com/advisories?query=ecosystem%3Apub
|
||||||
|
[erlang-ghsa]: https://github.com/advisories?query=ecosystem%3Aerlang
|
||||||
|
|
||||||
|
[php]: https://github.com/FriendsOfPHP/security-advisories
|
||||||
|
[ruby]: https://github.com/rubysec/ruby-advisory-db
|
||||||
|
[nodejs]: https://github.com/nodejs/security-wg
|
||||||
|
[gitlab]: https://gitlab.com/gitlab-org/advisories-community
|
||||||
|
[go]: https://github.com/golang/vulndb
|
||||||
|
|
||||||
|
[python-osv]: https://osv.dev/list?q=&ecosystem=PyPI
|
||||||
|
[rust-osv]: https://osv.dev/list?q=&ecosystem=crates.io
|
||||||
@@ -11,14 +11,14 @@ The following table provides an outline of the features Trivy offers.
|
|||||||
| *gradle.lockfile | - | Exclude |
|
| *gradle.lockfile | - | Exclude |
|
||||||
|
|
||||||
These may be enabled or disabled depending on the target.
|
These may be enabled or disabled depending on the target.
|
||||||
See [here](../detection/language.md) for the detail.
|
See [here](./index.md) for the detail.
|
||||||
|
|
||||||
## JAR/WAR/PAR/EAR
|
## JAR/WAR/PAR/EAR
|
||||||
To find information about your JAR[^2] file, Trivy parses `pom.properties` and `MANIFEST.MF` files in your JAR[^2] file and takes required properties[^3].
|
To find information about your JAR[^2] file, Trivy parses `pom.properties` and `MANIFEST.MF` files in your JAR[^2] file and takes required properties[^3].
|
||||||
|
|
||||||
If those files don't exist or don't contain enough information - Trivy will try to find this JAR[^2] file in [trivy-java-db](https://github.com/aquasecurity/trivy-java-db).
|
If those files don't exist or don't contain enough information - Trivy will try to find this JAR[^2] file in [trivy-java-db](https://github.com/aquasecurity/trivy-java-db).
|
||||||
The Java DB will be automatically downloaded/updated when any JAR[^2] file is found.
|
The Java DB will be automatically downloaded/updated when any JAR[^2] file is found.
|
||||||
It is stored in [the cache directory](../examples/cache.md#cache-directory).
|
It is stored in [the cache directory](../../../configuration/cache.md#cache-directory).
|
||||||
|
|
||||||
!!! warning "EXPERIMENTAL"
|
!!! warning "EXPERIMENTAL"
|
||||||
Finding JARs in `trivy-java-db` is an experimental function.
|
Finding JARs in `trivy-java-db` is an experimental function.
|
||||||
@@ -26,6 +26,8 @@ It is stored in [the cache directory](../examples/cache.md#cache-directory).
|
|||||||
Base JAR[^2] may contain inner JARs[^2] within itself.
|
Base JAR[^2] may contain inner JARs[^2] within itself.
|
||||||
To find information about these JARs[^2], the same logic is used as for the base JAR[^2].
|
To find information about these JARs[^2], the same logic is used as for the base JAR[^2].
|
||||||
|
|
||||||
|
`table` format only contains the name of root JAR[^2] . To get the full path to inner JARs[^2] use the `json` format.
|
||||||
|
|
||||||
## pom.xml
|
## pom.xml
|
||||||
Trivy parses your `pom.xml` file and tries to find files with dependencies from these local locations.
|
Trivy parses your `pom.xml` file and tries to find files with dependencies from these local locations.
|
||||||
|
|
||||||
@@ -37,7 +39,7 @@ If your machine doesn't have the necessary files - Trivy tries to find the infor
|
|||||||
|
|
||||||
!!! Note
|
!!! Note
|
||||||
Trivy only takes information about packages. We don't take a list of vulnerabilities for packages from the `maven repository`.
|
Trivy only takes information about packages. We don't take a list of vulnerabilities for packages from the `maven repository`.
|
||||||
Information about data sources for Java you can see [here](../detection/data-source.md).
|
Information about data sources for Java you can see [here](./index.md#data-sources).
|
||||||
|
|
||||||
You can disable connecting to the maven repository with the `--offline-scan` flag.
|
You can disable connecting to the maven repository with the `--offline-scan` flag.
|
||||||
The `--offline-scan` flag does not affect the Trivy database.
|
The `--offline-scan` flag does not affect the Trivy database.
|
||||||
47
docs/docs/scanner/vulnerability/language/nodejs.md
Normal file
47
docs/docs/scanner/vulnerability/language/nodejs.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Node.js
|
||||||
|
|
||||||
|
Trivy supports three types of Node.js package managers: `npm`, `Yarn` and `pnpm`.
|
||||||
|
The following table provides an outline of the features Trivy offers.
|
||||||
|
|
||||||
|
| Package manager | File | Transitive dependencies | Dev dependencies | Dependency graph | Position | License |
|
||||||
|
|:---------------:|-------------------|:-----------------------:|:----------------:|:----------------:|:--------:|:-------:|
|
||||||
|
| npm | package-lock.json | ✅ | Excluded | ✅ | ✅ | ✅ |
|
||||||
|
| Yarn | yarn.lock | ✅ | Excluded | ✅ | ✅ | - |
|
||||||
|
| pnpm | pnpm-lock.yaml | ✅ | Excluded | ✅ | - | - |
|
||||||
|
|
||||||
|
In addition, Trivy scans installed packages with `package.json`.
|
||||||
|
|
||||||
|
| File | Dependency graph | Position | License |
|
||||||
|
|--------------|:----------------:|:--------:|:-------:|
|
||||||
|
| package.json | - | - | ✅ |
|
||||||
|
|
||||||
|
These may be enabled or disabled depending on the target.
|
||||||
|
See [here](./index.md) for the detail.
|
||||||
|
|
||||||
|
## Package managers
|
||||||
|
Trivy parses your files generated by package managers in filesystem/repository scanning.
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
Please make sure your lock file is up-to-date after modifying `package.json`.
|
||||||
|
|
||||||
|
### npm
|
||||||
|
Trivy parses `package-lock.json`.
|
||||||
|
To identify licenses, you need to download dependencies to `node_modules` beforehand.
|
||||||
|
Trivy analyzes `node_modules` for licenses.
|
||||||
|
|
||||||
|
### Yarn
|
||||||
|
Trivy parses `yarn.lock`, which doesn't contain information about development dependencies.
|
||||||
|
To exclude devDependencies, `package.json` also needs to be present next to `yarn.lock`.
|
||||||
|
|
||||||
|
### pnpm
|
||||||
|
Trivy parses `pnpm-lock.yaml`, then finds production dependencies and builds a [tree] of dependencies with vulnerabilities.
|
||||||
|
|
||||||
|
## Packages
|
||||||
|
Trivy parses the manifest files of installed packages in container image scanning and so on.
|
||||||
|
|
||||||
|
### package.json
|
||||||
|
Trivy searches for `package.json` files under `node_modules` and identifies installed packages.
|
||||||
|
It only extracts package names, versions and licenses for those packages.
|
||||||
|
|
||||||
|
|
||||||
|
[tree]: ../../../configuration/reporting.md#show-origins-of-vulnerable-dependencies
|
||||||
18
docs/docs/scanner/vulnerability/language/php.md
Normal file
18
docs/docs/scanner/vulnerability/language/php.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# PHP
|
||||||
|
|
||||||
|
Trivy supports [Composer][composer], which is a tool for dependency management in PHP.
|
||||||
|
The following table provides an outline of the features Trivy offers.
|
||||||
|
|
||||||
|
|
||||||
|
| Package Manager | File | Transitive dependencies | Dev dependencies | Dependency graph | Position | License |
|
||||||
|
|-----------------|---------------|:-----------------------:|:----------------:|:----------------:|:--------:|:-------:|
|
||||||
|
| Composer | composer.lock | ✅ | Excluded | ✅ | ✅ | ✅ |
|
||||||
|
|
||||||
|
## Composer
|
||||||
|
In order to detect dependencies, Trivy searches for `composer.lock`.
|
||||||
|
|
||||||
|
Trivy also supports dependency trees; however, to display an accurate tree, it needs to know whether each package is a direct dependency of the project.
|
||||||
|
Since this information is not included in `composer.lock`, Trivy parses `composer.json`, which should be located next to `composer.lock`.
|
||||||
|
If you want to see the dependency tree, please ensure that `composer.json` is present.
|
||||||
|
|
||||||
|
[composer]: https://getcomposer.org/
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
Trivy supports three types of Python package managers: `pip`, `Pipenv` and `Poetry`.
|
Trivy supports three types of Python package managers: `pip`, `Pipenv` and `Poetry`.
|
||||||
The following table provides an outline of the features Trivy offers.
|
The following table provides an outline of the features Trivy offers.
|
||||||
|
|
||||||
| Package Manager | File | Transitive dependencies | Dev dependencies | Dependency graph | Position | License |
|
| Package manager | File | Transitive dependencies | Dev dependencies | Dependency graph | Position | License |
|
||||||
|-----------------|------------------|:-----------------------:|:----------------:|:----------------:|:--------:|:-------:|
|
|-----------------|------------------|:-----------------------:|:----------------:|:----------------:|:--------:|:-------:|
|
||||||
| pip | requirements.txt | - | Include | - | - | - |
|
| pip | requirements.txt | - | Include | - | - | - |
|
||||||
| Pipenv | Pipfile.lock | ✅ | Include | - | ✅ | - |
|
| Pipenv | Pipfile.lock | ✅ | Include | - | ✅ | - |
|
||||||
@@ -17,16 +17,36 @@ In addition, Trivy supports two formats of Python packages: `egg` and `wheel`.
|
|||||||
| Wheel | ✅ |
|
| Wheel | ✅ |
|
||||||
|
|
||||||
These may be enabled or disabled depending on the target.
|
These may be enabled or disabled depending on the target.
|
||||||
See [here](../detection/language.md) for the detail.
|
See [here](./index.md) for the detail.
|
||||||
|
|
||||||
## Package managers
|
## Package managers
|
||||||
Trivy parses your files generated by package managers in filesystem/repository scanning.
|
Trivy parses your files generated by package managers in filesystem/repository scanning.
|
||||||
|
|
||||||
### pip
|
### pip
|
||||||
`requirements.txt` files contain only the direct dependencies and not contain the transitive dependencies.
|
`requirements.txt` files usually contain only the direct dependencies and not contain the transitive dependencies.
|
||||||
Therefore, Trivy scans only for the direct dependencies with `requirements.txt`.
|
Therefore, Trivy scans only for the direct dependencies with `requirements.txt`.
|
||||||
|
|
||||||
Also, `requirements.txt` files don't contain information about dependencies used for development.
|
To detect transitive dependencies as well, you need to generate `requirements.txt` with `pip freeze`.
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
$ cat requirements.txt # it will only find `requests@2.28.2`.
|
||||||
|
requests==2.28.2
|
||||||
|
$ pip install -r requirements.txt
|
||||||
|
...
|
||||||
|
|
||||||
|
$ pip freeze > requirements.txt
|
||||||
|
$ cat requirements.txt # it will also find the transitive dependencies of `requests@2.28.2`.
|
||||||
|
certifi==2022.12.7
|
||||||
|
charset-normalizer==3.1.0
|
||||||
|
idna==3.4
|
||||||
|
PyJWT==2.1.0
|
||||||
|
requests==2.28.2
|
||||||
|
urllib3==1.26.15
|
||||||
|
```
|
||||||
|
|
||||||
|
`pip freeze` also helps to resolve [extras](https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-extras)(optional) dependencies (like `package[extras]=0.0.0`).
|
||||||
|
|
||||||
|
`requirements.txt` files don't contain information about dependencies used for development.
|
||||||
Trivy could detect vulnerabilities on the development packages, which not affect your production environment.
|
Trivy could detect vulnerabilities on the development packages, which not affect your production environment.
|
||||||
|
|
||||||
License detection is not supported for `pip`.
|
License detection is not supported for `pip`.
|
||||||
31
docs/docs/scanner/vulnerability/language/rust.md
Normal file
31
docs/docs/scanner/vulnerability/language/rust.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Rust
|
||||||
|
|
||||||
|
## Features
|
||||||
|
Trivy supports [Cargo](https://doc.rust-lang.org/stable/cargo/), which is the Rust package manager.
|
||||||
|
The following table provides an outline of the features Trivy offers.
|
||||||
|
|
||||||
|
| Package manager | File | Transitive dependencies | Dev dependencies | License | Dependency graph | Position |
|
||||||
|
|-----------------|------------|:-----------------------:|:-----------------|:-------:|:----------------:|:--------:|
|
||||||
|
| Cargo | Cargo.lock | ✅ | Excluded[^1] | - | ✅ | ✅ |
|
||||||
|
|
||||||
|
In addition, it supports binaries built with [cargo-auditable](https://github.com/rust-secure-code/cargo-auditable).
|
||||||
|
|
||||||
|
| Artifact | Transitive dependencies | Dev dependencies | License | Dependency graph | Position |
|
||||||
|
|----------|:-----------------------:|:-----------------|:-------:|:----------------:|:--------:|
|
||||||
|
| Binaries | ✅ | Excluded | - | - | - |
|
||||||
|
|
||||||
|
|
||||||
|
### Cargo
|
||||||
|
Trivy searches for `Cargo.lock` to detect dependencies.
|
||||||
|
|
||||||
|
Trivy also supports dependency trees; however, to display an accurate tree, it needs to know whether each package is a direct dependency of the project.
|
||||||
|
Since this information is not included in `Cargo.lock`, Trivy parses `Cargo.toml`, which should be located next to `Cargo.lock`.
|
||||||
|
If you want to see the dependency tree, please ensure that `Cargo.toml` is present.
|
||||||
|
|
||||||
|
Scan `Cargo.lock` and `Cargo.toml` together also removes developer dependencies.
|
||||||
|
|
||||||
|
### Binaries
|
||||||
|
Trivy scans binaries built with [cargo-auditable](https://github.com/rust-secure-code/cargo-auditable).
|
||||||
|
If such a binary exists, Trivy will identify it as being built with cargo-audit and scan it.
|
||||||
|
|
||||||
|
[^1]: When you scan Cargo.lock and Cargo.toml together.
|
||||||
@@ -1,11 +1,19 @@
|
|||||||
# Supported OS
|
# OS Packages
|
||||||
|
Trivy is capable of automatically detecting installed OS packages when scanning container images, VM images and running hosts.
|
||||||
|
This page provides an overview of OS packages in the context of Trivy scans.
|
||||||
|
|
||||||
The unfixed/unfixable vulnerabilities mean that the patch has not yet been provided on their distribution. Trivy doesn't support self-compiled packages/binaries, but official packages provided by vendors such as Red Hat and Debian.
|
## Supported OS
|
||||||
|
|
||||||
|
The unfixed/unfixable vulnerabilities mean that the patch has not yet been provided on their distribution.
|
||||||
|
To hide unfixed/unfixable vulnerabilities, you can use the `--ignore-unfixed` flag.
|
||||||
|
|
||||||
|
Trivy doesn't support self-compiled packages/binaries, but official packages provided by vendors such as Red Hat and Debian.
|
||||||
|
|
||||||
| OS | Supported Versions | Target Packages | Detection of unfixed vulnerabilities |
|
| OS | Supported Versions | Target Packages | Detection of unfixed vulnerabilities |
|
||||||
|----------------------------------|-------------------------------------------|-------------------------------|:------------------------------------:|
|
|----------------------------------|-------------------------------------------|-------------------------------|:------------------------------------:|
|
||||||
| Alpine Linux | 2.2 - 2.7, 3.0 - 3.17, edge | Installed by apk | NO |
|
| Alpine Linux | 2.2 - 2.7, 3.0 - 3.17, edge | Installed by apk | NO |
|
||||||
| Wolfi Linux | (n/a) | Installed by apk | NO |
|
| Wolfi Linux | (n/a) | Installed by apk | NO |
|
||||||
|
| Chainguard | (n/a) | Installed by apk | NO |
|
||||||
| Red Hat Universal Base Image[^1] | 7, 8, 9 | Installed by yum/rpm | YES |
|
| Red Hat Universal Base Image[^1] | 7, 8, 9 | Installed by yum/rpm | YES |
|
||||||
| Red Hat Enterprise Linux | 6, 7, 8 | Installed by yum/rpm | YES |
|
| Red Hat Enterprise Linux | 6, 7, 8 | Installed by yum/rpm | YES |
|
||||||
| CentOS | 6, 7, 8 | Installed by yum/rpm | YES |
|
| CentOS | 6, 7, 8 | Installed by yum/rpm | YES |
|
||||||
@@ -13,7 +21,7 @@ The unfixed/unfixable vulnerabilities mean that the patch has not yet been provi
|
|||||||
| Rocky Linux | 8, 9 | Installed by yum/rpm | NO |
|
| Rocky Linux | 8, 9 | Installed by yum/rpm | NO |
|
||||||
| Oracle Linux | 5, 6, 7, 8 | Installed by yum/rpm | NO |
|
| Oracle Linux | 5, 6, 7, 8 | Installed by yum/rpm | NO |
|
||||||
| CBL-Mariner | 1.0, 2.0 | Installed by yum/rpm | YES |
|
| CBL-Mariner | 1.0, 2.0 | Installed by yum/rpm | YES |
|
||||||
| Amazon Linux | 1, 2, 2022 | Installed by yum/rpm | NO |
|
| Amazon Linux | 1, 2, 2023 | Installed by yum/rpm | NO |
|
||||||
| openSUSE Leap | 42, 15 | Installed by zypper/rpm | NO |
|
| openSUSE Leap | 42, 15 | Installed by zypper/rpm | NO |
|
||||||
| SUSE Enterprise Linux | 11, 12, 15 | Installed by zypper/rpm | NO |
|
| SUSE Enterprise Linux | 11, 12, 15 | Installed by zypper/rpm | NO |
|
||||||
| Photon OS | 1.0, 2.0, 3.0, 4.0 | Installed by tdnf/yum/rpm | NO |
|
| Photon OS | 1.0, 2.0, 3.0, 4.0 | Installed by tdnf/yum/rpm | NO |
|
||||||
@@ -21,17 +29,50 @@ The unfixed/unfixable vulnerabilities mean that the patch has not yet been provi
|
|||||||
| Ubuntu | All versions supported by Canonical | Installed by apt/apt-get/dpkg | YES |
|
| Ubuntu | All versions supported by Canonical | Installed by apt/apt-get/dpkg | YES |
|
||||||
| Distroless[^2] | Any | Installed by apt/apt-get/dpkg | YES |
|
| Distroless[^2] | Any | Installed by apt/apt-get/dpkg | YES |
|
||||||
|
|
||||||
|
## Data Sources
|
||||||
|
|
||||||
|
| OS | Source |
|
||||||
|
|---------------|----------------------------------------|
|
||||||
|
| Arch Linux | [Vulnerable Issues][arch] |
|
||||||
|
| Alpine Linux | [secdb][alpine] |
|
||||||
|
| Wolfi Linux | [secdb][wolfi] |
|
||||||
|
| Chainguard | [secdb][chainguard] |
|
||||||
|
| Amazon Linux | [Amazon Linux Security Center][amazon] |
|
||||||
|
| Debian | [Security Bug Tracker][debian-tracker] |
|
||||||
|
| | [OVAL][debian-oval] |
|
||||||
|
| Ubuntu | [Ubuntu CVE Tracker][ubuntu] |
|
||||||
|
| RHEL/CentOS | [OVAL][rhel-oval] |
|
||||||
|
| | [Security Data][rhel-api] |
|
||||||
|
| AlmaLinux | [AlmaLinux Product Errata][alma] |
|
||||||
|
| Rocky Linux | [Rocky Linux UpdateInfo][rocky] |
|
||||||
|
| Oracle Linux | [OVAL][oracle] |
|
||||||
|
| CBL-Mariner | [OVAL][mariner] |
|
||||||
|
| OpenSUSE/SLES | [CVRF][suse] |
|
||||||
|
| Photon OS | [Photon Security Advisory][photon] |
|
||||||
|
|
||||||
|
### Data source selection
|
||||||
|
Trivy **only** consumes security advisories from the sources listed in the above table.
|
||||||
|
|
||||||
|
As for packages installed from OS package managers (`dpkg`, `yum`, `apk`, etc.), Trivy uses the advisory database from the appropriate **OS vendor**.
|
||||||
|
|
||||||
|
For example: for a python package installed from `yum` (Amazon linux), Trivy will only get advisories from [ALAS][amazon].
|
||||||
|
But for a python package installed from another source (e.g. `pip`), Trivy will get advisories from the `GitLab` and `GitHub` databases.
|
||||||
|
|
||||||
|
This advisory selection is essential to avoid getting false positives because OS vendors usually backport upstream fixes, and the fixed version can be different from the upstream fixed version.
|
||||||
|
The severity is from the selected data source.
|
||||||
|
If the data source does not provide severity, it falls back to [NVD][nvd], and if NVD does not have severity, it will be UNKNOWN.
|
||||||
|
|
||||||
## Distributions
|
## Distributions
|
||||||
### CBL-Mariner
|
### CBL-Mariner
|
||||||
Trivy scans [CBL-Mariner][mariner].
|
Trivy scans [CBL-Mariner][cbl-mariner].
|
||||||
|
|
||||||
#### Support
|
#### Support
|
||||||
The following table provides an outline of the features Trivy offers.
|
The following table provides an outline of the features Trivy offers.
|
||||||
|
|
||||||
| Version | Container image | Virtual machine | Distroless | Multi-arch | Unfixed support |
|
| Version | Container image | Virtual machine | Distroless | Multi-arch | Unfixed support |
|
||||||
|---------|:---------------:|:---------------:|:----------:|:------------:|:---------------:|
|
|---------|:---------------:|:---------------:|:----------:|:------------:|:---------------:|
|
||||||
| 1.0 | ✔ | ✔ | ✔ | amd64, arm64 | ✔ |
|
| 1.0 | ✔ | ✔ | ✔ | amd64, arm64 | ✔ |
|
||||||
| 2.0 | ✔ | ✔ | ✔ | amd64, arm64 | ✔ |
|
| 2.0 | ✔ | ✔ | ✔ | amd64, arm64 | ✔ |
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@@ -42,9 +83,9 @@ The following table provides an outline of the features Trivy offers.
|
|||||||
2022-07-27T14:48:20.355+0600 INFO Detecting CBL-Mariner vulnerabilities...
|
2022-07-27T14:48:20.355+0600 INFO Detecting CBL-Mariner vulnerabilities...
|
||||||
2022-07-27T14:48:20.356+0600 INFO Number of language-specific files: 0
|
2022-07-27T14:48:20.356+0600 INFO Number of language-specific files: 0
|
||||||
|
|
||||||
mcr.microsoft.com/cbl-mariner/base/core:2.0 (cbl-mariner 2.0.20220527)
|
mcr.microsoft.com/cbl-mariner/base/core:2.0 (cbl-mariner 2.0.20220527)
|
||||||
|
|
||||||
Total: 33 (UNKNOWN: 0, LOW: 0, MEDIUM: 15, HIGH: 13, CRITICAL: 5)
|
Total: 33 (UNKNOWN: 0, LOW: 0, MEDIUM: 15, HIGH: 13, CRITICAL: 5)
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "rootfs"
|
=== "rootfs"
|
||||||
@@ -73,8 +114,23 @@ The following table provides an outline of the features Trivy offers.
|
|||||||
[^1]: https://developers.redhat.com/products/rhel/ubi
|
[^1]: https://developers.redhat.com/products/rhel/ubi
|
||||||
[^2]: https://github.com/GoogleContainerTools/distroless
|
[^2]: https://github.com/GoogleContainerTools/distroless
|
||||||
|
|
||||||
### Data source
|
[arch]: https://security.archlinux.org/
|
||||||
See [here][source].
|
[alpine]: https://secdb.alpinelinux.org/
|
||||||
|
[wolfi]: https://packages.wolfi.dev/os/security.json
|
||||||
|
[chainguard]: https://packages.cgr.dev/chainguard/security.json
|
||||||
|
[amazon]: https://alas.aws.amazon.com/
|
||||||
|
[debian-tracker]: https://security-tracker.debian.org/tracker/
|
||||||
|
[debian-oval]: https://www.debian.org/security/oval/
|
||||||
|
[ubuntu]: https://ubuntu.com/security/cve
|
||||||
|
[rhel-oval]: https://www.redhat.com/security/data/oval/v2/
|
||||||
|
[rhel-api]: https://www.redhat.com/security/data/metrics/
|
||||||
|
[alma]: https://errata.almalinux.org/
|
||||||
|
[rocky]: https://download.rockylinux.org/pub/rocky/
|
||||||
|
[oracle]: https://linux.oracle.com/security/oval/
|
||||||
|
[suse]: http://ftp.suse.com/pub/projects/security/cvrf/
|
||||||
|
[photon]: https://packages.vmware.com/photon/photon_cve_metadata/
|
||||||
|
[mariner]: https://github.com/microsoft/CBL-MarinerVulnerabilityData/
|
||||||
|
|
||||||
[mariner]: https://github.com/microsoft/CBL-Mariner
|
[cbl-mariner]: https://github.com/microsoft/CBL-Mariner
|
||||||
[source]: data-source.md
|
|
||||||
|
[nvd]: https://nvd.nist.gov/
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
# Configuration
|
|
||||||
Trivy tries to load `trivy-secret.yaml` in the current directory by default.
|
|
||||||
If the file doesn't exist, only built-in rules are used.
|
|
||||||
You can customize the config file path via the `--secret-config` flag.
|
|
||||||
|
|
||||||
You can see the example [here][examples].
|
|
||||||
|
|
||||||
## Custom Rules
|
|
||||||
Trivy allows defining custom rules. You can see an example.
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
rules:
|
|
||||||
- id: rule1
|
|
||||||
category: general
|
|
||||||
title: Generic Rule
|
|
||||||
severity: HIGH
|
|
||||||
path: .*\.sh
|
|
||||||
keywords:
|
|
||||||
- secret
|
|
||||||
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
|
||||||
secret-group-name: secret
|
|
||||||
allow-rules:
|
|
||||||
- id: skip-text
|
|
||||||
description: skip text files
|
|
||||||
path: .*\.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
`id` (required)
|
|
||||||
: - Unique identifier for this rule.
|
|
||||||
|
|
||||||
`category` (required)
|
|
||||||
: - String used for metadata and reporting purposes.
|
|
||||||
|
|
||||||
`title` (required)
|
|
||||||
: - Short human-readable title of the rule.
|
|
||||||
|
|
||||||
`severity` (required)
|
|
||||||
: - How critical this rule is.
|
|
||||||
- Allowed values:
|
|
||||||
- CRITICAL
|
|
||||||
- HIGH
|
|
||||||
- MEDIUM
|
|
||||||
- LOW
|
|
||||||
|
|
||||||
`regex` (required)
|
|
||||||
: - Golang regular expression used to detect secrets.
|
|
||||||
|
|
||||||
`path` (optional)
|
|
||||||
: - Golang regular expression used to match paths.
|
|
||||||
|
|
||||||
`keywords` (optional, recommended)
|
|
||||||
: - Keywords are used for pre-regex check filtering.
|
|
||||||
- Rules that contain keywords will perform a quick string compare check to make sure the keyword(s) are in the content being scanned.
|
|
||||||
- Ideally these values should either be part of the identifier or unique strings specific to the rule's regex.
|
|
||||||
- It is recommended to define for better performance.
|
|
||||||
|
|
||||||
`allow-rules` (optional)
|
|
||||||
: - Allow rules for a single rule to reduce false positives with known secrets.
|
|
||||||
- The details are below.
|
|
||||||
|
|
||||||
## Allow Rules
|
|
||||||
If the detected secret is matched with the specified `regex`, then that secret will be skipped and not detected.
|
|
||||||
The same logic applies for `path`.
|
|
||||||
|
|
||||||
`allow-rules` can be defined globally and per each rule. The fields are the same.
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
rules:
|
|
||||||
- id: rule1
|
|
||||||
category: general
|
|
||||||
title: Generic Rule
|
|
||||||
severity: HIGH
|
|
||||||
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
|
||||||
allow-rules:
|
|
||||||
- id: skip-text
|
|
||||||
description: skip text files
|
|
||||||
path: .*\.txt
|
|
||||||
allow-rules:
|
|
||||||
- id: social-security-number
|
|
||||||
description: skip social security number
|
|
||||||
regex: 219-09-9999
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
`id` (required)
|
|
||||||
: - Unique identifier for this allow rule.
|
|
||||||
|
|
||||||
`description` (optional)
|
|
||||||
: - Short human-readable description of this allow rule.
|
|
||||||
|
|
||||||
`regex` (optional)
|
|
||||||
: - Golang regular expression used to allow detected secrets.
|
|
||||||
- `regex` or `path` must be specified.
|
|
||||||
|
|
||||||
`path` (optional)
|
|
||||||
: - Golang regular expression used to allow matched paths.
|
|
||||||
- `regex` or `path` must be specified.
|
|
||||||
|
|
||||||
## Enable Rules
|
|
||||||
Trivy provides plenty of out-of-box rules and allow rules, but you may not need all of them.
|
|
||||||
In that case, `enable-builtin-rules` will be helpful.
|
|
||||||
If you just need AWS secret detection, you can enable only relevant rules as shown below.
|
|
||||||
It specifies AWS-related rule IDs in `enable-builtin-rules`.
|
|
||||||
All other rules are disabled, so the scanning will be much faster.
|
|
||||||
We would strongly recommend using this option if you don't need all rules.
|
|
||||||
|
|
||||||
You can see a full list of [built-in rule IDs][builtin] and [built-in allow rule IDs][builtin-allow].
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
enable-builtin-rules:
|
|
||||||
- aws-access-key-id
|
|
||||||
- aws-account-id
|
|
||||||
- aws-secret-access-key
|
|
||||||
```
|
|
||||||
|
|
||||||
## Disable Rules
|
|
||||||
Trivy offers built-in rules and allow rules, but you may want to disable some of them.
|
|
||||||
For example, you don't use Slack, so Slack doesn't have to be scanned.
|
|
||||||
You can specify the Slack rule IDs, `slack-access-token` and `slack-web-hook` in `disable-rules` so that those rules will be disabled for less false positives.
|
|
||||||
|
|
||||||
You should specify either `enable-builtin-rules` or `disable-rules`.
|
|
||||||
If they both are specified, `disable-rules` takes precedence.
|
|
||||||
In case `github-pat` is specified in `enable-builtin-rules` and `disable-rules`, it will be disabled.
|
|
||||||
|
|
||||||
In addition, there are some allow rules.
|
|
||||||
Markdown files are ignored by default, but you may want to scan markdown files as well.
|
|
||||||
You can disable the allow rule by adding `markdown` to `disable-allow-rules`.
|
|
||||||
|
|
||||||
You can see a full list of [built-in rule IDs][builtin] and [built-in allow rule IDs][builtin-allow].
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
disable-rules:
|
|
||||||
- slack-access-token
|
|
||||||
- slack-web-hook
|
|
||||||
disable-allow-rules:
|
|
||||||
- markdown
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
[builtin]: https://github.com/aquasecurity/trivy/blob/main/pkg/fanal/secret/builtin-rules.go
|
|
||||||
[builtin-allow]: https://github.com/aquasecurity/trivy/blob/main/pkg/fanal/secret/builtin-allow-rules.go
|
|
||||||
[examples]: ./examples.md
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
# Examples
|
|
||||||
Also see [quick start][quick-start].
|
|
||||||
|
|
||||||
## Skip Directories
|
|
||||||
Trivy traversals directories and scans all files except those matching the built-in allow rules by default.
|
|
||||||
If your have a lot of files in your container image or project, the scanning takes time.
|
|
||||||
To make it faster, you can skip traversal in the specific directory.
|
|
||||||
Also, it would be helpful if your project contains secrets and certificates for testing.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ trivy image --skip-dirs /var/lib --skip-dirs /var/log YOUR_IMAGE
|
|
||||||
```
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ trivy fs --skip-dirs ./my-test-dir --skip-dirs ./my-testing-cert/ /path/to/your_project
|
|
||||||
```
|
|
||||||
|
|
||||||
`--skip-files` also works similarly.
|
|
||||||
|
|
||||||
## Filter by severity
|
|
||||||
|
|
||||||
Use `--severity` option.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ trivy fs --severity CRITICAL ./
|
|
||||||
|
|
||||||
app/secret.sh (secrets)
|
|
||||||
=======================
|
|
||||||
Total: 1 (CRITICAL: 1)
|
|
||||||
|
|
||||||
+----------+-------------------+----------+---------+--------------------------------+
|
|
||||||
| CATEGORY | DESCRIPTION | SEVERITY | LINE NO | MATCH |
|
|
||||||
+----------+-------------------+----------+---------+--------------------------------+
|
|
||||||
| AWS | AWS Access Key ID | CRITICAL | 10 | export AWS_ACCESS_KEY_ID=***** |
|
|
||||||
+----------+-------------------+----------+---------+--------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
## Filter by RuleID
|
|
||||||
|
|
||||||
Use `.trivyignore`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ cat .trivyignore
|
|
||||||
|
|
||||||
# Ignore these rules
|
|
||||||
generic-unwanted-rule
|
|
||||||
aws-account-id
|
|
||||||
```
|
|
||||||
|
|
||||||
## Disable secret scanning
|
|
||||||
If you need vulnerability scanning only, you can disable secret scanning via the `--scanners` flag.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ trivy image --scanners vuln alpine:3.15
|
|
||||||
```
|
|
||||||
|
|
||||||
## With configuration file
|
|
||||||
`trivy-secret.yaml` in the working directory is loaded by default.
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
$ cat trivy-secret.yaml
|
|
||||||
rules:
|
|
||||||
- id: rule1
|
|
||||||
category: general
|
|
||||||
title: Generic Rule
|
|
||||||
severity: HIGH
|
|
||||||
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
|
||||||
allow-rules:
|
|
||||||
- id: social-security-number
|
|
||||||
description: skip social security number
|
|
||||||
regex: 219-09-9999
|
|
||||||
- id: log-dir
|
|
||||||
description: skip log directory
|
|
||||||
path: ^\/var\/log\/
|
|
||||||
disable-rules:
|
|
||||||
- slack-access-token
|
|
||||||
- slack-web-hook
|
|
||||||
disable-allow-rules:
|
|
||||||
- markdown
|
|
||||||
|
|
||||||
# The following command automatically loads the above configuration.
|
|
||||||
$ trivy image YOUR_IMAGE
|
|
||||||
```
|
|
||||||
|
|
||||||
Also, you can customize the config file path via `--secret-config`.
|
|
||||||
|
|
||||||
``` yaml
|
|
||||||
$ cat ./secret-config/trivy.yaml
|
|
||||||
rules:
|
|
||||||
- id: rule1
|
|
||||||
category: general
|
|
||||||
title: Generic Rule
|
|
||||||
severity: HIGH
|
|
||||||
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"]
|
|
||||||
allow-rules:
|
|
||||||
- id: skip-text
|
|
||||||
description: skip text files
|
|
||||||
path: .*\.txt
|
|
||||||
enable-builtin-rules:
|
|
||||||
- aws-access-key-id
|
|
||||||
- aws-account-id
|
|
||||||
- aws-secret-access-key
|
|
||||||
disable-allow-rules:
|
|
||||||
- usr-dirs
|
|
||||||
|
|
||||||
# Pass the above config with `--secret-config`.
|
|
||||||
$ trivy fs --secret-config ./secret-config/trivy.yaml /path/to/your_project
|
|
||||||
```
|
|
||||||
|
|
||||||
[quick-start]: ./scanning.md#quick-start
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
# Secret Scanning
|
|
||||||
|
|
||||||
Trivy scans any container image, filesystem and git repository to detect exposed secrets like passwords, api keys, and tokens.
|
|
||||||
Secret scanning is enabled by default.
|
|
||||||
|
|
||||||
Trivy will scan every plaintext file, according to builtin rules or configuration. There are plenty of builtin rules:
|
|
||||||
|
|
||||||
- AWS access key
|
|
||||||
- GCP service account
|
|
||||||
- GitHub personal access token
|
|
||||||
- GitLab personal access token
|
|
||||||
- Slack access token
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
You can see a full list of [built-in rules][builtin] and [built-in allow rules][builtin-allow].
|
|
||||||
|
|
||||||
!!! tip
|
|
||||||
If your secret is not detected properly, please make sure that your file including the secret is not in [the allowed paths][builtin-allow].
|
|
||||||
You can disable allow rules via [disable-allow-rules][disable-rules].
|
|
||||||
|
|
||||||
## Quick start
|
|
||||||
This section shows how to scan secrets in container image and filesystem. Other subcommands should be the same.
|
|
||||||
|
|
||||||
### Container image
|
|
||||||
Specify an image name.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ trivy image myimage:1.0.0
|
|
||||||
2022-04-21T18:56:44.099+0300 INFO Detected OS: alpine
|
|
||||||
2022-04-21T18:56:44.099+0300 INFO Detecting Alpine vulnerabilities...
|
|
||||||
2022-04-21T18:56:44.101+0300 INFO Number of language-specific files: 0
|
|
||||||
|
|
||||||
myimage:1.0.0 (alpine 3.15.0)
|
|
||||||
=============================
|
|
||||||
Total: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 2)
|
|
||||||
|
|
||||||
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|
|
||||||
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
|
|
||||||
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|
|
||||||
| busybox | CVE-2022-28391 | CRITICAL | 1.34.1-r3 | 1.34.1-r5 | CVE-2022-28391 affecting |
|
|
||||||
| | | | | | package busybox 1.35.0 |
|
|
||||||
| | | | | | -->avd.aquasec.com/nvd/cve-2022-28391 |
|
|
||||||
+--------------+------------------| |-------------------+---------------+---------------------------------------+
|
|
||||||
| ssl_client | CVE-2022-28391 | | 1.34.1-r3 | 1.34.1-r5 | CVE-2022-28391 affecting |
|
|
||||||
| | | | | | package busybox 1.35.0 |
|
|
||||||
| | | | | | -->avd.aquasec.com/nvd/cve-2022-28391 |
|
|
||||||
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|
|
||||||
|
|
||||||
app/secret.sh (secrets)
|
|
||||||
=======================
|
|
||||||
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 1)
|
|
||||||
|
|
||||||
+----------+-------------------+----------+---------+--------------------------------+
|
|
||||||
| CATEGORY | DESCRIPTION | SEVERITY | LINE NO | MATCH |
|
|
||||||
+----------+-------------------+----------+---------+--------------------------------+
|
|
||||||
| AWS | AWS Access Key ID | CRITICAL | 10 | export AWS_ACCESS_KEY_ID=***** |
|
|
||||||
+----------+-------------------+----------+---------+--------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
!!! tip
|
|
||||||
Trivy tries to detect a base image and skip those layers for secret scanning.
|
|
||||||
A base image usually contains a lot of files and makes secret scanning much slower.
|
|
||||||
If a secret is not detected properly, you can see base layers with the `--debug` flag.
|
|
||||||
|
|
||||||
### Filesystem
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
$ trivy fs /path/to/your_project
|
|
||||||
...(snip)...
|
|
||||||
|
|
||||||
certs/key.pem (secrets)
|
|
||||||
========================
|
|
||||||
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)
|
|
||||||
|
|
||||||
+----------------------+------------------------+----------+---------+---------------------------------+
|
|
||||||
| CATEGORY | DESCRIPTION | SEVERITY | LINE NO | MATCH |
|
|
||||||
+----------------------+------------------------+----------+---------+---------------------------------+
|
|
||||||
| AsymmetricPrivateKey | Asymmetric Private Key | HIGH | 1 | -----BEGIN RSA PRIVATE KEY----- |
|
|
||||||
+----------------------+------------------------+----------+---------+---------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
!!! tip
|
|
||||||
Your project may have some secrets for testing. You can skip them with `--skip-dirs` or `--skip-files`.
|
|
||||||
We would recommend specifying these options so that the secret scanning can be faster if those files don't need to be scanned.
|
|
||||||
Also, you can specify paths to be allowed in a configuration file. See the detail [here][configuration].
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
Trivy has a set of builtin rules for secret scanning, which can be extended or modified by a configuration file.
|
|
||||||
|
|
||||||
|
|
||||||
## Recommendation
|
|
||||||
We would recommend specifying `--skip-dirs` for faster secret scanning.
|
|
||||||
In container image scanning, Trivy walks the file tree rooted `/` and scans all the files other than [built-in allowed paths][builtin-allow].
|
|
||||||
It will take a while if your image contains a lot of files even though Trivy tries to avoid scanning layers from a base image.
|
|
||||||
If you want to make scanning faster, `--skip-dirs` and `--skip-files` helps so that Trivy will skip scanning those files and directories.
|
|
||||||
The usage examples are [here][examples].
|
|
||||||
|
|
||||||
`allow-rules` is also helpful. See the [allow-rules][allow-rules] section.
|
|
||||||
|
|
||||||
In addition, all the built-in rules are enabled by default, so it takes some time to scan all of them.
|
|
||||||
If you don't need all those rules, you can use `enable-builtin-rules` or `disable-rules` in the configuration file.
|
|
||||||
You should use `enable-builtin-rules` if you need only AWS secret detection, for example.
|
|
||||||
All rules are disabled except for the ones you specify, so it runs very fast.
|
|
||||||
On the other hand, you should use `disable-rules` if you just want to disable some built-in rules.
|
|
||||||
See the [enable-rules][enable-rules] and [disable-rules][disable-rules] sections for the detail.
|
|
||||||
|
|
||||||
If you don't need secret scanning, you can disable it via the `--scanners` flag.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ trivy image --scanners vuln alpine:3.15
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Credit
|
|
||||||
This feature is inspired by [gitleaks][gitleaks].
|
|
||||||
|
|
||||||
[builtin]: https://github.com/aquasecurity/trivy/blob/main/pkg/fanal/secret/builtin-rules.go
|
|
||||||
[builtin-allow]: https://github.com/aquasecurity/trivy/blob/main/pkg/fanal/secret/builtin-allow-rules.go
|
|
||||||
[configuration]: ./configuration.md
|
|
||||||
[allow-rules]: ./configuration.md#allow-rules
|
|
||||||
[enable-rules]: ./configuration.md#enable-rules
|
|
||||||
[disable-rules]: ./configuration.md#disable-rules
|
|
||||||
[examples]: ./examples.md
|
|
||||||
[gitleaks]: https://github.com/zricethezav/gitleaks
|
|
||||||
748
docs/docs/supply-chain/sbom.md
Normal file
748
docs/docs/supply-chain/sbom.md
Normal file
@@ -0,0 +1,748 @@
|
|||||||
|
# SBOM generation
|
||||||
|
|
||||||
|
Trivy can generate the following SBOM formats.
|
||||||
|
|
||||||
|
- [CycloneDX](#cyclonedx)
|
||||||
|
- [SPDX](#spdx)
|
||||||
|
|
||||||
|
## CLI commands
|
||||||
|
To generate SBOM, you can use the `--format` option for each subcommand such as `image`, `fs` and `vm`.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy image --format spdx-json --output result.json alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy fs --format cyclonedx --output result.json /app/myproject
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Result</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"bomFormat": "CycloneDX",
|
||||||
|
"specVersion": "1.3",
|
||||||
|
"serialNumber": "urn:uuid:2be5773d-7cd3-4b4b-90a5-e165474ddace",
|
||||||
|
"version": 1,
|
||||||
|
"metadata": {
|
||||||
|
"timestamp": "2022-02-22T15:11:40.270597Z",
|
||||||
|
"tools": [
|
||||||
|
{
|
||||||
|
"vendor": "aquasecurity",
|
||||||
|
"name": "trivy",
|
||||||
|
"version": "dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": {
|
||||||
|
"bom-ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||||
|
"type": "container",
|
||||||
|
"name": "alpine:3.15",
|
||||||
|
"version": "",
|
||||||
|
"purl": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SchemaVersion",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:ImageID",
|
||||||
|
"value": "sha256:c059bfaa849c4d8e4aecaeb3a10c2d9b3d85f5165c66ad3a4d937758128c4d18"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:RepoDigest",
|
||||||
|
"value": "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:DiffID",
|
||||||
|
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:RepoTag",
|
||||||
|
"value": "alpine:3.15"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"bom-ref": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||||
|
"type": "library",
|
||||||
|
"name": "alpine-baselayout",
|
||||||
|
"version": "3.2.0-r18",
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"expression": "GPL-2.0-only"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"purl": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcName",
|
||||||
|
"value": "alpine-baselayout"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcVersion",
|
||||||
|
"value": "3.2.0-r18"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDigest",
|
||||||
|
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDiffID",
|
||||||
|
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...(snip)...
|
||||||
|
{
|
||||||
|
"bom-ref": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
||||||
|
"type": "library",
|
||||||
|
"name": "zlib",
|
||||||
|
"version": "1.2.11-r3",
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"expression": "Zlib"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"purl": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcName",
|
||||||
|
"value": "zlib"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcVersion",
|
||||||
|
"value": "1.2.11-r3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDigest",
|
||||||
|
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDiffID",
|
||||||
|
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bom-ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
||||||
|
"type": "operating-system",
|
||||||
|
"name": "alpine",
|
||||||
|
"version": "3.15.0",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:Type",
|
||||||
|
"value": "alpine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:Class",
|
||||||
|
"value": "os-pkgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": [
|
||||||
|
{
|
||||||
|
"ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
||||||
|
"dependsOn": [
|
||||||
|
"pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/alpine-keys@2.4-r1?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/apk-tools@2.12.7-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/busybox@1.34.1-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/ca-certificates-bundle@20191127-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libc-utils@0.7.2-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libcrypto1.1@1.1.1l-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libretls@3.3.4-r2?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libssl1.1@1.1.1l-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/musl@1.2.2-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/musl-utils@1.2.2-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/scanelf@1.3.3-r0?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/ssl_client@1.34.1-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||||
|
"dependsOn": [
|
||||||
|
"3da6a469-964d-4b4e-b67d-e94ec7c88d37"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Supported packages
|
||||||
|
Trivy supports the following packages.
|
||||||
|
|
||||||
|
- [OS packages][os_packages]
|
||||||
|
- [Language-specific packages][language_packages]
|
||||||
|
|
||||||
|
In addition to the above packages, Trivy also supports the following packages for generating SBOM.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
These packages are not supported for vulnerability scanning.
|
||||||
|
|
||||||
|
| Language | File | Dependency location[^1] |
|
||||||
|
|----------|-------------------|:-----------------------:|
|
||||||
|
| Python | conda package[^2] | - |
|
||||||
|
| Swift | Podfile.lock | - |
|
||||||
|
|
||||||
|
[^1]: Use `startline == 1 and endline == 1` for unsupported file types
|
||||||
|
[^2]: `envs/*/conda-meta/*.json`
|
||||||
|
|
||||||
|
## Formats
|
||||||
|
### CycloneDX
|
||||||
|
Trivy can generate SBOM in the [CycloneDX][cyclonedx] format.
|
||||||
|
Note that XML format is not supported at the moment.
|
||||||
|
|
||||||
|
You can use the regular subcommands (like `image`, `fs` and `rootfs`) and specify `cyclonedx` with the `--format` option.
|
||||||
|
|
||||||
|
CycloneDX can represent either or both SBOM or BOV.
|
||||||
|
|
||||||
|
- [Software Bill of Materials (SBOM)][sbom]
|
||||||
|
- [Bill of Vulnerabilities (BOV)][bov]
|
||||||
|
|
||||||
|
By default, `--format cyclonedx` represents SBOM and doesn't include vulnerabilities in the CycloneDX output.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy image --format cyclonedx --output result.json alpine:3.15
|
||||||
|
2022-07-19T07:47:27.624Z INFO "--format cyclonedx" disables security scanning. Specify "--scanners vuln" explicitly if you want to include vulnerabilities in the CycloneDX report.
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Result</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cat result.json | jq .
|
||||||
|
{
|
||||||
|
"bomFormat": "CycloneDX",
|
||||||
|
"specVersion": "1.4",
|
||||||
|
"serialNumber": "urn:uuid:2be5773d-7cd3-4b4b-90a5-e165474ddace",
|
||||||
|
"version": 1,
|
||||||
|
"metadata": {
|
||||||
|
"timestamp": "2022-02-22T15:11:40.270597Z",
|
||||||
|
"tools": [
|
||||||
|
{
|
||||||
|
"vendor": "aquasecurity",
|
||||||
|
"name": "trivy",
|
||||||
|
"version": "dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"component": {
|
||||||
|
"bom-ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||||
|
"type": "container",
|
||||||
|
"name": "alpine:3.15",
|
||||||
|
"version": "",
|
||||||
|
"purl": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SchemaVersion",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:ImageID",
|
||||||
|
"value": "sha256:c059bfaa849c4d8e4aecaeb3a10c2d9b3d85f5165c66ad3a4d937758128c4d18"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:RepoDigest",
|
||||||
|
"value": "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:DiffID",
|
||||||
|
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:RepoTag",
|
||||||
|
"value": "alpine:3.15"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"bom-ref": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||||
|
"type": "library",
|
||||||
|
"name": "alpine-baselayout",
|
||||||
|
"version": "3.2.0-r18",
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"expression": "GPL-2.0-only"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"purl": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcName",
|
||||||
|
"value": "alpine-baselayout"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcVersion",
|
||||||
|
"value": "3.2.0-r18"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDigest",
|
||||||
|
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDiffID",
|
||||||
|
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...(snip)...
|
||||||
|
{
|
||||||
|
"bom-ref": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
||||||
|
"type": "library",
|
||||||
|
"name": "zlib",
|
||||||
|
"version": "1.2.11-r3",
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"expression": "Zlib"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"purl": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcName",
|
||||||
|
"value": "zlib"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:SrcVersion",
|
||||||
|
"value": "1.2.11-r3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDigest",
|
||||||
|
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:LayerDiffID",
|
||||||
|
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bom-ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
||||||
|
"type": "operating-system",
|
||||||
|
"name": "alpine",
|
||||||
|
"version": "3.15.0",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:Type",
|
||||||
|
"value": "alpine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aquasecurity:trivy:Class",
|
||||||
|
"value": "os-pkgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": [
|
||||||
|
{
|
||||||
|
"ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
||||||
|
"dependsOn": [
|
||||||
|
"pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/alpine-keys@2.4-r1?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/apk-tools@2.12.7-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/busybox@1.34.1-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/ca-certificates-bundle@20191127-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libc-utils@0.7.2-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libcrypto1.1@1.1.1l-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libretls@3.3.4-r2?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/libssl1.1@1.1.1l-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/musl@1.2.2-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/musl-utils@1.2.2-r7?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/scanelf@1.3.3-r0?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/ssl_client@1.34.1-r3?distro=3.15.0",
|
||||||
|
"pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||||
|
"dependsOn": [
|
||||||
|
"3da6a469-964d-4b4e-b67d-e94ec7c88d37"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vulnerabilities": [
|
||||||
|
{
|
||||||
|
"id": "CVE-2021-42386",
|
||||||
|
"source": {
|
||||||
|
"name": "alpine",
|
||||||
|
"url": "https://secdb.alpinelinux.org/"
|
||||||
|
},
|
||||||
|
"ratings": [
|
||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"name": "nvd"
|
||||||
|
},
|
||||||
|
"score": 7.2,
|
||||||
|
"severity": "high",
|
||||||
|
"method": "CVSSv31",
|
||||||
|
"vector": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"name": "nvd"
|
||||||
|
},
|
||||||
|
"score": 6.5,
|
||||||
|
"severity": "medium",
|
||||||
|
"method": "CVSSv2",
|
||||||
|
"vector": "AV:N/AC:L/Au:S/C:P/I:P/A:P"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": {
|
||||||
|
"name": "redhat"
|
||||||
|
},
|
||||||
|
"score": 6.6,
|
||||||
|
"severity": "medium",
|
||||||
|
"method": "CVSSv31",
|
||||||
|
"vector": "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cwes": [
|
||||||
|
416
|
||||||
|
],
|
||||||
|
"description": "A use-after-free in Busybox's awk applet leads to denial of service and possibly code execution when processing a crafted awk pattern in the nvalloc function",
|
||||||
|
"advisories": [
|
||||||
|
{
|
||||||
|
"url": "https://access.redhat.com/security/cve/CVE-2021-42386"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42386"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"published": "2021-11-15 21:15:00 +0000 UTC",
|
||||||
|
"updated": "2022-01-04 17:14:00 +0000 UTC",
|
||||||
|
"affects": [
|
||||||
|
{
|
||||||
|
"ref": "pkg:apk/alpine/busybox@1.33.1-r3?distro=3.14.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ref": "pkg:apk/alpine/ssl_client@1.33.1-r3?distro=3.14.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
If you want to include vulnerabilities, you can enable vulnerability scanning via `--scanners vuln`.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy image --scanners vuln --format cyclonedx --output result.json alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
### SPDX
|
||||||
|
Trivy can generate SBOM in the [SPDX][spdx] format.
|
||||||
|
|
||||||
|
You can use the regular subcommands (like `image`, `fs` and `rootfs`) and specify `spdx` with the `--format` option.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy image --format spdx --output result.spdx alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Result</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cat result.spdx
|
||||||
|
SPDXVersion: SPDX-2.2
|
||||||
|
DataLicense: CC0-1.0
|
||||||
|
SPDXID: SPDXRef-DOCUMENT
|
||||||
|
DocumentName: alpine:3.15
|
||||||
|
DocumentNamespace: https://aquasecurity.github.io/trivy/container_image/alpine:3.15-bebf6b19-a94c-4e2c-af44-065f63923f48
|
||||||
|
Creator: Organization: aquasecurity
|
||||||
|
Creator: Tool: trivy-0.38.1
|
||||||
|
Created: 2022-04-28T07:32:57.142806Z
|
||||||
|
|
||||||
|
##### Package: zlib
|
||||||
|
|
||||||
|
PackageName: zlib
|
||||||
|
SPDXID: SPDXRef-12bc938ac028a5e1
|
||||||
|
PackageVersion: 1.2.12-r0
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: Zlib
|
||||||
|
PackageLicenseDeclared: Zlib
|
||||||
|
|
||||||
|
##### Package: apk-tools
|
||||||
|
|
||||||
|
PackageName: apk-tools
|
||||||
|
SPDXID: SPDXRef-26c274652190d87f
|
||||||
|
PackageVersion: 2.12.7-r3
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: GPL-2.0-only
|
||||||
|
PackageLicenseDeclared: GPL-2.0-only
|
||||||
|
|
||||||
|
##### Package: libretls
|
||||||
|
|
||||||
|
PackageName: libretls
|
||||||
|
SPDXID: SPDXRef-2b021966d19a8211
|
||||||
|
PackageVersion: 3.3.4-r3
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: ISC AND (BSD-3-Clause OR MIT)
|
||||||
|
PackageLicenseDeclared: ISC AND (BSD-3-Clause OR MIT)
|
||||||
|
|
||||||
|
##### Package: busybox
|
||||||
|
|
||||||
|
PackageName: busybox
|
||||||
|
SPDXID: SPDXRef-317ce3476703f20d
|
||||||
|
PackageVersion: 1.34.1-r5
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: GPL-2.0-only
|
||||||
|
PackageLicenseDeclared: GPL-2.0-only
|
||||||
|
|
||||||
|
##### Package: libcrypto1.1
|
||||||
|
|
||||||
|
PackageName: libcrypto1.1
|
||||||
|
SPDXID: SPDXRef-34f407fb4dbd67f4
|
||||||
|
PackageVersion: 1.1.1n-r0
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: OpenSSL
|
||||||
|
PackageLicenseDeclared: OpenSSL
|
||||||
|
|
||||||
|
##### Package: libc-utils
|
||||||
|
|
||||||
|
PackageName: libc-utils
|
||||||
|
SPDXID: SPDXRef-4bbc1cb449d54083
|
||||||
|
PackageVersion: 0.7.2-r3
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: BSD-2-Clause AND BSD-3-Clause
|
||||||
|
PackageLicenseDeclared: BSD-2-Clause AND BSD-3-Clause
|
||||||
|
|
||||||
|
##### Package: alpine-keys
|
||||||
|
|
||||||
|
PackageName: alpine-keys
|
||||||
|
SPDXID: SPDXRef-a3bdd174be1456b6
|
||||||
|
PackageVersion: 2.4-r1
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: MIT
|
||||||
|
PackageLicenseDeclared: MIT
|
||||||
|
|
||||||
|
##### Package: ca-certificates-bundle
|
||||||
|
|
||||||
|
PackageName: ca-certificates-bundle
|
||||||
|
SPDXID: SPDXRef-ac6472ba26fb991c
|
||||||
|
PackageVersion: 20211220-r0
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: MPL-2.0 AND MIT
|
||||||
|
PackageLicenseDeclared: MPL-2.0 AND MIT
|
||||||
|
|
||||||
|
##### Package: libssl1.1
|
||||||
|
|
||||||
|
PackageName: libssl1.1
|
||||||
|
SPDXID: SPDXRef-b2d1b1d70fe90f7d
|
||||||
|
PackageVersion: 1.1.1n-r0
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: OpenSSL
|
||||||
|
PackageLicenseDeclared: OpenSSL
|
||||||
|
|
||||||
|
##### Package: scanelf
|
||||||
|
|
||||||
|
PackageName: scanelf
|
||||||
|
SPDXID: SPDXRef-c617077ba6649520
|
||||||
|
PackageVersion: 1.3.3-r0
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: GPL-2.0-only
|
||||||
|
PackageLicenseDeclared: GPL-2.0-only
|
||||||
|
|
||||||
|
##### Package: musl
|
||||||
|
|
||||||
|
PackageName: musl
|
||||||
|
SPDXID: SPDXRef-ca80b810029cde0e
|
||||||
|
PackageVersion: 1.2.2-r7
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: MIT
|
||||||
|
PackageLicenseDeclared: MIT
|
||||||
|
|
||||||
|
##### Package: alpine-baselayout
|
||||||
|
|
||||||
|
PackageName: alpine-baselayout
|
||||||
|
SPDXID: SPDXRef-d782e64751ba9faa
|
||||||
|
PackageVersion: 3.2.0-r18
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: GPL-2.0-only
|
||||||
|
PackageLicenseDeclared: GPL-2.0-only
|
||||||
|
|
||||||
|
##### Package: musl-utils
|
||||||
|
|
||||||
|
PackageName: musl-utils
|
||||||
|
SPDXID: SPDXRef-e5e8a237f6162e22
|
||||||
|
PackageVersion: 1.2.2-r7
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: MIT BSD GPL2+
|
||||||
|
PackageLicenseDeclared: MIT BSD GPL2+
|
||||||
|
|
||||||
|
##### Package: ssl_client
|
||||||
|
|
||||||
|
PackageName: ssl_client
|
||||||
|
SPDXID: SPDXRef-fdf0ce84f6337be4
|
||||||
|
PackageVersion: 1.34.1-r5
|
||||||
|
FilesAnalyzed: false
|
||||||
|
PackageLicenseConcluded: GPL-2.0-only
|
||||||
|
PackageLicenseDeclared: GPL-2.0-only
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
SPDX-JSON format is also supported by using `spdx-json` with the `--format` option.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy image --format spdx-json --output result.spdx.json alpine:3.15
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Result</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cat result.spdx.json | jq .
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-DOCUMENT",
|
||||||
|
"creationInfo": {
|
||||||
|
"created": "2022-04-28T08:16:55.328255Z",
|
||||||
|
"creators": [
|
||||||
|
"Tool: trivy-0.38.1",
|
||||||
|
"Organization: aquasecurity"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dataLicense": "CC0-1.0",
|
||||||
|
"documentNamespace": "http://aquasecurity.github.io/trivy/container_image/alpine:3.15-d9549e3a-a4c5-4ee3-8bde-8c78d451fbe7",
|
||||||
|
"name": "alpine:3.15",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-12bc938ac028a5e1",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "Zlib",
|
||||||
|
"licenseDeclared": "Zlib",
|
||||||
|
"name": "zlib",
|
||||||
|
"versionInfo": "1.2.12-r0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-26c274652190d87f",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "GPL-2.0-only",
|
||||||
|
"licenseDeclared": "GPL-2.0-only",
|
||||||
|
"name": "apk-tools",
|
||||||
|
"versionInfo": "2.12.7-r3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-2b021966d19a8211",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "ISC AND (BSD-3-Clause OR MIT)",
|
||||||
|
"licenseDeclared": "ISC AND (BSD-3-Clause OR MIT)",
|
||||||
|
"name": "libretls",
|
||||||
|
"versionInfo": "3.3.4-r3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-317ce3476703f20d",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "GPL-2.0-only",
|
||||||
|
"licenseDeclared": "GPL-2.0-only",
|
||||||
|
"name": "busybox",
|
||||||
|
"versionInfo": "1.34.1-r5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-34f407fb4dbd67f4",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "OpenSSL",
|
||||||
|
"licenseDeclared": "OpenSSL",
|
||||||
|
"name": "libcrypto1.1",
|
||||||
|
"versionInfo": "1.1.1n-r0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-4bbc1cb449d54083",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "BSD-2-Clause AND BSD-3-Clause",
|
||||||
|
"licenseDeclared": "BSD-2-Clause AND BSD-3-Clause",
|
||||||
|
"name": "libc-utils",
|
||||||
|
"versionInfo": "0.7.2-r3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-a3bdd174be1456b6",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "MIT",
|
||||||
|
"licenseDeclared": "MIT",
|
||||||
|
"name": "alpine-keys",
|
||||||
|
"versionInfo": "2.4-r1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-ac6472ba26fb991c",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "MPL-2.0 AND MIT",
|
||||||
|
"licenseDeclared": "MPL-2.0 AND MIT",
|
||||||
|
"name": "ca-certificates-bundle",
|
||||||
|
"versionInfo": "20211220-r0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-b2d1b1d70fe90f7d",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "OpenSSL",
|
||||||
|
"licenseDeclared": "OpenSSL",
|
||||||
|
"name": "libssl1.1",
|
||||||
|
"versionInfo": "1.1.1n-r0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-c617077ba6649520",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "GPL-2.0-only",
|
||||||
|
"licenseDeclared": "GPL-2.0-only",
|
||||||
|
"name": "scanelf",
|
||||||
|
"versionInfo": "1.3.3-r0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-ca80b810029cde0e",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "MIT",
|
||||||
|
"licenseDeclared": "MIT",
|
||||||
|
"name": "musl",
|
||||||
|
"versionInfo": "1.2.2-r7"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-d782e64751ba9faa",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "GPL-2.0-only",
|
||||||
|
"licenseDeclared": "GPL-2.0-only",
|
||||||
|
"name": "alpine-baselayout",
|
||||||
|
"versionInfo": "3.2.0-r18"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-e5e8a237f6162e22",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "MIT BSD GPL2+",
|
||||||
|
"licenseDeclared": "MIT BSD GPL2+",
|
||||||
|
"name": "musl-utils",
|
||||||
|
"versionInfo": "1.2.2-r7"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SPDXID": "SPDXRef-fdf0ce84f6337be4",
|
||||||
|
"filesAnalyzed": false,
|
||||||
|
"licenseConcluded": "GPL-2.0-only",
|
||||||
|
"licenseDeclared": "GPL-2.0-only",
|
||||||
|
"name": "ssl_client",
|
||||||
|
"versionInfo": "1.34.1-r5"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"spdxVersion": "SPDX-2.2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
[spdx]: https://spdx.dev/wp-content/uploads/sites/41/2020/08/SPDX-specification-2-2.pdf
|
||||||
|
|
||||||
|
[cyclonedx]: https://cyclonedx.org/
|
||||||
|
[sbom]: https://cyclonedx.org/capabilities/sbom/
|
||||||
|
[bov]: https://cyclonedx.org/capabilities/bov/
|
||||||
|
|
||||||
|
[os_packages]: ../scanner/vulnerability/os.md
|
||||||
|
[language_packages]: ../scanner/vulnerability/language/index.md
|
||||||
181
docs/docs/supply-chain/vex.md
Normal file
181
docs/docs/supply-chain/vex.md
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
# Vulnerability Exploitability Exchange (VEX)
|
||||||
|
|
||||||
|
!!! warning "EXPERIMENTAL"
|
||||||
|
This feature might change without preserving backwards compatibility.
|
||||||
|
|
||||||
|
Trivy supports filtering detected vulnerabilities using [the Vulnerability Exploitability Exchange (VEX)](https://www.ntia.gov/files/ntia/publications/vex_one-page_summary.pdf), a standardized format for sharing and exchanging information about vulnerabilities.
|
||||||
|
By providing VEX alongside the Software Bill of Materials (SBOM) during scanning, it is possible to filter vulnerabilities based on their status.
|
||||||
|
Currently, Trivy supports the following two formats:
|
||||||
|
|
||||||
|
- [CycloneDX](https://cyclonedx.org/capabilities/vex/)
|
||||||
|
- [OpenVEX](https://github.com/openvex/spec)
|
||||||
|
|
||||||
|
This is still an experimental implementation, with only minimal functionality added.
|
||||||
|
|
||||||
|
## CycloneDX
|
||||||
|
There are [two VEX formats](https://cyclonedx.org/capabilities/vex/) for CycloneDX:
|
||||||
|
|
||||||
|
- Independent BOM and VEX BOM
|
||||||
|
- BOM With Embedded VEX
|
||||||
|
|
||||||
|
Trivy only supports the Independent BOM and VEX BOM format, so you need to provide a separate VEX file alongside the SBOM.
|
||||||
|
The input SBOM format must be in CycloneDX format.
|
||||||
|
|
||||||
|
The following steps are required:
|
||||||
|
|
||||||
|
1. Generate a CycloneDX SBOM
|
||||||
|
2. Create a VEX based on the SBOM generated in step 1
|
||||||
|
3. Provide the VEX when scanning the CycloneDX SBOM
|
||||||
|
|
||||||
|
### Generating the SBOM
|
||||||
|
You can generate a CycloneDX SBOM with Trivy as follows:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy image --format cyclonedx --output debian11.sbom.cdx debian:11
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create the VEX
|
||||||
|
Next, create a VEX based on the generated SBOM.
|
||||||
|
Multiple vulnerability statuses can be defined under `vulnerabilities`.
|
||||||
|
Take a look at the example below.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cat <<EOF > trivy.vex.cdx
|
||||||
|
{
|
||||||
|
"bomFormat": "CycloneDX",
|
||||||
|
"specVersion": "1.4",
|
||||||
|
"version": 1,
|
||||||
|
"vulnerabilities": [
|
||||||
|
{
|
||||||
|
"id": "CVE-2020-8911",
|
||||||
|
"analysis": {
|
||||||
|
"state": "not_affected",
|
||||||
|
"justification": "code_not_reachable",
|
||||||
|
"response": ["will_not_fix", "update"],
|
||||||
|
"detail": "The vulnerable function is not called"
|
||||||
|
},
|
||||||
|
"affects": [
|
||||||
|
{
|
||||||
|
"ref": "urn:cdx:3e671687-395b-41f5-a30f-a58921a69b79/1#pkg:golang/github.com/aws/aws-sdk-go@1.44.234"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a VEX document in the CycloneDX format.
|
||||||
|
The vulnerability ID, such as a CVE-ID or GHSA-ID, should be placed in `vulnerabilities.id`.
|
||||||
|
When the `analysis.state` is set to `not_affected`, Trivy will not detect the vulnerability.
|
||||||
|
|
||||||
|
BOM-Links must be placed in `affects.ref`.
|
||||||
|
The BOM-Link has the following syntax and consists of three elements:
|
||||||
|
|
||||||
|
```
|
||||||
|
urn:cdx:serialNumber/version#bom-ref
|
||||||
|
```
|
||||||
|
|
||||||
|
- serialNumber
|
||||||
|
- version
|
||||||
|
- bom-ref
|
||||||
|
|
||||||
|
These values must be obtained from the CycloneDX SBOM.
|
||||||
|
Please note that while the serialNumber starts with `urn:uuid:`, the BOM-Link starts with `urn:cdx:`.
|
||||||
|
|
||||||
|
The `bom-ref` must contain the BOM-Ref of the package affected by the vulnerability.
|
||||||
|
In the example above, since the Go package `github.com/aws/aws-sdk-go` is affected by CVE-2020-8911, it was necessary to specify the SBOM's BOM-Ref, `pkg:golang/github.com/aws/aws-sdk-go@1.44.234`.
|
||||||
|
|
||||||
|
For more details on CycloneDX VEX and BOM-Link, please refer to the following links:
|
||||||
|
|
||||||
|
- [CycloneDX VEX](https://cyclonedx.org/capabilities/vex/)
|
||||||
|
- [BOM-Link](https://cyclonedx.org/capabilities/bomlink/)
|
||||||
|
- [Examples](https://github.com/CycloneDX/bom-examples/tree/master)
|
||||||
|
|
||||||
|
### Scan SBOM with VEX
|
||||||
|
Provide the VEX when scanning the CycloneDX SBOM.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy sbom trivy.sbom.cdx --vex trivy.vex.cdx
|
||||||
|
...
|
||||||
|
2023-04-13T12:55:44.838+0300 INFO Filtered out the detected vulnerability {"VEX format": "CycloneDX", "vulnerability-id": "CVE-2020-8911", "status": "not_affected", "justification": "code_not_reachable"}
|
||||||
|
|
||||||
|
go.mod (gomod)
|
||||||
|
==============
|
||||||
|
Total: 1 (UNKNOWN: 0, LOW: 1, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
|
||||||
|
|
||||||
|
┌───────────────────────────┬───────────────┬──────────┬───────────────────┬───────────────┬────────────────────────────────────────────────────────────┐
|
||||||
|
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
||||||
|
├───────────────────────────┼───────────────┼──────────┼───────────────────┼───────────────┼────────────────────────────────────────────────────────────┤
|
||||||
|
│ github.com/aws/aws-sdk-go │ CVE-2020-8912 │ LOW │ 1.44.234 │ │ aws-sdk-go: In-band key negotiation issue in AWS S3 Crypto │
|
||||||
|
│ │ │ │ │ │ SDK for golang... │
|
||||||
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2020-8912 │
|
||||||
|
└───────────────────────────┴───────────────┴──────────┴───────────────────┴───────────────┴────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
CVE-2020-8911 is no longer shown as it is filtered out according to the given CycloneDX VEX document.
|
||||||
|
|
||||||
|
## OpenVEX
|
||||||
|
Trivy also supports [OpenVEX](https://github.com/openvex/spec) that is designed to be minimal, compliant, interoperable, and embeddable.
|
||||||
|
Since OpenVEX aims to be SBOM format agnostic, both CycloneDX and SPDX formats are available for use as input SBOMs in Trivy.
|
||||||
|
|
||||||
|
The following steps are required:
|
||||||
|
|
||||||
|
1. Generate a SBOM (CycloneDX or SPDX)
|
||||||
|
2. Create a VEX based on the SBOM generated in step 1
|
||||||
|
3. Provide the VEX when scanning the SBOM
|
||||||
|
|
||||||
|
### Generating the SBOM
|
||||||
|
You can generate a CycloneDX or SPDX SBOM with Trivy as follows:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ trivy image --format spdx-json --output debian11.spdx.json debian:11
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create the VEX
|
||||||
|
Please see also [the example](https://github.com/openvex/examples).
|
||||||
|
The product identifiers differ depending on the SBOM format the VEX references.
|
||||||
|
|
||||||
|
- SPDX: [Package URL (PURL)](https://github.com/package-url/purl-spec)
|
||||||
|
- CycloneDX: [BOM-Link](https://cyclonedx.org/capabilities/bomlink/)
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cat <<EOF > trivy.openvex
|
||||||
|
{
|
||||||
|
"@context": "https://openvex.dev/ns",
|
||||||
|
"@id": "https://openvex.dev/docs/public/vex-2e67563e128250cbcb3e98930df948dd053e43271d70dc50cfa22d57e03fe96f",
|
||||||
|
"author": "Aqua Security",
|
||||||
|
"timestamp": "2023-01-16T19:07:16.853479631-06:00",
|
||||||
|
"version": "1",
|
||||||
|
"statements": [
|
||||||
|
{
|
||||||
|
"vulnerability": "CVE-2019-8457",
|
||||||
|
"products": [
|
||||||
|
"pkg:deb/debian/libdb5.3@5.3.28+dfsg1-0.8?arch=arm64\u0026distro=debian-11.6"
|
||||||
|
],
|
||||||
|
"status": "not_affected",
|
||||||
|
"justification": "vulnerable_code_not_in_execute_path"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
In the above example, PURLs, located in `packages.externalRefs.referenceLocator` are used since the input SBOM format is SPDX.
|
||||||
|
|
||||||
|
As for CycloneDX BOM-Link, please reference [the CycloneDX section](#cyclonedx).
|
||||||
|
|
||||||
|
### Scan SBOM with VEX
|
||||||
|
Provide the VEX when scanning the SBOM.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ trivy sbom debian11.spdx.json --vex trivy.openvex
|
||||||
|
...
|
||||||
|
2023-04-26T17:56:05.358+0300 INFO Filtered out the detected vulnerability {"VEX format": "OpenVEX", "vulnerability-id": "CVE-2019-8457", "status": "not_affected", "justification": "vulnerable_code_not_in_execute_path"}
|
||||||
|
|
||||||
|
debian11.spdx.json (debian 11.6)
|
||||||
|
================================
|
||||||
|
Total: 80 (UNKNOWN: 0, LOW: 58, MEDIUM: 6, HIGH: 16, CRITICAL: 0)
|
||||||
|
```
|
||||||
|
|
||||||
|
CVE-2019-8457 is no longer shown as it is filtered out according to the given OpenVEX document.
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user