Compare commits

...

467 Commits

Author SHA1 Message Date
afdesk
6ce9404c16 fix(report): add required fields to the SARIF template (#2341)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-06-20 13:31:21 +03:00
Josh Soref
d6d0a60d16 chore: fix spelling errors (#2352) 2022-06-20 09:56:13 +03:00
Ben Harvey
6f1035269d Omit Remediation if PrimaryURL is empty (#2006) 2022-06-19 15:16:08 +03:00
Schlump
396e404eeb docs(repo): Link to installation documentation in readme shows 404 (#2348) 2022-06-19 15:11:31 +03:00
MaineK00n
79e941df0d feat(alma): support for scanning of modular packages for AlmaLinux (#2347) 2022-06-17 10:15:27 +03:00
AndreyLevchenko
cb76acbd9f fix(lang): fix dependency graph in client server mode (#2336) 2022-06-16 13:05:55 +03:00
maltemorgenstern
3d2fc78852 feat: allow expiration date for .trivyignore entries (#2332)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-06-16 13:04:19 +03:00
AndreyLevchenko
3e3c119555 feat(lang): add dependency origin graph (#1970)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-06-16 10:34:26 +03:00
j-k
685a92e09a docs: update nix installation info (#2331) 2022-06-15 20:11:09 +03:00
chenk
1e0b03d47f feat: add rbac scanning support (#2328) 2022-06-15 20:01:22 +03:00
Teppei Fukuda
c9f9a9c917 refactor: move WordPress module to another repository (#2329)
* refactor: remove go.mod/sum from example

* move a wordpress example out
2022-06-15 16:56:51 +03:00
Rafael Sene
bcc231d3ba ci: add support for ppc64le (#2281)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-06-15 16:51:03 +03:00
Teppei Fukuda
7cecade3a1 feat: add support for WASM modules (#2195) 2022-06-15 15:23:00 +03:00
Teppei Fukuda
a02c06bafd feat(secret): show recommendation for slow scanning (#2051)
Co-authored-by: afdesk <work@afdesk.com>
2022-06-15 12:39:32 +03:00
mycodeself
e85881231f fix(flag): remove --clear-cache flag client mode (#2301) 2022-06-15 11:48:24 +03:00
DmitriyLewen
276daae672 fix(java): added check for looping for variable evaluation in pom file (#2322) 2022-06-15 11:23:52 +03:00
Jose Donizetti
546e7bd6b1 BREAKING(k8s): change CLI API (#2186) 2022-06-15 10:41:18 +03:00
MaineK00n
b69c4de757 feat(alpine): add Alpine Linux 3.16 (#2319) 2022-06-14 20:00:26 +03:00
Jose Donizetti
33b8521aee docs: bump trivy-operator to v0.0.7 (#2320) 2022-06-14 19:59:48 +03:00
afdesk
313ade3386 ci: add go mod tidy check (#2314) 2022-06-14 10:54:45 +03:00
afdesk
b331e771aa chore: run go mod tidy (#2313) 2022-06-14 08:19:38 +03:00
Jose Donizetti
bfe5c6f14f fix: do not exit if one resource is not found (#2311)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-06-13 17:13:19 +03:00
Patrick Decat
363a3e40ea feat(cli): use stderr for all log messages (resolve #381) (#2289) 2022-06-13 13:47:16 +03:00
afdesk
b213956cea test: replace deprecated subcommand client in integration tests (#2308) 2022-06-12 20:38:55 +03:00
Teppei Fukuda
efbc968ca8 feat: add support for containerd (#2305)
* chore(deps): bump fanal

* replace containerd

* fix: update signatures

* docs: containerd
2022-06-12 17:50:23 +03:00
Owen Rumney
9a601d49ef fix(kubernetes): Support floats in manifest yaml (#2297)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-06-12 17:01:50 +03:00
chenk
a589353bb3 docs(kubernetes): dead links (#2307)
Signed-off-by: chenk <hen.keinan@gmail.com>
2022-06-12 16:40:40 +03:00
Itay Shakury
f38f8d66fb chore: add license label (#2304) 2022-06-12 13:14:53 +03:00
DmitriyLewen
2b1de93249 feat(mariner): added support for CBL-Mariner Distroless v2.0 (#2293) 2022-06-09 13:45:01 +03:00
JBOClara
5423196f4c feat(helm): add pod annotations (#2272)
Co-authored-by: azman0101 <azman0101@gmail.com>
2022-06-09 11:13:26 +03:00
DmitriyLewen
6fb477097c refactor: do not import defsec in fanal types package (#2292) 2022-06-09 11:11:44 +03:00
Liam Galvin
4d382a0302 feat(report): Add misconfiguration support to ASFF report template (#2285) 2022-06-08 14:28:18 +03:00
Teppei Fukuda
f1c6af3121 test: use images in GHCR (#2275)
Co-authored-by: AMF <work@afdesk.com>
2022-06-07 13:50:32 +03:00
mycodeself
0977dfcde8 feat(helm): support pod annotations (#2265) 2022-06-07 11:42:58 +03:00
Owen Rumney
6b2cd7e8da feat(misconf): Helm chart scanning (#2269)
Signed-off-by: Owen Rumney <owen.rumney@aquasec.com>
2022-06-07 11:38:43 +03:00
Liam Galvin
3912768470 docs: Update custom rego policy docs to reflect latest defsec/fanal changes (#2267)
Signed-off-by: Liam Galvin <liam.galvin@aquasec.com>
2022-06-06 12:51:23 +03:00
mycodeself
a17c3eec2a fix: mask redis credentials when logging (#2264) 2022-06-06 11:07:08 +03:00
Jose Donizetti
d8b59efea9 refactor: extract commands Runner interface (#2147) 2022-06-06 11:04:24 +03:00
dependabot[bot]
60a81fcb95 chore(deps): bump alpine from 3.15.4 to 3.16.0 (#2234) 2022-06-06 08:09:24 +03:00
dependabot[bot]
c73650d967 chore(deps): bump github.com/CycloneDX/cyclonedx-go from 0.5.2 to 0.6.0 (#2245) 2022-06-06 08:08:49 +03:00
chenk
6cfdffda18 docs: update operator release (#2263)
Signed-off-by: chenk <hen.keinan@gmail.com>
2022-06-06 07:39:20 +03:00
dependabot[bot]
510ce1a782 chore(deps): bump github.com/urfave/cli/v2 from 2.6.0 to 2.8.1 (#2243) 2022-06-02 16:48:59 +03:00
DmitriyLewen
92c0452b74 feat(redhat): added architecture check (#2172)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-06-02 15:35:42 +03:00
Anais Urlichs
1eb73f3fea docs: updating links in the docs to work again (#2256) 2022-06-02 15:22:51 +03:00
Jose Donizetti
270dc7346f docs: fix readme (#2251) 2022-06-02 12:59:35 +03:00
DmitriyLewen
a6ff0d12bb fix: fixed incorrect CycloneDX output format (#2255) 2022-06-02 09:55:49 +03:00
dependabot[bot]
67d94774ba chore(deps): bump github.com/caarlos0/env/v6 from 6.9.1 to 6.9.3 (#2241) 2022-06-01 17:43:49 +03:00
dependabot[bot]
3e6dc37728 chore(deps): bump github.com/samber/lo from 1.19.0 to 1.21.0 (#2242) 2022-06-01 17:43:12 +03:00
dependabot[bot]
2dc5c9152e chore(deps): bump goreleaser/goreleaser-action from 2 to 3 (#2240) 2022-06-01 17:42:17 +03:00
dependabot[bot]
6daf62ebeb chore(deps): bump docker/setup-buildx-action from 1 to 2 (#2238) 2022-06-01 17:40:44 +03:00
dependabot[bot]
f9ee4943b1 chore(deps): bump docker/setup-qemu-action from 1 to 2 (#2236) 2022-06-01 17:40:14 +03:00
dependabot[bot]
c3e227b625 chore(deps): bump golang from 1.18.1 to 1.18.2 (#2235) 2022-06-01 17:39:23 +03:00
dependabot[bot]
ca390411f3 chore(deps): bump golangci/golangci-lint-action from 3.1.0 to 3.2.0 (#2237) 2022-06-01 17:38:34 +03:00
dependabot[bot]
c676361681 chore(deps): bump docker/login-action from 1 to 2 (#2239) 2022-06-01 17:38:03 +03:00
dependabot[bot]
126fe0abba chore(deps): bump github.com/hashicorp/go-getter from 1.5.11 to 1.6.1 (#2246) 2022-06-01 17:35:54 +03:00
AndreyLevchenko
f7d02538f6 refactor(deps): move dependencies to package (#2189) 2022-06-01 16:09:50 +03:00
Shira Cohen
f982167c0a fix(report): change github format version to required (#2229) 2022-06-01 15:39:40 +03:00
Itay Shakury
d3a73e4db7 docs: update readme (#2110)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-06-01 12:35:24 +03:00
DmitriyLewen
5d5b93ed69 docs: added information about choosing advisory database (#2212)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-06-01 11:26:46 +03:00
Jose Donizetti
36498501bf chore: update trivy-kubernetes (#2224)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-31 16:01:50 -03:00
Anais Urlichs
3c0e354743 docs: clarifying parts of the k8s docs and updating links (#2222) 2022-05-31 22:00:47 +03:00
Jose Donizetti
af5882bc3e fix(k8s): timeout error logging (#2179)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-31 14:21:07 -03:00
DmitriyLewen
3d2921343b chore(deps): updated fanal after fix AsymmetricPrivateKeys (#2214) 2022-05-31 15:10:50 +03:00
Jose Donizetti
e18f38af3c feat(k8s): add --context flag (#2171)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-31 07:06:10 -03:00
Jose Donizetti
0e937b5367 fix(k8s): properly instantiate TableWriter (#2175)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-31 07:02:23 -03:00
DmitriyLewen
911c5e971a test: fixed integration tests after updating testcontainers to v0.13.0 (#2208) 2022-05-31 10:49:24 +03:00
Teppei Fukuda
6fd1887e64 chore: update labels (#2197)
* chore: update labels

* add targets
2022-05-30 15:55:05 +03:00
DmitriyLewen
4059e94aba fix(report): fixed panic if all misconf reports were removed in filter (#2188)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-30 15:16:42 +03:00
Jose Donizetti
84af32a7fe feat(k8s): scan secrets (#2178) 2022-05-29 16:40:51 +03:00
AndreyLevchenko
4ab696eaa2 feat(report): GitHub Dependency Snapshots support (#1522)
Co-authored-by: Shira Cohen <97398476+ShiraCohen33@users.noreply.github.com>
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-26 21:34:15 +03:00
DmitriyLewen
b7ec642572 feat(db): added insecure skip tls verify to download trivy db (#2140)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-05-26 14:54:39 +03:00
DmitriyLewen
1e1ccbec52 fix(redhat): always use vulns with fixed version if there is one (#2165)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-26 11:24:31 +03:00
Vincent Palmer
4ceae2a052 chore(redhat): Add support for Red Hat UBI 9. (#2183)
* chore(redhat): Add support for Red Hat UBI 9.

* docs: add Red Hat UBI 9

Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-26 10:08:30 +03:00
Jose Donizetti
4e7e842682 fix(k8s): update trivy-kubernetes (#2163)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-26 10:01:02 +03:00
Nate
089d34e866 fix misconfig start line for code quality tpl (#2181)
Co-authored-by: Nate Fear <natefear@users.noreply.github.com>
2022-05-26 09:41:29 +03:00
Lucas Bickel
bfb0f2a193 fix: update docker/distribution from 2.8.0 to 2.8.1 (#2176)
Signed-off-by: Lucas Bickel <lucas.bickel@adfinis.com>
2022-05-26 08:11:06 +03:00
thiago-gitlab
f19243127a docs(vuln): Include GitLab 15.0 integration (#2153) 2022-05-22 10:51:44 +03:00
Owen Rumney
4c6a866cce docs: fix the operator version (#2167) 2022-05-20 20:19:28 +03:00
Jose Donizetti
3ecc65d626 fix(k8s): summary report when when only vulns exit (#2146)
* fix(k8s): summary report when when only vulns exit

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* fix(k8s): return error for not supported report

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* test(k8s): add tests for report Failed()

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* refactor: improve error message

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-19 10:00:37 -03:00
Liam Galvin
6b95d3857f chore(deps): Update fanal to get defsec v0.58.2 (fixes false positives in ksv038) (#2156)
Signed-off-by: Liam Galvin <liam.galvin@aquasec.com>
2022-05-19 15:33:33 +03:00
Liam Galvin
f6cfcaf193 perf(misconf): Improve performance when scanning very large files (#2152)
Signed-off-by: Liam Galvin <liam.galvin@aquasec.com>
2022-05-18 18:57:32 +03:00
Liam Galvin
4b4a0c95ba docs(misconf): Update examples and docs to refer to builtin/defsec instead of appshield (#2150)
Signed-off-by: Liam Galvin <liam.galvin@aquasec.com>
2022-05-18 14:49:15 +03:00
Liam Galvin
6d79fcacfc chore(deps): Update fanal (for less verbose code in misconf results) (#2151)
Signed-off-by: Liam Galvin <liam.galvin@aquasec.com>
2022-05-18 13:47:53 +03:00
DmitriyLewen
f8951f3847 docs: fixed installation instruction for rhel/centos (#2143) 2022-05-17 21:19:33 +03:00
Owen Rumney
afe3292843 fix: remove Highlighted from json output (#2131)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-16 19:04:09 +03:00
Jose Donizetti
3d23ad846c fix: remove trivy-kubernetes replace (#2132)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-16 18:56:22 +03:00
Owen Rumney
9822b40862 docs: Add Operator docs under Kubernetes section (#2111)
Co-authored-by: Itay Shakury <itay@itaysk.com>
2022-05-16 17:58:25 +03:00
Jose Donizetti
bb6ff8511b fix(k8s): security-checks panic (#2127) 2022-05-16 17:24:33 +03:00
DmitriyLewen
3bed96f0cf ci: added k8s scope (#2130) 2022-05-16 16:17:38 +03:00
Liam Galvin
4a7544caea docs: Update misconfig output in examples (#2128) 2022-05-16 16:16:55 +03:00
Liam Galvin
b7fc3dfc98 fix(misconf): Fix coloured output in Goland terminal (#2126) 2022-05-16 15:26:23 +03:00
thiago-gitlab
89893a7303 docs(secret): Fix default value of --security-checks in docs (#2107)
* Fix default value of --security-checks in docs

* Add missing value to security-checks option
2022-05-16 10:49:10 +03:00
Teppei Fukuda
dbba0bf152 refactor(report): move colorize function from trivy-db (#2122) 2022-05-15 20:53:24 +03:00
Jose Donizetti
3ef450d9a4 feat: k8s resource scanning (#2118) 2022-05-15 19:01:58 +03:00
Teppei Fukuda
f4ec4e7483 chore: add CODEOWNERS (#2121) 2022-05-15 16:02:41 +03:00
afdesk
96a5cb106a feat(image): add --server option for remote scans (#1871)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-15 14:56:48 +03:00
Jose Donizetti
023e09e3f3 refactor: k8s (#2116)
* refactor: add pkg/k8s

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* refactor: extract scanner

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* refactor: extract scanVulns

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* refactor: extract scanMisconfigs

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* refactor: extract filter

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* refactor: improve k8s/run.go

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* fix(k8s): code improvements

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>

* chore: go mod tidy

Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-15 08:07:31 -03:00
Teppei Fukuda
b3759f54fa refactor: export useful APIs (#2108)
Co-authored-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-13 22:09:20 +03:00
Jose Donizetti
dbf4b2dec5 docs: fix k8s doc (#2114)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-13 22:04:09 +03:00
Owen Rumney
2ae8faa7a8 feat(kubernetes): Add report flag for summary (#2112)
* feat(k8s): Add report flag for summary
* chore: add headings to the severity columns
* chore: make the default output of k8s summary table

Signed-off-by: Owen Rumney <owen.rumney@aquasec.com>
2022-05-13 19:02:01 +01:00
Liam Galvin
5f004f03d9 fix: Remove problematic advanced rego policies (#2113)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-13 20:28:57 +03:00
Liam Galvin
3679bc358c feat(misconf): Add special output format for misconfigurations (#2100) 2022-05-13 19:59:02 +03:00
Jose Donizetti
029dd76c30 feat: add k8s subcommand (#2065)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-12 21:11:29 +03:00
Jose Donizetti
a39133a13c chore: fix make lint version (#2102)
Signed-off-by: Jose Donizetti <jdbjunior@gmail.com>
2022-05-11 22:58:48 +03:00
Shira Cohen
995024f148 fix(java): handle relative pom modules (#2101) 2022-05-11 16:04:03 +03:00
Liam Galvin
c9f9a346cc fix(misconf): Add missing links for non-rego misconfig results (#2094) 2022-05-10 17:52:34 +03:00
Liam Galvin
5a58e41476 feat(misconf): Added fs.FS based scanning via latest defsec (#2084)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-10 15:05:00 +03:00
Teppei Fukuda
fbb83c42d9 chore(deps): bump trivy-issue-action to v0.0.4 (#2091) 2022-05-06 20:45:02 +03:00
dependabot[bot]
8a4b49ca70 chore(deps): bump github.com/twitchtv/twirp (#2077) 2022-05-06 19:04:34 +03:00
dependabot[bot]
7ba773f2bb chore(deps): bump github.com/urfave/cli/v2 from 2.4.0 to 2.5.1 (#2074) 2022-05-06 18:20:50 +03:00
DmitriyLewen
bd94618b34 chore(os): updated fanal version and alpine distroless test (#2086) 2022-05-06 18:18:59 +03:00
dependabot[bot]
fa5dcaf8f2 chore(deps): bump github.com/CycloneDX/cyclonedx-go from 0.5.1 to 0.5.2 (#2075) 2022-05-03 19:07:20 +03:00
dependabot[bot]
2c57716359 chore(deps): bump github.com/samber/lo from 1.16.0 to 1.19.0 (#2076) 2022-05-03 19:00:31 +03:00
Shira Cohen
6601d2957a feat(report): add support for SPDX (#2059)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-05-02 13:44:26 +03:00
dependabot[bot]
6e2453c2d6 chore(deps): bump actions/setup-go from 2 to 3 (#2073) 2022-05-02 08:59:40 +03:00
dependabot[bot]
7c94df539c chore(deps): bump actions/cache from 3.0.1 to 3.0.2 (#2071) 2022-05-02 08:59:11 +03:00
dependabot[bot]
8c33bae5a8 chore(deps): bump golang from 1.18.0 to 1.18.1 (#2069) 2022-05-02 08:58:47 +03:00
dependabot[bot]
2cdacc1517 chore(deps): bump actions/stale from 4 to 5 (#2070) 2022-05-02 08:54:51 +03:00
dependabot[bot]
9acb240fdc chore(deps): bump sigstore/cosign-installer from 2.0.0 to 2.3.0 (#2072) 2022-05-02 08:52:44 +03:00
dependabot[bot]
4b193b4712 chore(deps): bump github.com/open-policy-agent/opa from 0.39.0 to 0.40.0 (#2079) 2022-05-02 08:47:19 +03:00
Carol Valencia
79d1a0163f chore: app version 0.27.0 (#2046)
Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2022-04-30 17:20:22 +03:00
DmitriyLewen
c1b4b5be16 fix(misconf): added to skip conf files if their scanning is not enabled (#2066)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-04-30 17:12:23 +03:00
VaismanLior
bbe490b162 docs(secret) fix rule path in docs (#2061) 2022-04-30 16:45:20 +03:00
MaineK00n
78286aaff1 docs: change from go.sum to go.mod (#2056) 2022-04-27 14:54:49 +03:00
dependabot[bot]
55f29b8fb2 chore(deps): bump github.com/CycloneDX/cyclonedx-go from 0.5.0 to 0.5.1 (#1926)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-04-26 19:39:38 +03:00
Oran Moshai
b6baa65ff2 refactor(fs): scanner options (#2050)
To allow Trivy plugins create InitializeScanner signature scanner options need to be public

Co-authored-by: oranmoshai <oran.moshai@aquasec.com>
2022-04-26 16:05:27 +03:00
Teppei Fukuda
4b8e0ec2ea feat(secret): truncate long line (#2052) 2022-04-26 15:56:25 +03:00
Teppei Fukuda
cf78a436d2 docs: fix a broken bullets (#2042) 2022-04-26 10:42:09 +03:00
jeffalder
f8c2ced302 feat(ubuntu): add 22.04 approx eol date (#2044)
Add support for Ubuntu 22.04 LTS, Jammy Jellyfish: https://lists.ubuntu.com/archives/ubuntu-announce/2022-April/000279.html
2022-04-26 10:35:26 +03:00
tomthetommy
84c199428f docs: update installation.md (#2027) 2022-04-26 10:20:47 +03:00
nishipy
bdf55e16db docs: add Containerfile (#2032) 2022-04-26 10:17:24 +03:00
DmitriyLewen
9fd86da367 fix(go): fixed panic to scan gomod without version (#2038) 2022-04-25 16:04:44 +03:00
Teppei Fukuda
fbc9030db6 docs(mariner): confirm it works with Mariner 2.0 VM (#2036) 2022-04-25 10:17:51 +03:00
Teppei Fukuda
e2a31abd19 feat(secret): support enable rules (#2035)
Co-authored-by: VaismanLior <97836016+VaismanLior@users.noreply.github.com>
2022-04-24 19:04:30 +03:00
Carol Valencia
708a7a7175 chore: app version 26.0 (#2030)
Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2022-04-24 15:27:36 +03:00
Teppei Fukuda
e000329ec4 docs(secret): add a demo movie (#2031) 2022-04-24 11:56:27 +03:00
Teppei Fukuda
e127334664 feat: support cache TTL in Redis (#2021) 2022-04-22 23:19:01 +03:00
Teppei Fukuda
3870515a81 fix(go): skip system installed binaries (#2028) 2022-04-22 19:20:31 +03:00
Teppei Fukuda
4e6389af27 fix(go): check if go.sum is nil (#2029) 2022-04-22 18:50:01 +03:00
Teppei Fukuda
5f047f97db feat: add secret scanning (#1901)
Co-authored-by: VaismanLior <97836016+VaismanLior@users.noreply.github.com>
Co-authored-by: AMF <work@afdesk.com>
2022-04-22 17:08:18 +03:00
Carol Valencia
0700586483 chore: gh publish only with push the tag release (#2025)
Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2022-04-22 16:58:04 +03:00
Teppei Fukuda
1f393c12d5 fix(fs): ignore permission errors (#2022) 2022-04-22 11:47:56 +03:00
afdesk
110c534015 test(mod): using correct module inside test go.mod (#2020) 2022-04-21 16:48:33 +03:00
bgoareguer
525e2685ce feat(server): re-add proxy support for client/server communications (#1995) 2022-04-21 12:32:46 +03:00
afdesk
9898ac9251 fix(report): truncate a description before escaping in ASFF template (#2004) 2022-04-18 18:10:47 +03:00
afdesk
453a1edfd2 fix(cloudformation): correct margin removal for empty lines (#2002) 2022-04-17 21:46:01 +03:00
afdesk
407f3b668b fix(template): correct check of old sarif template files (#2003) 2022-04-16 13:10:48 +03:00
Teppei Fukuda
a0047a7983 feat(alpine): warn mixing versions (#2000) 2022-04-16 00:03:04 +03:00
Ben Harvey
d786655a18 Update ASFF template (#1914) 2022-04-15 14:04:07 +03:00
afdesk
a02cf65196 chore(deps): replace containerd/containerd version to fix CVE-2022-23648 (#1994) 2022-04-14 16:29:00 +03:00
DmitriyLewen
613e38ccf6 chore(deps): bump alpine from 3.15.3 to 3.15.4 (#1993) 2022-04-14 14:33:08 +03:00
afdesk
3b6d65beb8 test(go): add integration tests for gomod (#1989) 2022-04-14 13:38:54 +03:00
DmitriyLewen
22f5b938f9 fix(python): fixed panic when scan .egg archive (#1992) 2022-04-14 13:13:40 +03:00
afdesk
485637c28a fix(go): set correct go modules type (#1990) 2022-04-14 09:55:37 +03:00
Teppei Fukuda
6fdb554a0d feat(alpine): support apk repositories (#1987) 2022-04-14 09:52:51 +03:00
Teppei Fukuda
d9bddb90fe docs: add CBL-Mariner (#1982)
* docs: add CBL-Mariner

* docs: put it into a single page
2022-04-13 20:13:37 +03:00
Teppei Fukuda
1cf1873f21 docs(go): fix version (#1986) 2022-04-13 17:57:40 +03:00
Teppei Fukuda
d77dbe8a55 feat(go): support go.mod in Go 1.17+ (#1985) 2022-04-13 16:02:16 +03:00
Teppei Fukuda
32bd1e484a ci: fix URLs in the PR template (#1972) 2022-04-12 13:54:58 +03:00
DmitriyLewen
94a5a1808f ci: add semantic pull requests check (#1968) 2022-04-12 09:59:06 +03:00
afdesk
72d94b21cf docs(issue): added docs for wrong detection issues (#1961)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-04-12 09:57:27 +03:00
Teppei Fukuda
b4a7d6a861 docs: move CONTRIBUTING.md to docs (#1971) 2022-04-11 18:53:26 +03:00
DmitriyLewen
0127c1d39e refactor(table): use file name instead package path (#1966) 2022-04-11 12:15:15 +03:00
Teppei Fukuda
a92da72263 fix(sbom): add --db-repository (#1964) 2022-04-07 17:57:20 +03:00
DmitriyLewen
b0f3864e46 feat(table): add PkgPath in table result (#1960) 2022-04-06 15:52:13 +03:00
Jan-Otto Kröpke
0b1d32c182 fix(pom): merge multiple pom imports in a good manner (#1959) 2022-04-06 12:34:21 +03:00
DmitriyLewen
d4e3df81e8 fix(downloadDB): add dbRepositoryFlag to repository and rootfs commands (#1956) 2022-04-06 08:51:45 +03:00
afdesk
7e48cc1f4d fix(misconf): update BurntSushi/toml for fix runtime error (#1948) 2022-04-05 21:13:33 +03:00
Liam Galvin
c9efa8c479 fix(misconf): Update fanal/defsec to resolve missing metadata issues (#1947)
Signed-off-by: Liam Galvin <liam.galvin@aquasec.com>
2022-04-05 20:40:04 +03:00
Kobus van Schoor
52b715421e feat(jar): allow setting Maven Central URL using environment variable (#1939)
* chore(deps): update fanal/go-dep-parser to allow setting maven central url

* docs(troubleshooting): Add documentation for MAVEN_CENTRAL_URL option
2022-04-05 19:02:39 +03:00
Dennis Irsigler
21f7a41b27 chore(chart): update Trivy version in HelmChart to 0.25.0 (#1931)
Signed-off-by: Dennis Irsigler <dennis.irsigler@metro-markets.de>
2022-04-05 16:36:51 +03:00
Teppei Fukuda
ff2b3d176d chore(chart): remove version comments (#1933)
Co-authored-by: Carol Valencia <8355621+krol3@users.noreply.github.com>
2022-04-05 16:22:19 +03:00
DmitriyLewen
9c19298f5f fix(downloadDB): add flag to server command (#1942) 2022-04-05 11:43:42 +03:00
Liam Galvin
aa3d696625 fix(misconf): update defsec to resolve panics (#1935) 2022-04-04 21:35:30 +03:00
dependabot[bot]
31e76699da chore(deps): bump github.com/docker/docker (#1924) 2022-04-04 17:58:34 +03:00
Anais Urlichs
4ca35b26a7 docs: restructure the documentation (#1887)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-04-04 17:20:22 +03:00
dependabot[bot]
8da4548073 chore(deps): bump github.com/urfave/cli/v2 from 2.3.0 to 2.4.0 (#1923) 2022-04-04 17:03:06 +03:00
dependabot[bot]
76e9d7eb27 chore(deps): bump actions/cache from 2 to 3.0.1 (#1920) 2022-04-04 15:43:14 +03:00
dependabot[bot]
2b217a3b2a chore(deps): bump actions/checkout from 2 to 3 (#1916) 2022-04-04 15:04:29 +03:00
dependabot[bot]
902aa8ceb9 chore(deps): bump github.com/open-policy-agent/opa from 0.37.2 to 0.39.0 (#1921) 2022-04-04 13:40:33 +03:00
dependabot[bot]
60b19e5e60 chore(deps): bump sigstore/cosign-installer from 2.0.0 to 2.1.0 (#1919) 2022-04-04 13:38:13 +03:00
dependabot[bot]
58aab67928 chore(deps): bump helm/chart-testing-action from 2.2.0 to 2.2.1 (#1918) 2022-04-04 13:15:02 +03:00
dependabot[bot]
209b9cc25a chore(deps): bump golang from 1.17 to 1.18.0 (#1915) 2022-04-04 13:10:28 +03:00
Itay Shakury
bfb931d454 Add trivy horizontal logo (#1932) 2022-04-04 13:09:54 +03:00
dependabot[bot]
ae86a5b171 chore(deps): bump alpine from 3.15.0 to 3.15.3 (#1917) 2022-04-04 11:37:42 +03:00
dependabot[bot]
1a23039e31 chore(deps): bump github.com/go-redis/redis/v8 from 8.11.4 to 8.11.5 (#1925) 2022-04-04 11:06:49 +03:00
dependabot[bot]
56498ca1df chore(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1 (#1927) 2022-04-04 09:57:10 +03:00
Sashi Kumar
02105678ed feat(db): Add dbRepository flag to get advisory database from OCI registry (#1873)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-31 16:09:01 +03:00
DmitriyLewen
4470a181e2 docs(filter vulnerabilities): fix link (#1880)
fixed link to helper functions
2022-03-30 17:56:16 +03:00
Nate Fear
cb171ead72 feat(template) Add misconfigurations to gitlab codequality report (#1756) 2022-03-30 17:55:14 +03:00
afdesk
36e24b1858 fix(rpc): add PkgPath field to client / server mode (#1643) 2022-03-30 14:43:29 +03:00
DmitriyLewen
88311745ba fix(vulnerabilities): fixed trivy-db vulns (#1883) 2022-03-28 11:30:20 +03:00
afdesk
9154b819ac feat(cache): remove temporary cache after filesystem scanning (#1868) 2022-03-27 11:31:54 +03:00
Tamir Kiviti
f36d9b6f90 feat(sbom): add a dedicated sbom command (#1799)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-23 23:42:22 +02:00
Masahiro331
7a148089ec feat(cyclonedx): add vulnerabilities (#1832)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-22 20:22:55 +02:00
afdesk
df80fd31a0 fix(option): hide false warning about remote options (#1865) 2022-03-22 16:33:03 +02:00
Teppei Fukuda
88ebc07504 chore: bump up Go to 1.18 (#1862) 2022-03-21 16:38:54 +02:00
afdesk
d6418cf0de feat(filesystem): scan in client/server mode (#1829)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-21 15:51:18 +02:00
Teppei Fukuda
12d0317a67 refactor(template): remove unused test (#1861) 2022-03-21 14:50:36 +02:00
DmitriyLewen
c3aca1524c fix(cli): json format for trivy version (#1854)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-21 14:41:41 +02:00
Rory McCune
b2b68951f2 docs: change URL for tfsec-checks (#1857)
The current URL for the tfsec-checks is 404, so changing it in-line with what we've got for cfsec, which is just the base site URL.
2022-03-20 10:16:51 +02:00
afdesk
06659f1509 fix(docker): Getting images without a tag (#1852) 2022-03-17 21:05:41 +02:00
SIPR
a91cc50df7 docs(gitlab-ci): Use environment variables TRIVY_CACHE_DIR and TRIVY_NO_PROGRESS (#1801) 2022-03-17 19:16:06 +02:00
DmitriyLewen
4b8bf874d8 chore(issue labels): added new labels (#1839)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-03-16 14:38:47 +02:00
Furkan Türkal
5040caefc8 refactor: clarify db update warning messages (#1808)
Signed-off-by: Furkan <furkan.turkal@trendyol.com>

Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-16 14:35:40 +02:00
DmitriyLewen
28cd5a5537 chore(ci): change trivy vulnerability scan for every day (#1838) 2022-03-16 13:00:12 +02:00
Zach Stone
b2f554eb2a feat(helm): make Trivy service name configurable (#1825) 2022-03-16 10:38:45 +02:00
DmitriyLewen
7a44a7a344 chore(deps): updated sprig to version v3.2.2. (#1814) 2022-03-14 14:40:52 +02:00
DmitriyLewen
18842fbe04 chore(deps): updated testcontainers-go to version v0.12.0 (#1822) 2022-03-14 14:13:29 +02:00
MaineK00n
12ca3ca6da docs: add packages.config for .NET (#1823) 2022-03-14 13:57:53 +02:00
Batuhan Apaydın
728a3db6c6 build: sign container image (#1668)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-13 15:35:43 +02:00
dependabot[bot]
4e7b5ca365 chore(deps): bump github.com/CycloneDX/cyclonedx-go from 0.4.0 to 0.5.0 (#1778)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: masahiro331 <m_fujimura@r.recruit.co.jp>
2022-03-13 14:10:36 +02:00
Ricardo
0fca2cda91 docs: fix Installation documentation (#1804)
* Add missing `image` argument in the Installation docs->Docker section for MacOS.
2022-03-13 11:59:01 +02:00
Cyrille Pontvieux
e50839bb40 fix(report): ensure json report got a final new line (#1797) 2022-03-13 11:58:21 +02:00
Owen Rumney
f95a0f0d52 fix(terraform): resolve panics in defsec (#1811) 2022-03-09 18:37:02 +02:00
Malte Swart
e5bf3d1e30 feat(docker): Label images based on OCI image spec (#1793)
The Label Schema Convention has been deprecated in favor of the OCI
image spec.

Update the gorelease config to use the new replacement fields.

This is not considered a breaking change, as it only touches metadata
and the Label Schema Convention is deprecated for over two years (March
2019).

Most fields only need to be renamed. `org.label-schema.schema-version`
could be removed without replacement.
`org.opencontainers.image.documentation` was added to link to the
Github page documentation in the exact version.
`org.opencontainers.image.url` was added pointing to the Aqua Security
product page of trivy.
Further labels were considered but not added (unclear purpose or value).
2022-03-06 20:00:24 +02:00
Will Dowling
2193fb3c44 fix(helm): indentation for ServiceAccount annotations (#1795) 2022-03-06 09:34:38 +02:00
bestgopher
bbccb5a69d fix(hcl): fix panic in hcl2json (#1791) 2022-03-03 18:21:18 +02:00
Kaito Ii
a625455f1c chore(helm): remove psp from helm manifest (#1315) 2022-03-03 15:38:53 +02:00
Yuval Goldberg
7e69f4820e build: Replace make protoc with for loop to return an error (#1655)
Find the `*.proto` files and run in a `for loop` to run `protoc`
for each file in a separated command. If fail, `|| exit` will exit
with the returned error.

The POSIX standard specifies that the return status of `find` is 0
unless an error occurred while traversing the directories;
the return status of executed commands doesn't enter into it.

To overcome this limitation, the `-exec ... +` pattern could be used
From the docs (https://man7.org/linux/man-pages/man1/find.1.html):
"If any invocation with the `+' form returns a non-zero
value as exit status, then find returns a non-zero exit
status."

But as well, "This variant of the -exec action runs the specified command
on the selected files, but the command line is built by appending each selected
file name at the end;"

Unfortunately, at the moment `protoc-gen-twirp` plugin doesn't
support multiple files from different packages when the `go_package` option
is explicitly mentioned.
https://github.com/twitchtv/twirp/blob/main/protoc-gen-twirp/generator.go#L181-L185

Signed-off-by: Yuval Goldberg <yuvigoldi@gmail.com>
2022-03-03 15:35:51 +02:00
Amndeep Singh Mann
f6c986b6c0 fix: ASFF template to match ASFF schema (#1685)
Signed-off-by: Amndeep Singh Mann <amann@mitre.org>
2022-03-03 15:28:20 +02:00
Eric Bailey
aab6f0bf20 feat(helm): Add support for server token (#1734) 2022-03-03 14:38:20 +02:00
Teppei Fukuda
eebf9c8f58 fix(pom): keep an order of dependencies (#1784) 2022-03-03 12:36:21 +02:00
Teppei Fukuda
971092b847 chore: bump up Go to 1.17 (#1781) 2022-03-03 10:30:36 +02:00
dependabot[bot]
2f2d8222e4 chore(deps): bump actions/setup-python from 2 to 3 (#1776)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-03-02 14:11:29 +02:00
dependabot[bot]
a2afd6e683 chore(deps): bump golangci/golangci-lint-action from 2 to 3.1.0 (#1777) 2022-03-02 10:43:16 +02:00
afdesk
a423b99312 fix(python): correct handling pip package names with a hyphen (#1771) 2022-02-27 17:47:53 +02:00
benterris
a069ad7818 doc(docker): fix command to run trivy with docker on linux (#1761) 2022-02-25 10:56:47 +02:00
Edvin N
015055e1f5 feat(helm): Add support for custom labels (#1767)
Solves #1766
2022-02-25 09:07:25 +02:00
Edvin N
cbaa363990 chore(helm): bump chart to trivy 0.24.0 (#1762)
Signed-off-by: Edvin Norling <edvin.norling@xenit.se>
2022-02-25 09:06:56 +02:00
Owen Rumney
bec02f098d docs: remove erroneous command (#1763) 2022-02-24 14:21:10 +02:00
dependabot[bot]
d7f8b92a27 chore(deps): bump github.com/spf13/afero from 1.6.0 to 1.8.1 (#1708) 2022-02-22 22:49:01 +02:00
Teppei Fukuda
59ea0d5781 fix(option): warn list-all-pkgs only with the table format (#1755) 2022-02-22 22:48:39 +02:00
DmitriyLewen
c788676f87 feat(option): warn "--list-all-pkgs" with "--format table" (#1632)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-02-22 18:41:25 +02:00
Masahiro331
58ade462b4 feat(report): add support for CycloneDX (#1081)
Co-authored-by: tspearconquest <81998567+tspearconquest@users.noreply.github.com>
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-02-22 18:01:15 +02:00
Owen Rumney
77cab6e0b9 chore(deps): update the defsec and tfsec versions (#1747) 2022-02-22 16:42:24 +02:00
AndreyLevchenko
2ede15d358 fix(scanner): fix skip of language-specific files when scanning rootf… (#1751) 2022-02-22 08:48:25 +02:00
dependabot[bot]
d266c74941 chore(deps): bump github.com/google/wire from 0.4.0 to 0.5.0 (#1712) 2022-02-21 18:46:55 +02:00
Guy Ben-Aharon
4423396bcc feat(report): considering App.Writer when printing results (#1722)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-02-21 16:47:42 +02:00
afdesk
356ae30c7e chore(deps): replace satori version and skipping examples folder (#1745)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-02-21 15:58:45 +02:00
skuethe
477dc7d5f9 build: add s390x container images (#1726)
Signed-off-by: skuethe <56306041+skuethe@users.noreply.github.com>
2022-02-21 11:31:07 +02:00
Oran Moshai
89b8d7ff30 feat(template) Add misconfigurations to junit report (#1724)
Co-authored-by: oranmoshai <oran.moshai@aquasec.com>
2022-02-20 11:54:24 +02:00
dependabot[bot]
219b71b4fd chore(deps): bump github.com/twitchtv/twirp (#1709) 2022-02-14 10:25:28 +02:00
Christian Zunker
aa6e1eb6f9 feat(client): configure TLS InsecureSkipVerify for server connection (#1287)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-02-13 11:34:34 +02:00
Ankush K
de6c3cbb6c fix(rpc): Supports RPC calls for new identifier CustomResource (#1605) 2022-02-13 11:20:51 +02:00
dependabot[bot]
b7d4d1ead4 chore(deps): bump go.uber.org/zap from 1.20.0 to 1.21.0 (#1705) 2022-02-13 11:18:07 +02:00
dependabot[bot]
e6c029d08a chore(deps): bump github.com/caarlos0/env/v6 from 6.0.0 to 6.9.1 (#1707) 2022-02-13 10:13:06 +02:00
Will Dowling
ec6cb1a642 feat(helm): Parameterise ServiceAccount annotations (#1677) 2022-02-13 09:48:01 +02:00
dependabot[bot]
7dfc16cf21 chore(deps): bump github.com/hashicorp/go-getter from 1.5.2 to 1.5.11 (#1710) 2022-02-13 09:47:11 +02:00
dependabot[bot]
42d8fd6638 chore(deps): bump github.com/cheggaaa/pb/v3 from 3.0.3 to 3.0.8 (#1704) 2022-02-11 20:09:23 +02:00
dependabot[bot]
c3ef2035b5 chore(deps): bump github.com/open-policy-agent/opa from 0.36.1 to 0.37.2 (#1711) 2022-02-11 18:04:44 +02:00
Teppei Fukuda
274103e883 chore(dependabot): enable gomod monthly (#1699) 2022-02-11 14:24:25 +02:00
Konstantinos Koukopoulos
e618d83dae fix(gitlab tpl): escape double quote (#1635) 2022-02-10 17:29:10 +02:00
Yuval Goldberg
3b0b2ed4ce build: Make make protoc be consistent (#1682)
Signed-off-by: Yuval Goldberg <yuvigoldi@gmail.com>
2022-02-10 11:07:30 +02:00
Masahiro331
5c8d098324 feat(purl): add generate purl package utilities (#1574) 2022-02-09 20:35:36 +02:00
Teppei Fukuda
11f4f81123 refactor: move result structs under types (#1696) 2022-02-09 19:31:12 +02:00
Teppei Fukuda
6db2092c72 feat(mariner): add support for CBL-Mariner 2.0 (#1694) 2022-02-09 14:45:39 +02:00
Sven Haardiek
8898bb0937 docs(gitlab-ci): fix Script in GitLab CI Example #1688
This patch changes the command line order to still work with the latest version
of trivy.

Signed-off-by: Sven Haardiek <sven.haardiek@uni-muenster.de>
2022-02-08 13:31:10 +02:00
Carol Valencia
33d0833717 chore: Upgrade helm chart version (#1683)
Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2022-02-08 12:45:11 +02:00
tspearconquest
13874d866c chore(mod): update Go dependencies (#1681)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-02-07 14:12:45 +02:00
Greg Myers
f26a06b980 docs: fix typos in markdown docs (#1674) 2022-02-04 22:05:30 +02:00
Rory McCune
e2821a4fba docs: update documentation for image scanning of tar files to use a tag present on Docker Hub (#1671) 2022-02-04 22:04:53 +02:00
Teppei Fukuda
ef8a1afcdb fix(repo): --no-progress suppresses git output (#1669) 2022-02-03 09:02:39 +02:00
Teppei Fukuda
449add24af docs: add ACR navigator (#1651) 2022-01-31 16:19:19 +02:00
John A Stevenson
cb9afc8441 fix: update example Rego files and docs (#1628) 2022-01-31 16:18:24 +02:00
Teppei Fukuda
78b2b899a0 feat(option): show a link to GitHub Discussions for --light deprecation (#1650) 2022-01-31 15:26:43 +02:00
afdesk
52fd3c2e0a fix(sarif): fix the warning message (#1647) 2022-01-31 10:11:27 +02:00
Teppei Fukuda
8d5882be03 refactor: migrate to prefixed buckets (#1644) 2022-01-31 10:05:38 +02:00
Masahiro331
84dd33f7e9 feat(mariner): add support for CBL-Mariner (#1640)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-29 22:53:07 +02:00
Teppei Fukuda
9e903a1d88 docs: commercial use available (#1641) 2022-01-29 21:26:16 +02:00
Christian Groschupp
f4c746a2d2 feat: support azure acr (#1611)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-28 22:50:28 +02:00
afdesk
420f8ab13e feat(os-pkg): add data sources (#1636) 2022-01-28 20:41:40 +02:00
Teppei Fukuda
d2827cba06 feat(redhat): support build info in RHEL (#807) 2022-01-28 18:35:00 +02:00
DmitriyLewen
ce703ce4a5 fix: change links in pull_request_template to static URLs (#1634) 2022-01-27 15:47:37 +02:00
Teppei Fukuda
50bb938a21 feat(lang-pkg): add data sources (#1625) 2022-01-27 14:22:06 +02:00
Teppei Fukuda
a31ddbe971 feat(detector): support custom detector (#1615) 2022-01-25 09:06:28 +02:00
AndreyLevchenko
3a4e18ac82 docs(contribution): change role who should resolve comments (#1618) 2022-01-24 15:11:03 +02:00
DmitriyLewen
8ba68361bd docs: add PR template (#1602)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-23 10:36:03 +02:00
MaineK00n
f5c5573936 feat(rocky): support Rocky Linux (#1570)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-20 11:43:43 +02:00
MarkusTeufelberger
eab2b425db Add the ability to set dockerhub credentials in the helm chart (#1569) 2022-01-20 07:51:07 +02:00
Taufik Mulyana
cabd18daae feat(cache): redis TLS support (#1297) 2022-01-18 15:16:00 +02:00
DmitriyLewen
02c3c3659d feat(java): add support for PAR files (#1599) 2022-01-18 13:26:46 +02:00
DmitriyLewen
4f7b768369 refactor(rust): move rust-advisory-db to OSV (#1591) 2022-01-17 15:38:35 +02:00
rethab
d754cb8c6f feat: log ignored vulnerabilities on debug (#1378)
* feat: log ignored vulnerabilities

* feat: show IDs in an ignore file

Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-17 08:38:08 +02:00
AndreyLevchenko
a936e675c9 chore(mod): hcl2json deps update (#1585)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-16 21:09:04 +02:00
DmitriyLewen
af116d3c9e fix(rpm): do not ignore installed files via third-party rpm (#1594) 2022-01-16 20:34:19 +02:00
jerbob92
b507360075 feat(fs): allow scanning a single file (#1578)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-16 16:32:31 +02:00
Teppei Fukuda
7fcbf44bb8 refactor(python): drop Safety DB (#1580) 2022-01-16 15:23:49 +02:00
DmitriyLewen
478d279919 feat: added insecure tls skip to scan git repo (#1528)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-14 11:25:45 +02:00
Yuval Goldberg
33bd41b40f Supress git clone output (#1590) 2022-01-14 08:59:49 +02:00
MaineK00n
39a10089fc fix(alma): skip modular package because MODULARITYLABEL is not set (#1588) 2022-01-13 17:30:20 +02:00
DmitriyLewen
37abd612aa feat(photon os): added EOL dates check (#1587)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-01-13 16:20:32 +02:00
DmitriyLewen
78de33e8ea docs: update supported os (#1586) 2022-01-13 13:53:13 +02:00
Teppei Fukuda
22054626f3 BREAKING: remove root command (#1579) 2022-01-12 16:13:13 +02:00
MaineK00n
28ddcf1ae8 docs: add Rust to Language-specific Packages Table (#1577) 2022-01-12 15:42:48 +02:00
rizwan-kh
df134c73f8 docs: update int doc for gitlab ci (#1575) 2022-01-12 11:17:29 +02:00
afdesk
8da20c8c92 BREAKING: migrate the sarif template to Go code (#1437)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2022-01-12 08:49:47 +02:00
Teppei Fukuda
714b5ca246 refactor: remove unused field (#1567) 2022-01-11 19:47:52 +02:00
dependabot[bot]
51e152b01c chore(deps): bump helm/chart-testing-action from 2.1.0 to 2.2.0 (#1554)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com
2022-01-11 14:58:23 +02:00
Stan0304
884daff429 docs: gitlab integration (#1381) 2022-01-10 15:38:32 +02:00
MaineK00n
2a8336b9aa feat(alma): support AlmaLinux (#1238)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2022-01-06 22:26:09 +02:00
Sourabh Gupta
1e171af165 docs: added note about default template path when Trivy installed using rpm (#1551) 2022-01-06 20:36:39 +02:00
Teppei Fukuda
e65274e0ef BREAKING: Trivy DB from GHCR (#1539) 2022-01-06 20:08:40 +02:00
Liam Galvin
db35450bbb feat(cli): Do not set default commands when a plugin is being run (#1549) 2022-01-06 19:10:16 +02:00
Maria Kotlyarevskaya
24254d19f6 fix: add fingerprint field to codequality template (#1541)
Signed-off-by: Jasstkn <mariia.kotliarevskaia@gmail.com>
2022-01-06 15:12:24 +02:00
afdesk
2ee074568c fix(image): correct handling of uncompressed layers (#1544)
Fixes #1527
2022-01-05 20:38:08 +02:00
Carol Valencia
0aef82c58e chore: helm chart app version 0.22.0 (#1535)
Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2022-01-04 22:24:39 +02:00
Teppei Fukuda
8b2a799721 test(integration): use fixtures (#1532) 2021-12-30 20:53:03 +02:00
Teppei Fukuda
42f795fa34 fix(java/pom): ignore unsupported requirements (#1514) 2021-12-24 23:37:28 +02:00
Teppei Fukuda
8f737cc6eb feat(cli): warning for root command (#1516) 2021-12-24 23:02:19 +02:00
Teppei Fukuda
76249bdcf0 BREAKING: disable JAR detection in fs/repo scanning (#1512)
Co-authored-by: Andrey Levchenko <levchenko.andrey@gmail.com>
2021-12-24 16:14:50 +02:00
Teppei Fukuda
59957d4c6b feat(scan): support --offline-scan option (#1511) 2021-12-24 12:20:21 +02:00
Teppei Fukuda
da8b72d2e7 fix: improve memory usage (#1509) 2021-12-24 08:33:43 +02:00
Teppei Fukuda
b713ad0fd3 feat(java): support pom.xml (#1501) 2021-12-23 16:45:38 +02:00
yuriShafet
56115e9d4f docs: fixing rust link to security advisory (#1504) 2021-12-22 17:52:35 +02:00
Owen Rumney
7f859afacb Add missing IacMetdata (#1505)
- Provider and Service added to IacMetadata on misconfiguration
2021-12-22 17:06:25 +02:00
Teppei Fukuda
628a7964d5 feat(jar): add file path (#1498) 2021-12-21 08:52:33 +02:00
Teppei Fukuda
82fba77141 feat(rpm): support NDB (#1497) 2021-12-21 07:57:06 +02:00
DmitriyLewen
d5269da5ee feat: added misconfiguration field for html.tpl (#1444)
* feat: added misconfiguration field for html.tpl

* feat: added message field for html.tpl

* fix: fixed integration test error
2021-12-20 17:14:00 +02:00
Chetan Goti
8e57dee86b fix(docs): typo (#1488) 2021-12-19 11:24:22 +02:00
Owen Rumney
8bfbc84a41 feat(plugin): Add option to update plugin (#1462)
* Add option to update plugin

- add plugin update [pluginName] to update
- add supporting test

* refactor: wrap errors
2021-12-16 13:30:19 +02:00
DmitriyLewen
1e811de263 fix: fixed skipFiles/skipDirs flags for relative path (#1482) 2021-12-16 13:21:22 +02:00
Owen Rumney
8b5796f770 feat (plugin): add list and info command for plugin (#1452)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2021-12-15 22:36:08 +02:00
afdesk
a2199bb417 fix: set up a vulnerability severity (#1458) 2021-12-15 21:28:29 +02:00
geyingqi
279e76f704 chore: add arm64 deb package (#1480) 2021-12-15 20:08:05 +02:00
Tomas Fernandez
5262590831 Link to trivy tutorial on Semaphore (#1449)
* Link to trivy tutorial on Semaphore

* Move tutorial to Advanced > Community > Tools
2021-12-12 05:33:00 +02:00
abdennour
c275a841fd refactor(helm): externalize env vars to configMap (#1345)
\#1343

Signed-off-by: abdennour <mail@abdennoor.com>
2021-12-08 08:37:05 +02:00
nobletrout
7beed30170 docs: provide more information on scanning Google's GCR (#1426)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2021-12-07 03:28:46 +02:00
DmitriyLewen
f50e1f42a1 docs(misconfiguration): added instruction for misconfiguration detection (#1428)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2021-12-06 13:56:41 +02:00
Guilherme Macedo
3ae4de5869 Update git-repository.md (#1430)
Update instructions on how to scan private git repositories, as according to https://github.com/aquasecurity/fanal/pull/253 .
2021-12-06 13:04:03 +02:00
AndreyLevchenko
6e35b8f53c fix(hooks): exclude unrelated lib types from system files filtering (#1431) 2021-12-06 10:53:34 +02:00
afdesk
beb60b05f3 chore: run go fmt (#1429) 2021-12-02 17:52:57 +09:00
afdesk
582e7fd1ba fix(sarif): change help field in the sarif template. (#1423) 2021-12-02 14:23:26 +09:00
Owen Rumney
11bc290111 Update fanal with cfsec version update (#1425)
- new version of cfsec brought in with latest fanal
  - fixes issue where cfsec treats files as CloudFormation when they
    arent
  - fixes issuee where invalid content errors are surfaced to Trivy
- Gets addition of service and provider on the IaC results - this is not
  visible to others
2021-12-01 04:15:26 +02:00
Nilushan Costa
392f68926c Replace deprecated option in goreleaser (#1406)
* Replace deprecated docker.use_buildx with docker.use

* Bump goreleaser GitHub action to v0.183.0
2021-11-29 05:31:16 +02:00
Huang Huang
101d576025 feat(alpine): support 3.15 (#1422) 2021-11-29 05:30:44 +02:00
Carol Valencia
bd3ba68cce chore: test the helm chart in the PR and used the commit hash (#1414)
Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2021-11-29 05:29:01 +02:00
dependabot[bot]
3860d6e4e9 chore(deps): bump alpine from 3.14 to 3.15.0 (#1417)
Bumps alpine from 3.14 to 3.15.0.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-28 09:48:31 +02:00
afdesk
4f82673a61 chore(release): add ubuntu older versions to deploy script (#1416)
* chore(release): add ubuntu older versions to deploy script

`ubuntu-distro-info --supported` returns only versions: `bionic`, `focal`, `hirsute`, `impish` and `jammy`.

`ubuntu-distro-info --supported-esm` returns another versions: `trusty`, `xenial`, `bionic`, `focal` and `jammy`.

for the release script we should use the union of these sets.

Fixes #1194

* change `uniq` command to `-u` parameter
2021-11-28 09:43:07 +02:00
Teppei Fukuda
b9a51de862 chore(mod): tidy (#1415) 2021-11-26 06:36:55 +02:00
AndreyLevchenko
7f248341cc fix(rpc): fix nil layer transmit (#1410)
* fix(rpc): fix nil layer transmit

Closes #1400

* added tests
2021-11-24 10:29:13 +02:00
Naimuddin Shaik
af3eaefdb2 Lang advisory order (#1409)
* chore(advisory reorder)

Reorder language advisory.

* fixed integration tests.
2021-11-24 10:27:12 +02:00
Raul Cabello Martin
07c9200eb7 chore: add support for s390x arch (#1304) 2021-11-21 11:38:47 +02:00
Carol Valencia
8bc8a4ad60 fix(chart): ingress helm manifest-update trivy image (#1323)
* fix: ingress helm manifest-update trivy image

* chore: helm ingress Capabilities.apiVersion

* feat: helm chart test gh

Co-authored-by: carolina valencia <krol3@users.noreply.github.com>
2021-11-21 09:57:30 +02:00
Owen Rumney
9076a49b0f docs: Add comparison for cfsec (#1388)
* Add cfsec comparison

* Add to mkdocs.yml
2021-11-17 16:42:17 +02:00
naoyukis
bb316d93ca remove: delete unused functions in utils package (#1379) 2021-11-16 14:12:18 +02:00
AndreyLevchenko
efdb29d0d4 fix(sarif): fix validation errors (#1376) 2021-11-15 16:36:51 +02:00
Teppei Fukuda
9bcf9e72f5 docs: add Bitbucket Pipelines (#1374) 2021-11-14 11:31:21 +02:00
Teppei Fukuda
3147097daf docs: add community integrations (#1361)
Co-authored-by: Carsten Hoffmann <choffmann87@googlemail.com>
2021-11-14 10:28:26 +02:00
Simon Engledew
33f74b3acb Use a stable SARIF identifier (#1230) 2021-11-11 20:02:40 +02:00
rahul2393
5915ffb42b fix(python): fix parsing of requirements.txt with hash checking mode available in pip since version 8.0 2021-11-11 13:18:31 +02:00
Owen Rumney
ae4c42b975 feat(iac): Add line information (#1366)
* feat(iac): Adding resource and Line data

- adding line in file information to the misconfiguration result
- updating tfsec and cfsec versions to provide this additional info

* Add usage of IaC metadata

* update the fanal version
2021-11-11 08:00:13 +02:00
Owen Rumney
19747d0535 feat(cloudformation): Adding support for cfsec IaC scanning (#1360) 2021-11-09 17:42:44 +02:00
Jamie
da45061f4d chore: send debug and info logs to stdout in install.sh, not stderr. (#1264)
The current install.sh script logs all messages to stderr via ```echoerr()``` function. Since godownloader is no longer maintained, it seems reasonable to update install.sh here.
2021-11-09 16:54:42 +02:00
tspearconquest
cb1a4ed3a1 Update containerd to v1.5.7 and docker-cli to v20.10.9 (#1356)
Signed-off-by: Thomas Spear <tspear@conquestcyber.com>
2021-11-09 16:00:41 +02:00
Vinod Anandan
69dae54aa1 chore: update SBOM generation (#1349) 2021-11-01 16:44:14 +02:00
Simar
5dc8cfe55d docs: update builtin.md (#1335) 2021-10-25 21:22:13 +03:00
psibre
798b564ee3 chore: fix issues with Homebrew formula (#1329) 2021-10-25 20:34:32 +03:00
psibre
21bf5e58f7 chore: bump GoReleaser to v0.183.0 (#1328) 2021-10-25 20:33:35 +03:00
Simar
e0f4ebd7cb docs: update iac.md for a typo (#1326) 2021-10-25 19:40:47 +03:00
Rory McCune
23a9a5e319 docs: typo fix (#1308)
Just fixing a typo in the docs "Filesysetm" --> "Filesystem
2021-10-25 19:39:34 +03:00
Christian Zunker
1f5d17fe13 Add new networking API features to Ingress (#1262)
* Add new networking API features to Ingress

This PR adds `v1` of the networking API introduced with k8s 1.19.
It also adds the new field `ingressClassName` introduced with k8s 1.18.

Fixes #1261

* Also query for the Kind in the capabilities

Signed-off-by: Christian Zunker <christian.zunker@codecentric.cloud>
2021-10-20 18:59:12 +03:00
Teppei Fukuda
bcfa0287b9 chore(release): bump up GoReleaser to v0.182.1 (#1299) 2021-10-16 06:48:44 +03:00
Teppei Fukuda
681ab1b889 fix(yarn): support quoted version (#1298) 2021-10-15 08:22:40 +03:00
Ankush K
46051d5ec8 feat(custom-forward): Forward the extended advisory data (#1247)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-10-14 21:57:30 +03:00
santhosh1729
d8d692b8ba feat(javascript) : Initialize npm driver for javascript packages (#1289) 2021-10-10 08:37:15 +03:00
besdollma
cc344dfbe3 fix(cli): fix incorrect comparision of DB metadata type. (#1286)
-- Incorrect Db metadata type comparision resulted in wrong
print in show version.

This fixes #1275.

Signed-off-by: Bes Dollma <besi7dollma@gmail.com>
2021-10-08 19:16:46 +03:00
Itay Shakury
0dec17fc3f docs: add footer to readme (#1281)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2021-10-07 10:18:38 +03:00
Teppei Fukuda
f12446d3ba feat(report): add package path (#1274) 2021-10-06 10:28:48 +03:00
Teppei Fukuda
1c9ccb5e03 feat(command): add rootfs command (#1271) 2021-10-04 21:03:34 +03:00
Huang Huang
a463e794ce fix: update fanal (#1272)
Fixes #1251 Fixes #1183 Fixes #1172
2021-10-04 17:47:00 +03:00
Teppei Fukuda
e0ca5eff38 feat(commands): remove deprecated options (#1270) 2021-10-04 15:49:04 +03:00
Masahiro331
1ebb3296ee Aggregate jar result for table (#1269)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2021-10-04 11:30:12 +03:00
Teppei Fukuda
b37f682ee2 BREAKING(report): migrate to new json schema (#1265) 2021-10-04 10:22:24 +03:00
Teppei Fukuda
da905108b4 feat: improve --skip-dirs and --skip-files (#1249) 2021-10-03 13:08:09 +03:00
Teppei Fukuda
bd57b4f9b5 fix(gobinary): skip large files (#1259) 2021-10-01 19:54:47 +03:00
Fabian Windheuser
9027dc3252 Disable library analyzer for OS only scan type (#1191) 2021-09-29 11:54:46 +03:00
fnishe
5750cc2e1a chore: update trivy version (#1252) 2021-09-29 10:56:44 +03:00
Eng Zer Jun
bbcce9f7b7 refactor: move from io/ioutil to io and os package (#1245)
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-29 10:17:02 +03:00
Minchao
6bcb4af10f fix: brew test command (#1253) 2021-09-27 07:25:30 +03:00
Naimuddin Shaik
8d13234554 fix:added layer info in packages (#1248)
* added layer info in packages

* fixed unit cases
2021-09-22 17:17:16 +03:00
Teppei Fukuda
982f35b424 fix(go/binary): improve debug messages (#1244) 2021-09-20 10:28:02 +03:00
洋仔
2e170cd15a Update db.go (#1199)
fix args name error
2021-09-19 20:38:22 +03:00
AndreyLevchenko
cc6c67d81c fix(deps): fix CVE-2021-32760 for github.com/containerd/containerd (#1243)
Closes #1226
2021-09-19 09:49:15 +03:00
Teppei Fukuda
669fd1fd1d feat(debian): support the versions that reached EOL (#1237)
* refactor(debian): aggregate oval and json api into salsa

* fix(vulnerability): use package-specific severity

* chore(mod): update trivy-db
2021-09-17 13:59:46 +03:00
Teppei Fukuda
8cd7de276e feat(alpine): support unfixed vulnerabilities (#1235) 2021-09-16 22:20:59 +03:00
Teppei Fukuda
3bf3a46cd4 feat(report): add image config (#1231)
* feat(report): add image config

* chore(mod): update fanal

* test(scanner): fix type
2021-09-15 22:19:37 +03:00
Ankush K
8edcc62a8d feat(nodejs): support package.json (#1225)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-09-15 14:23:35 +03:00
Teppei Fukuda
31c45ffc52 refactor: use testing DB instead of mock (#1234) 2021-09-15 10:06:01 +03:00
Ankush K
d8cc8b550b feat(ruby): support gemspec (#1224)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-09-14 23:16:19 +03:00
Ankush K
dbc7a83e8c feat(python): add packaging detector and respective hook (#1223)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-09-13 20:59:11 +03:00
Ankush K
19c0b70d26 feat(license): Added support to new License field of go-dep-parser's library (#1167) 2021-09-09 14:32:50 +03:00
afdesk
9d617777d5 fix(oracle): handle advisories contain ksplice versions (#1209)
* fix(oracle): handle advisories contain ksplice versions

Improve a handling of advisories contain ksplice versions:
* when one of them doesn't have ksplice, we'll also skip it
* extract kspliceX and compare it with kspliceY in advisories
* if kspliceX and kspliceY are different, we will skip the advisory.

Fixes #1205

* fix(oracle): handle advisories contain ksplice versions

simplify code and remove duplicated tests

Fixes #1205

* run go fmt
2021-09-05 11:29:13 +03:00
afdesk
5d57deaa4f fix(docs): remove OSVDB advisories (#1215)
Trivy no longer depends on OSVDB and can use "Ruby Advisory Database" for commercial usage.

Fixes #1208
2021-09-05 08:39:10 +03:00
Guilherme Macedo
b5955597a4 docs: fix typos in CONTRIBUTING.md (#1181)
* Fix typos in CONTRIBUTING.md

Fix small typos in CONTRIBUTING.md

* Fix typos in CONTRIBUTING.md

Fix small typos in CONTRIBUTING.md
2021-09-02 14:51:57 +03:00
Huang Huang
b1410b27b8 Update EOL of Debian 11 (#1180)
https://bits.debian.org/2021/08/bullseye-released.html
2021-09-02 14:32:47 +03:00
afdesk
0e777d386e fix(plugin): resolve a closure (#1207)
There is a closure inside a function for Action field: variable p always refers on the last plugin.
solution: redefine variable inside the for loop.

Fixes #1086
2021-09-02 14:29:54 +03:00
Pascal Borreli
b6d9c30eea docs: fix typo (#1206) 2021-09-01 18:03:14 +03:00
afdesk
5160a2eb53 fix(detector): change an argument for trivy-db getter (#1203)
use a package name instead of SrcName for getting of advisories
about Oracle packages.

Fixes #1170
2021-09-01 14:27:14 +03:00
Teppei Fukuda
40ed227c23 chore(mod): update fanal (#1179)
* chore(mod): update fanal

* test(integration): fix error message

* test(integration): skip reaper
2021-08-15 15:19:22 +03:00
santhosh1729
2a4400c147 Add license info to package data (#1176) 2021-08-15 13:05:37 +03:00
Tauseef
82eb630be7 feat(nuget): support packages.config (#1095)
Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
2021-08-12 15:27:13 +03:00
AndreyLevchenko
4a8db20a9a feat(python): add support for requirements.txt (#1169) 2021-08-11 11:14:37 +03:00
thiago-gitlab
8db9b6a2a6 GitLab CI integration documentation (#1168)
Recommend the native GitLab integration.
2021-08-08 14:10:16 +03:00
AndreyLevchenko
c159501d0d chore(gorelease) change goreleaser config to include template examples (#1138)
Closes #1123
2021-07-28 11:05:14 +03:00
dependabot[bot]
76e63d1124 chore(deps): bump dmnemec/copy_file_to_another_repo_action (#1153)
Bumps [dmnemec/copy_file_to_another_repo_action](https://github.com/dmnemec/copy_file_to_another_repo_action) from 1.0.4 to 1.1.1.
- [Release notes](https://github.com/dmnemec/copy_file_to_another_repo_action/releases)
- [Commits](https://github.com/dmnemec/copy_file_to_another_repo_action/compare/v1.0.4...v1.1.1)

---
updated-dependencies:
- dependency-name: dmnemec/copy_file_to_another_repo_action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-28 10:57:32 +03:00
dependabot[bot]
79b6684840 chore(deps): bump actions/stale from 3 to 4 (#1152)
Bumps [actions/stale](https://github.com/actions/stale) from 3 to 4.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-28 10:56:09 +03:00
AndreyLevchenko
214fe82c7e feat(report): add end of service life flag to OS metadata (#1142)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-07-27 17:08:57 +03:00
Matthieu MOREL
c489e31f5d chore: set up Dependabot for github-actions and docker (#1128) 2021-07-27 16:03:43 +03:00
MaineK00n
efd812cb1a docs: fix typo (#1149) 2021-07-27 16:00:54 +03:00
Teppei Fukuda
3a920dc401 docs: add some external links (#1147) 2021-07-27 15:39:55 +03:00
AndreyLevchenko
7cb1598991 chore (release): add ubuntu esm versions to deploy script (#1151) 2021-07-26 12:49:42 +03:00
AndreyLevchenko
6a8800286e docs(troubleshooting) add urls which are required to download vuls db (#1137) 2021-07-21 11:07:57 +03:00
Simran Munot
f3f3029014 Updated the Alpine Image to 3.14 (latest) (#1130) 2021-07-20 13:27:43 +03:00
Simran Munot
0e52fde047 Added EOL for Ubuntu 21.10 (#1131)
As per (https://wiki.ubuntu.com/Releases) and (https://ubuntu.com/about/release-cycle), Ubuntu 21.10 is supported until July 2022
2021-07-20 13:25:01 +03:00
AndreyLevchenko
9b3fba04f9 fix(image): disabled scanning of config files within container images (#1133) 2021-07-20 10:15:45 +03:00
mustafa-rean
1101634f6a docs: fixed typo (#1124) 2021-07-18 12:18:39 +03:00
Niklas
499b7a6ecf update cyclonedx github action to v0.3.0 (#1127)
use version `^v0` instead of `latest` to avoid breaking the build when cyclonedx-gomod introduces breaking changes in a new major version. See https://github.com/CycloneDX/gh-gomod-generate-sbom/releases/tag/v0.3.0

Signed-off-by: nscuro <nscuro@protonmail.com>
2021-07-18 11:59:55 +03:00
Teppei Fukuda
cea9b0bc78 fix(policy): fix panic on the first run (#1116) 2021-07-12 21:38:20 +03:00
Teppei Fukuda
dea3428804 docs(misconf): add comparison with Conftest and tfsec (#1111) 2021-07-12 13:43:39 +03:00
Teppei Fukuda
47d600a9b4 feat(report): add schema version (#1110) 2021-07-12 12:27:27 +03:00
Teppei Fukuda
eae4bafff3 fix(scan): change unknown os from info to debug (#1109) 2021-07-12 12:26:48 +03:00
Teppei Fukuda
9e08bd44fb docs: add misconfiguration (#1101)
Co-authored-by: Itay Shakury <itay@itaysk.com>
2021-07-12 03:14:17 +03:00
Teppei Fukuda
d9883e4442 fix(config): rename include-successes with include-non-failures (#1107) 2021-07-11 16:55:13 +03:00
Teppei Fukuda
e6f7e556e8 feat(config): support --trace (#1106) 2021-07-11 16:07:30 +03:00
Teppei Fukuda
4b84e79cc3 fix(policy): reduce the Internet access (#1105)
* fix(policy): send a request only when it needs update

* fix(policy): update DownloadedAt after fetching image manifest
2021-07-10 23:17:04 +03:00
Teppei Fukuda
05ae22a85c chore: bump golangci-lint to v1.41.1 (#1104) 2021-07-10 21:23:00 +03:00
Teppei Fukuda
a0e5c3a2e2 feat: support config scanning (#931) 2021-07-09 08:18:53 +03:00
Teppei Fukuda
712f9eba35 feat(report): add artifact metadata (#1079) 2021-06-30 12:53:33 +03:00
Vinod Anandan
803b2f9a93 Generate SBOM (#1076)
* Generate SBOM

Generate and publish SBOM as part of the release.

* Publish bom.json

* Ignore SBOMs generated during CI
2021-06-22 09:53:08 +03:00
Teppei Fukuda
92f980f4b7 fix(db): multiple prefixed data sources (#1070) 2021-06-20 16:23:26 +03:00
Chris Novakovic
52e98f1bd9 Add EOL date for Alpine 3.14 (#1072)
Per https://alpinelinux.org/releases/, Alpine 3.14 is supported until
2023-05-01.

Closes #1071.
2021-06-20 11:15:22 +03:00
Dirk Mueller
6cd9a328a4 suse: mark sle 15.3 as maintained, add opensuse 15.3 (#1059)
SLE 15.3 is about to be released and will be maintained until
6 months after 15.4. this allows us to guess the 15 SP2 EOL date,
so updating that as well.
2021-06-17 12:09:46 +03:00
Teppei Fukuda
03a73667db docs: improve data sources (#1069)
* docs: improve data sources

* docs: add os data sources

* refactor
2021-06-16 16:43:42 +03:00
Teppei Fukuda
a29d6d8c5b chore(label): add kind/security-advisory (#1068) 2021-06-16 15:33:06 +03:00
Teppei Fukuda
2a08969ddc fix(asff): replace slice with substr (#1058) 2021-06-10 16:19:28 +03:00
Abhinav Khanna
3a94b7399b fix(helm-chart): parametrized ingress host path (#1049)
Signed-off-by: Abhinav Khanna <abhinav.khanna@salesforce.com>
2021-06-10 16:03:48 +03:00
Tauseef
41d000c97e feat: support Google Artifact Repository (#1055)
* Update Fanal library reference

This commit updates Fanal library version to latest which
includes support for Google artifact repository.

* chore(mod): tidy

Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-06-10 12:19:40 +03:00
David Wittman
78da283c1b Update ASFF template to use label for severity (#1047)
* Update ASFF template to use label for severity

Use of the `Normalized` and `Product` fields is deprecated in the [ASFF spec](https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-findings-format-attributes.html#asff-severity). Instead, we should just provide the severity as a `Label`, which simplifies the logic in this template quite a bit as well.

* fix(asff): use severity var

Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-06-10 12:12:53 +03:00
Teppei Fukuda
e362843705 BREAKING: migrate to a new JSON schema (#782)
* feat: introduce a new JSON schema

* test: update

* chore(mod): update fanal

* refactor: add a comment

* test(report): fix

* refactor(writer): add omitempty

* refactor: replace url

* test(scanner): fix
2021-06-08 18:03:24 +03:00
David Wittman
097b8d4881 docs: Fix link to AWS Security Hub template (#1046) 2021-06-07 10:14:18 +03:00
Teppei Fukuda
3b6122f86d refactor(server): support gzip (#1045) 2021-06-06 17:54:12 +03:00
Teppei Fukuda
f75a36945c chore(rpc): update protoc and twirp (#1044) 2021-06-06 16:33:25 +03:00
tonaim
e4c32cdb77 Added support for list all packages flag in client (#1032)
* Added support for list all packages flag in client

This commit is to support --list-all_pkgs argument in client command
Example command: trivy -d client --list-all-pkgs --remote http://localhost:8080 ubuntu:18.04.

* Updated argument in client.md

* Fixed all format issues
2021-06-03 22:47:48 +03:00
Carol Valencia
fb19abd09a chore: chart with 0.18.3 (#1033)
Co-authored-by: krol3 <krol3@users.noreply.github.com>
2021-06-01 08:29:21 +03:00
bmagistro
d2afc206b2 feat: add gitlab codequality template (#895)
* Add gitlab codequality template

* add unit test for gitlab codequality template

* update line endings to msdos (\r\n) from unix

* update gitlab docs for codeclimate template
2021-05-31 11:20:59 +03:00
Teppei Fukuda
43ff5f93e8 feat(plugin): add aqua plugin (#1029) 2021-05-31 10:54:46 +03:00
rahul2393
5e6a50b2f9 fix(go): if patchedVersion is empty mark it as vulnerable (#1030)
* fix(go): if patchedVersion is empty mark it as vulnerable

* fix(go): skip checking for vulnerable version if empty

* fix(go): refactored empty check at start of match

* fix(go): added unit test for empty patched/vulnerable version
2021-05-30 15:43:14 +03:00
Teppei Fukuda
23b9533791 docs(ubuntu): fix supported versions (#1028) 2021-05-30 14:13:45 +03:00
Huang Huang
d1f8cfcfdc Support Ubuntu 21.04 (#1027) 2021-05-30 11:10:19 +03:00
Teppei Fukuda
aa2336be92 chore: remove codecov (#1016) 2021-05-27 09:25:37 +03:00
Tomoya Amachi
e64617212e fix typo on github-actions.md (#1022) 2021-05-27 09:10:46 +03:00
Teppei Fukuda
85e45cad95 chore(ci): change to more granular tokens (#1014) 2021-05-24 02:35:44 +03:00
rahul2393
9fa512a652 chore(ci): add Go scanning and update dependencies (#1001)
* Fixed dependency

* Scan repo action added

* only check for Critical with exit-code=1

* Fix vulnerability in go.sum

* more fixes
2021-05-23 11:21:23 +03:00
skovati
349371bbc9 docs: Add HIGH severity to Trivy command in GitLab CI example to match comment (#1013)
* Add HIGH severity to Trivy command in GitLab CI example to match comment

* Change comment to accurately reflect Trivy command that fails only on CRITICAL vulnerabilities
2021-05-23 04:55:46 +03:00
Teppei Fukuda
4446961167 fix(image): disable go.sum scanning (#1007) 2021-05-20 10:01:19 +03:00
Teppei Fukuda
04473ada48 fix(gomod): handle go.sum with an empty line (#1006) 2021-05-20 09:39:06 +03:00
Teppei Fukuda
1b66b77f69 feat: prepare for config scanning (#1005)
* temp: disable config scanning
2021-05-20 09:05:36 +03:00
gboer
8fc6ea6489 Clarify that dev dependencies are excluded (#986)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-05-19 05:47:05 +03:00
rahul2393
eaf2da20a6 Include target value in Sarif template ruleID (#991)
* Include target value in Sarif template ruleID

* Fix format
2021-05-13 20:10:34 +03:00
rahul2393
083c157b05 chore(mkdocs): allow workflow_dispatch (#989)
* Updated docs for go libraries.

* Add option to manually trigger doc publish
2021-05-12 19:57:14 +03:00
rahul2393
e26e39a7f8 fix(vuln) unique vulnerabilities from different data sources (#984)
* Fix duplicate Rule in sarif template

* Fix integration tests

* Fixed tests

* Update certs validity upto 2100

* Moved deduplication logic to Filter

* Fix linting issue

* Fix liniting issue

* fix: deduplicate vulnerabilities

* refactor

* fix: add installed versions to uniq keys

* Fix tests

* Fix Unit tests.

* Revert port change

Co-authored-by: knqyf263 <knqyf263@gmail.com>
2021-05-12 13:10:05 +03:00
rahul2393
04e7ccabea feat(go): added support of gomod analyzer (#978)
* Added support of gomod analyzer.

* add imports

* fix gocyclo

* Ran go fmt
2021-05-11 04:18:13 +03:00
rahul2393
415e1d8ea3 Upgrade fanal dependency (#976) 2021-05-01 13:14:08 +03:00
Teppei Fukuda
3bb8852ef7 docs: mention upx binaries (#974) 2021-05-01 04:39:42 +03:00
rahul2393
c0fddd9467 Upgrade alpine to fix git and libcurl vulnerabilities in trivy docker image scan (#971)
* Upgrade alpine to fix git and libcurl vulnerabilities in trivy docker image scan

* remove patch version
2021-04-30 11:06:57 +03:00
Teppei Fukuda
41c066d4c8 fix(fs): skip dirs (#969) 2021-04-30 07:50:07 +03:00
659 changed files with 61071 additions and 145024 deletions

9
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,9 @@
# Global
* @knqyf263
# Helm chart
helm/trivy/ @krol3
# Kubernetes scanning
pkg/k8s/ @josedonizetti @chen-keinan
docs/docs/kubernetes/ @josedonizetti @chen-keinan

View File

@@ -0,0 +1,33 @@
---
name: Wrong Detection
labels: ["kind/bug"]
about: If Trivy doesn't detect something, or shows false positive detection
---
## Checklist
- [ ] I've read [the documentation regarding wrong detection](https://aquasecurity.github.io/trivy/latest/community/contribute/issue/#wrong-detection).
- [ ] I've confirmed that a security advisory in data sources was correct.
- Run Trivy with `-f json` that shows data sources and make sure that the security advisory is correct.
## Description
<!--
Briefly describe the CVE that aren't detected and information about artifacts with this CVE.
-->
## JSON Output of run with `-debug`:
```
(paste your output here)
```
## Output of `trivy -v`:
```
(paste your output here)
```
## Additional details (base image name, container registry info...):

15
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
- package-ecosystem: docker
directory: /
schedule:
interval: monthly
- package-ecosystem: gomod
open-pull-requests-limit: 10
directory: /
schedule:
interval: monthly

18
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,18 @@
## Description
## Related issues
- Close #XXX
## Related PRs
- [ ] #XXX
- [ ] #YYY
Remove this section if you don't have related PRs.
## Checklist
- [ ] I've read the [guidelines for contributing](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/) to this repository.
- [ ] I've followed the [conventions](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/#title) in the PR title.
- [ ] I've added tests that prove my fix is effective or that my feature works.
- [ ] I've updated the [documentation](https://github.com/aquasecurity/trivy/blob/main/docs) with the relevant information (if needed).
- [ ] I've added usage information (if the PR introduces new options)
- [ ] I've included a "before" and "after" example to the description (if the PR is a user interface change).

View File

@@ -12,18 +12,17 @@ jobs:
runs-on: ubuntu-18.04
steps:
- name: Checkout main
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
pip install mike
pip install mkdocs-macros-plugin
pip install -r docs/build/requirements.txt
env:
GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
- name: Configure the git user

View File

@@ -1,5 +1,10 @@
name: Deploy the latest documentation
on:
workflow_dispatch:
inputs:
version:
description: Version to be deployed
required: true
push:
tags:
- "v*"
@@ -9,25 +14,28 @@ jobs:
runs-on: ubuntu-18.04
steps:
- name: Checkout main
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
pip install mike
pip install mkdocs-macros-plugin
pip install -r docs/build/requirements.txt
env:
GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
- name: Configure the git user
run: |
git config user.name "knqyf263"
git config user.email "knqyf263@gmail.com"
- name: Deploy the latest documents
- name: Deploy the latest documents from new tag push
if: ${{ github.event.inputs.version == '' }}
run: |
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
mike deploy --push --update-aliases $VERSION latest
- name: Deploy the latest documents from manual trigger
if: ${{ github.event.inputs.version != '' }}
run: mike deploy --push --update-aliases ${{ github.event.inputs.version }} latest

View File

@@ -1,47 +1,83 @@
name: Publish Chart Helm
name: Publish Helm chart
on:
push:
branches: [main]
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'helm/trivy/**'
workflow_dispatch:
push:
tags:
- "v*"
env:
HELM_REP: helm-charts
GH_OWNER: aquasecurity
CHART_DIR: helm/trivy
KIND_VERSION: "v0.11.1"
KIND_IMAGE: "kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6"
jobs:
release:
test-chart:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab
with:
version: v3.5.0
- name: Set up python
uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Setup Chart Linting
id: lint
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a
- name: Setup Kubernetes cluster (KIND)
uses: helm/kind-action@94729529f85113b88f4f819c17ce61382e6d8478
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}
- name: Run chart-testing
run: ct lint-and-install --validate-maintainers=false --charts helm/trivy
- name: Run chart-testing (Ingress enabled)
run: |
sed -i -e '117s,false,'true',g' ./helm/trivy/values.yaml
ct lint-and-install --validate-maintainers=false --charts helm/trivy
publish-chart:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs:
- test-chart
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
fetch-depth: 0
- name: Install chart-releaser
run: |
wget https://github.com/helm/chart-releaser/releases/download/v1.1.1/chart-releaser_1.1.1_linux_amd64.tar.gz
tar xzvf chart-releaser_1.1.1_linux_amd64.tar.gz cr
wget https://github.com/helm/chart-releaser/releases/download/v1.3.0/chart-releaser_1.3.0_linux_amd64.tar.gz
echo "baed2315a9bb799efb71d512c5198a2a3b8dcd139d7f22f878777cffcd649a37 chart-releaser_1.3.0_linux_amd64.tar.gz" | sha256sum -c -
tar xzvf chart-releaser_1.3.0_linux_amd64.tar.gz cr
- name: Package helm chart
run: |
./cr package ${{ env.CHART_DIR }}
- name: Upload helm chart
# Failed with upload the same version: https://github.com/helm/chart-releaser/issues/101
continue-on-error: true
## Upload the tar in the Releases repository
run: |
./cr upload -o ${{ env.GH_OWNER }} -r ${{ env.HELM_REP }} --token ${{ secrets.ORG_GITHUB_TOKEN }} -p .cr-release-packages
./cr upload -o ${{ env.GH_OWNER }} -r ${{ env.HELM_REP }} --token ${{ secrets.ORG_REPO_TOKEN }} -p .cr-release-packages
- name: Index helm chart
run: |
./cr index -o ${{ env.GH_OWNER }} -r ${{ env.HELM_REP }} -c https://${{ env.GH_OWNER }}.github.io/${{ env.HELM_REP }}/ -i index.yaml
- name: Push index file
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 #v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.ORG_GITHUB_TOKEN }}
API_TOKEN_GITHUB: ${{ secrets.ORG_REPO_TOKEN }}
with:
source_file: 'index.yaml'
destination_repo: '${{ env.GH_OWNER }}/${{ env.HELM_REP }}'

View File

@@ -4,7 +4,7 @@ on:
tags:
- "v*"
env:
GO_VERSION: "1.16"
GO_VERSION: "1.18"
GH_USER: "aqua-bot"
jobs:
release:
@@ -12,64 +12,74 @@ jobs:
runs-on: ubuntu-18.04 # 20.04 doesn't provide createrepo for now
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
permissions:
id-token: write # For cosign
packages: write # For GHCR
contents: read # Not required for public repositories, but for clarity
steps:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install rpm reprepro createrepo distro-info
- uses: sigstore/cosign-installer@536b37ec5d5b543420bdfd9b744c5965bd4d8730
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Show available Docker Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache Go modules
uses: actions/cache@v2
uses: actions/cache@v3.0.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to docker.io registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ env.GH_USER }}
password: ${{ secrets.ORG_GITHUB_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to ECR
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ secrets.ECR_ACCESS_KEY_ID }}
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
- name: Release
uses: goreleaser/goreleaser-action@v2
- name: Generate SBOM
uses: CycloneDX/gh-gomod-generate-sbom@v1
with:
version: v0.164.0
args: release --rm-dist
args: mod -licenses -json -output bom.json
version: ^v1
- name: Release
uses: goreleaser/goreleaser-action@v3
with:
version: v1.4.1
args: release --rm-dist --timeout 60m
env:
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
- name: Checkout trivy-repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/trivy-repo
path: trivy-repo
fetch-depth: 0
token: ${{ secrets.ORG_GITHUB_TOKEN }}
token: ${{ secrets.ORG_REPO_TOKEN }}
- name: Setup git settings
run: |
git config --global user.email "knqyf263@gmail.com"

23
.github/workflows/scan.yaml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Scan vulnerabilities
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
name: Scan Go vulnerabilities
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner and create GitHub issues
uses: knqyf263/trivy-issue-action@v0.0.4
with:
assignee: knqyf263
severity: CRITICAL
skip-dirs: integration,examples
label: vulnerability
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

86
.github/workflows/semantic-pr.yaml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: "Lint PR title"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types:
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
BREAKING
scopes:
vuln
misconf
secret
image
fs
repo
sbom
server
k8s
alpine
redhat
alma
rocky
mariner
oracle
debian
ubuntu
amazon
suse
photon
distroless
ruby
php
python
nodejs
rust
dotnet
java
go
os
lang
kubernetes
dockerfile
terraform
cloudformation
docker
podman
containerd
oci
cli
flag
helm
report
db
deps

View File

@@ -7,7 +7,7 @@ jobs:
timeout-minutes: 1
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been labeled with inactivity.'

View File

@@ -1,49 +1,89 @@
name: Test
on: pull_request
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
pull_request:
env:
GO_VERSION: "1.16"
GO_VERSION: "1.18"
TINYGO_VERSION: "0.23.0"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: go mod tidy
run: |
go mod tidy
if [ -n "$(git status --porcelain)" ]; then
exit 1
fi
- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.31
version: v1.45
args: --deadline=30m
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
- name: Install TinyGo
run: |
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb
sudo dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb
- name: Run unit tests
run: make test
- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
files: ./coverage.txt
integration:
name: Integration Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run integration tests
run: make test-integration
module-test:
name: Module Integration Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Install TinyGo
run: |
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb
sudo dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb
- name: Checkout
uses: actions/checkout@v3
- name: Run module integration tests
run: |
make test-module-integration
build-test:
name: Build Test
runs-on: ubuntu-latest
@@ -51,46 +91,44 @@ jobs:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Show available Docker Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v3
with:
version: v0.164.0
args: release --snapshot --rm-dist --skip-publish
version: v1.4.1
args: release --snapshot --rm-dist --skip-publish --timeout 60m
build-documents:
name: Documentation Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
pip install mkdocs-material
pip install mike
pip install mkdocs-macros-plugin
pip install -r docs/build/requirements.txt
- name: Configure the git user
run: |
git config user.name "knqyf263"

13
.gitignore vendored
View File

@@ -4,7 +4,7 @@
*.dll
*.so
*.dylib
trivy
/trivy
## chart release
.cr-release-packages
@@ -23,4 +23,13 @@ thumbs.db
# test fixtures
coverage.txt
integration/testdata/fixtures/
integration/testdata/fixtures/images
# SBOMs generated during CI
/bom.json
# goreleaser output
dist
# WebAssembly
*.wasm

View File

@@ -6,12 +6,10 @@ linters-settings:
check-shadowing: false
gofmt:
simplify: false
golint:
min-confidence: 0
revive:
ignore-generated-header: true
gocyclo:
min-complexity: 10
maligned:
suggest-new: true
min-complexity: 20
dupl:
threshold: 100
goconst:
@@ -21,6 +19,10 @@ linters-settings:
locale: US
goimports:
local-prefixes: github.com/aquasecurity
gosec:
excludes:
- G204
- G402
linters:
disable-all: true
@@ -32,21 +34,22 @@ linters:
- errcheck
- varcheck
- deadcode
- golint
- revive
- gosec
- unconvert
- goconst
- gocyclo
- gofmt
- goimports
- maligned
- misspell
run:
go: 1.18
skip-files:
- ".*._mock.go$"
- ".*._test.go$"
- "integration/*"
- "examples/*"
issues:
exclude-rules:
@@ -56,9 +59,6 @@ issues:
- linters:
- gosec
text: "Deferring unsafe method"
- linters:
- gosec
text: "G204: Subprocess launched with variable"
- linters:
- errcheck
text: "Close` is not checked"

View File

@@ -1,28 +1 @@
Thank you for taking interest in contributing to Trivy !
## Issues
- Feel free to open issues for any reason. When you open a new issue, you'll have to select an issue kind: bug/feature/support and fill the required information based on the selected template.
- Please spend a small amount of time giving due diligence to the issue tracker. Your issue might be a duplicate. If it is, please add your comment to the existing issue.
- Remember users might be searching for your issue in the future, so please give it a meaningful title to help others.
- The issue should clearly explain the reason for opening, the proposal if you have any, and any relevant technical information.
## Pull Requests
1. Every Pull Request should have an associated bug or feature issue unless you are fixing a trivial documentation issue.
1. Your PR is more likely to be accepted if it focuses on just one change.
1. Describe what the PR does. There's no convention enforced, but please try to be concise and descriptive. Treat the PR description as a commit message. Titles that starts with "fix"/"add"/"improve"/"remove" are good examples.
1. Please add the associated Issue in the PR description.
1. There's no need to add or tag reviewers.
1. If a reviewer commented on your code or asked for changes, please remember to mark the discussion as resolved after you address it. PRs with unresolved issues should not be merged (even if the comment is unclear or requires no action from your side).
1. Please include a comment with the results before and after your change.
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 and the CLI help accordingly.
## Understand where your pull request belongs
Trivy is composed of several different repositories that work together:
- [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. This 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.
- [fanal](https://github.com/aquasecurity/fanal) is a library for extracting system information containers. It is being used by Trivy to find testable subjects in the container image.
See [Issues](https://aquasecurity.github.io/trivy/latest/community/contribute/issue/) and [Pull Requests](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/)

View File

@@ -1,4 +1,4 @@
FROM alpine:3.12
FROM alpine:3.16.0
RUN apk --no-cache add ca-certificates git
COPY trivy /usr/local/bin/trivy
COPY contrib/*.tpl contrib/

12
Dockerfile.protoc Normal file
View File

@@ -0,0 +1,12 @@
FROM golang:1.18.2
# Install protoc (cf. http://google.github.io/proto-lens/installing-protoc.html)
ENV PROTOC_ZIP=protoc-3.19.4-linux-x86_64.zip
RUN apt-get update && apt-get install -y unzip
RUN curl --retry 5 -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/$PROTOC_ZIP \
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
&& rm -f $PROTOC_ZIP
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

View File

@@ -1,21 +1,42 @@
VERSION := $(shell git describe --tags)
LDFLAGS=-ldflags "-s -w -X=main.version=$(VERSION)"
LDFLAGS := -ldflags "-s -w -X=main.version=$(VERSION)"
GOPATH=$(shell go env GOPATH)
GOBIN=$(GOPATH)/bin
GOSRC=$(GOPATH)/src
GOPATH := $(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
u := $(if $(update),-u)
# Tools
$(GOBIN)/wire:
GO111MODULE=off go get github.com/google/wire/cmd/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.45.2
$(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/... ./internal/...
wire gen ./pkg/commands/... ./pkg/rpc/...
.PHONY: mock
mock: $(GOBIN)/mockery
@@ -26,23 +47,39 @@ deps:
go get ${u} -d
go mod tidy
$(GOBIN)/golangci-lint:
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v1.21.0
.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: $(TEST_MODULES)
go test -v -short -coverprofile=coverage.txt -covermode=atomic ./...
integration/testdata/fixtures/*.tar.gz:
git clone https://github.com/aquasecurity/trivy-test-images.git integration/testdata/fixtures
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/*.tar.gz
test-integration: integration/testdata/fixtures/images/*.tar.gz
go test -v -tags=integration ./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/...
.PHONY: lint
lint: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run
$(GOBIN)/golangci-lint run --timeout 5m
.PHONY: fmt
fmt:
@@ -54,7 +91,13 @@ build:
.PHONY: protoc
protoc:
find ./rpc/ -name "*.proto" -type f -exec protoc --proto_path=$(GOSRC):. --twirp_out=. --go_out=. {} \;
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:
@@ -62,17 +105,20 @@ install:
.PHONY: clean
clean:
rm -rf integration/testdata/fixtures/
$(GOBIN)/labeler:
GO111MODULE=off go get github.com/knqyf263/labeler
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
## Runs MkDocs development server to preview the documentation page
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

210
README.md
View File

@@ -1,134 +1,144 @@
<img src="docs/imgs/logo.png" width="150">
<div align="center">
<img src="docs/imgs/logo.png" width="200">
[![GitHub Release][release-img]][release]
[![Go Report Card](https://goreportcard.com/badge/github.com/aquasecurity/trivy)](https://goreportcard.com/report/github.com/aquasecurity/trivy)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)][license]
[![codecov](https://codecov.io/gh/aquasecurity/trivy/branch/main/graph/badge.svg)](https://codecov.io/gh/aquasecurity/trivy)
[![Test][test-img]][test]
[![Go Report Card][go-report-img]][go-report]
[![License: Apache-2.0][license-img]][license]
[![GitHub All Releases][github-all-releases-img]][release]
![Docker Pulls][docker-pulls]
[release]: https://github.com/aquasecurity/trivy/releases
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy.svg?logo=github
[github-all-releases-img]: https://img.shields.io/github/downloads/aquasecurity/trivy/total?logo=github
[docker-pulls]: https://img.shields.io/docker/pulls/aquasec/trivy?logo=docker&label=docker%20pulls%20%2F%20trivy
[license]: https://github.com/aquasecurity/trivy/blob/main/LICENSE
[📖 Documentation][docs]
</div>
Trivy (`tri` pronounced like **tri**gger, `vy` pronounced like en**vy**) is a comprehensive security scanner. It is reliable, fast, extremely easy to use, and it works wherever you need it.
A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI.
Trivy has different *scanners* that look for different security issues, and different *targets* where it can find those issues.
# Abstract
`Trivy` (`tri` pronounced like **tri**gger, `vy` pronounced like en**vy**) is a simple and comprehensive vulnerability scanner for containers and other artifacts.
A software vulnerability is a glitch, flaw, or weakness present in the software or in an Operating System.
`Trivy` detects vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and application dependencies (Bundler, Composer, npm, yarn, etc.).
`Trivy` is easy to use. Just install the binary and you're ready to scan. All you need to do for scanning is to specify a target such as an image name of the container.
Targets:
- Container Image
- Filesystem
- Git repository (remote)
- Kubernetes cluster or resource
<img src="docs/imgs/overview.png" width="700">
Scanners:
- OS packages and software dependencies in use (SBOM)
- Known vulnerabilities (CVEs)
- IaC misconfigurations
- Sensitive information and secrets
Trivy can be run in two different modes:
Much more scanners and targets are coming up. Missing something? Let us know!
- [Standalone](https://aquasecurity.github.io/trivy/latest/modes/standalone/)
- [Client/Server](https://aquasecurity.github.io/trivy/latest/modes/client-server/)
Read more in the [Trivy Documentation][docs]
Trivy can scan three different artifacts:
## Quick Start
- [Container Images](https://aquasecurity.github.io/trivy/latest/scanning/image/)
- [Filesystem](https://aquasecurity.github.io/trivy/latest/scanning/filesystem/)
- [Git Repositories](https://aquasecurity.github.io/trivy/latest/scanning/git-repository/)
### Get Trivy
<img src="docs/imgs/usage.gif" width="700">
<img src="docs/imgs/usage1.png" width="600">
<img src="docs/imgs/usage2.png" width="600">
Get Trivy by your favorite installation method. See [installation] section in the documentation for details. For example:
It is considered to be used in CI. Before pushing to a container registry or deploying your application, you can scan your local container image and other artifacts easily.
See [here](https://aquasecurity.github.io/trivy/latest/integrations/) for details.
- `apt-get install trivy`
- `yum install trivy`
- `brew install aquasecurity/trivy/trivy`
- `docker run aquasec/trivy`
- Download binary from https://github.com/aquasecurity/trivy/releases/latest/
# Features
### General usage
- Detect comprehensive vulnerabilities
- OS packages (Alpine, **Red Hat Universal Base Image**, Red Hat Enterprise Linux, CentOS, Oracle Linux, Debian, Ubuntu, Amazon Linux, openSUSE Leap, SUSE Enterprise Linux, Photon OS and Distroless)
- **Application dependencies** (Bundler, Composer, Pipenv, Poetry, npm, yarn, Cargo, NuGet, Maven, and Go)
- Simple
- Specify only an image name or artifact name
- See [Quick Start](#quick-start) and [Examples](#examples)
- Fast
- The first scan will finish within 10 seconds (depending on your network). Consequent scans will finish in single seconds.
- Unlike other scanners that take long to fetch vulnerability information (~10 minutes) on the first run, and encourage you to maintain a durable vulnerability database, Trivy is stateless and requires no maintenance or preparation.
- Easy installation
- `apt-get install`, `yum install` and `brew install` is possible (See [Installation](#installation))
- **No pre-requisites** such as installation of DB, libraries, etc.
- High accuracy
- **Especially Alpine Linux and RHEL/CentOS**
- Other OSes are also high
- DevSecOps
- **Suitable for CI** such as Travis CI, CircleCI, Jenkins, GitLab CI, etc.
- See [CI Example](#continuous-integration-ci)
- Support multiple formats
- container image
- A local image in Docker Engine which is running as a daemon
- A local image in Podman (>=2.0) which is exposing a socket
- A remote image in Docker Registry such as Docker Hub, ECR, GCR and ACR
- A tar archive stored in the `docker save` / `podman save` formatted file
- An image directory compliant with [OCI Image Format](https://github.com/opencontainers/image-spec)
- local filesystem
- remote git repository
Please see [LICENSE][license] for Trivy licensing information. Note that Trivy uses vulnerability information from a variety of sources, some of which are licensed for non-commercial use only.
# Documentation
The official documentation, which provides detailed installation, configuration, and quick start guides, is available at https://aquasecurity.github.io/trivy/.
# Installation
See [here](https://aquasecurity.github.io/trivy/latest/installation/)
# Quick Start
Simply specify an image name (and a tag).
```
$ trivy image [YOUR_IMAGE_NAME]
```bash
trivy <target> [--security-checks <scanner1,scanner2>] TARGET_NAME
```
For example:
Examples:
```
```bash
$ trivy image python:3.4-alpine
```
<details>
<summary>Result</summary>
```
2019-05-16T01:20:43.180+0900 INFO Updating vulnerability database...
2019-05-16T01:20:53.029+0900 INFO Detecting Alpine vulnerabilities...
python:3.4-alpine3.9 (alpine 3.9.2)
===================================
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 0, CRITICAL: 0)
+---------+------------------+----------+-------------------+---------------+--------------------------------+
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
+---------+------------------+----------+-------------------+---------------+--------------------------------+
| openssl | CVE-2019-1543 | MEDIUM | 1.1.1a-r1 | 1.1.1b-r1 | openssl: ChaCha20-Poly1305 |
| | | | | | with long nonces |
+---------+------------------+----------+-------------------+---------------+--------------------------------+
```
https://user-images.githubusercontent.com/1161307/171013513-95f18734-233d-45d3-aaf5-d6aec687db0e.mov
</details>
# Examples
See [here](https://aquasecurity.github.io/trivy/latest/examples/filter/)
```bash
$ trivy fs --security-checks vuln,secret,config myproject/
```
# Continuous Integration (CI)
See [here](https://aquasecurity.github.io/trivy/latest/integrations/)
<details>
<summary>Result</summary>
# Vulnerability Detection
See [here](https://aquasecurity.github.io/trivy/latest/vuln-detection/)
https://user-images.githubusercontent.com/1161307/171013917-b1f37810-f434-465c-b01a-22de036bd9b3.mov
# Usage
See [here](https://aquasecurity.github.io/trivy/latest/usage/)
</details>
# Author
```bash
$ trivy k8s mycluster
```
[Teppei Fukuda](https://github.com/knqyf263) (knqyf263)
<details>
<summary>Result</summary>
![k8s summary](docs/imgs/trivy-k8s.png)
</details>
Find out more in the [Trivy Documentation][docs] - [Getting Started][getting-started]
## Highlights
- Comprehensive vulnerability detection
- OS packages (Alpine Linux, Red Hat Universal Base Image, Red Hat Enterprise Linux, CentOS, AlmaLinux, Rocky Linux, CBL-Mariner, Oracle Linux, Debian, Ubuntu, Amazon Linux, openSUSE Leap, SUSE Enterprise Linux, Photon OS and Distroless)
- **Language-specific packages** (Bundler, Composer, Pipenv, Poetry, npm, yarn, Cargo, NuGet, Maven, and Go)
- High accuracy, especially [Alpine Linux][alpine] and RHEL/CentOS
- Supply chain security (SBOM support)
- Support CycloneDX
- Support SPDX
- Misconfiguration detection (IaC scanning)
- Wide variety of security checks are provided **out of the box**
- Kubernetes, Docker, Terraform, and more
- User-defined policies using [OPA Rego][rego]
- Secret detection
- A wide variety of built-in rules are provided **out of the box**
- User-defined patterns
- Efficient scanning of container images
- Simple
- Available in apt, yum, brew, dockerhub
- **No pre-requisites** such as a database, system libraries, or eny environmental requirements. The binary runs anywhere.
- The first scan will finish within 10 seconds (depending on your network). Consequent scans will finish instantaneously.
- Fits your workflow
- **Great for CI** such as GitHub Actions, Jenkins, GitLab CI, etc.
- Available as extension for IDEs such as vscode, jetbrains, vim
- Available as extension for Docker Desktop, Rancher Desktop
- See [integrations] section in the documentation.
---
Trivy is an [Aqua Security][aquasec] open source project.
Learn about our open source work and portfolio [here][oss].
Contact us about any matter by opening a GitHub Discussion [here][discussions]
[test]: https://github.com/aquasecurity/trivy/actions/workflows/test.yaml
[test-img]: https://github.com/aquasecurity/trivy/actions/workflows/test.yaml/badge.svg
[go-report]: https://goreportcard.com/report/github.com/aquasecurity/trivy
[go-report-img]: https://goreportcard.com/badge/github.com/aquasecurity/trivy
[release]: https://github.com/aquasecurity/trivy/releases
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy.svg?logo=github
[github-all-releases-img]: https://img.shields.io/github/downloads/aquasecurity/trivy/total?logo=github
[docker-pulls]: https://img.shields.io/docker/pulls/aquasec/trivy?logo=docker&label=docker%20pulls%20%2F%20trivy
[license]: https://github.com/aquasecurity/trivy/blob/main/LICENSE
[license-img]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
[getting-started]: https://aquasecurity.github.io/trivy/latest/getting-started/installation/
[docs]: https://aquasecurity.github.io/trivy
[integrations]:https://aquasecurity.github.io/trivy/latest/docs/integrations/
[installation]:https://aquasecurity.github.io/trivy/latest/getting-started/installation/
[releases]: https://github.com/aquasecurity/trivy/releases
[alpine]: https://ariadne.space/2021/06/08/the-vulnerability-remediation-lifecycle-of-alpine-containers/
[rego]: https://www.openpolicyagent.org/docs/latest/#rego
[aquasec]: https://aquasec.com
[oss]: https://www.aquasec.com/products/open-source-projects/
[discussions]: https://github.com/aquasecurity/trivy/discussions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
DEBIAN_RELEASES=$(debian-distro-info --supported)
UBUNTU_RELEASES=$(ubuntu-distro-info --supported)
UBUNTU_RELEASES=$(sort -u <(ubuntu-distro-info --supported-esm) <(ubuntu-distro-info --supported))
cd trivy-repo/deb
@@ -9,12 +9,14 @@ for release in ${DEBIAN_RELEASES[@]} ${UBUNTU_RELEASES[@]}; do
echo "Removing deb package of $release"
reprepro -A i386 remove $release trivy
reprepro -A amd64 remove $release trivy
reprepro -A arm64 remove $release trivy
done
for release in ${DEBIAN_RELEASES[@]} ${UBUNTU_RELEASES[@]}; do
echo "Adding deb package to $release"
reprepro includedeb $release ../../dist/*Linux-64bit.deb
reprepro includedeb $release ../../dist/*Linux-32bit.deb
reprepro includedeb $release ../../dist/*Linux-ARM64.deb
done
git add .

View File

@@ -1,12 +0,0 @@
coverage:
status:
project:
default:
informational: true
target: auto
threshold: 100%
patch:
default:
informational: true
target: auto
threshold: 100%

View File

@@ -10,7 +10,7 @@ Trivy_container_scanning:
IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
allow_failure: true
before_script:
- export TRIVY_VERSION=${TRIVY_VERSION:-v0.4.3}
- export TRIVY_VERSION=${TRIVY_VERSION:-v0.19.2}
- apk add --no-cache curl docker-cli
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin ${TRIVY_VERSION}

View File

@@ -1,78 +1,124 @@
[
{{- $t_first := true -}}
{{- range . -}}
{{- $target := .Target -}}
{{- range .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{- else -}}
,
{{- end -}}
{{- $trivyProductSev := 0 -}}
{{- $trivyNormalizedSev := 0 -}}
{{- if eq .Severity "LOW" -}}
{{- $trivyProductSev = 1 -}}
{{- $trivyNormalizedSev = 10 -}}
{{- else if eq .Severity "MEDIUM" -}}
{{- $trivyProductSev = 4 -}}
{{- $trivyNormalizedSev = 40 -}}
{{- else if eq .Severity "HIGH" -}}
{{- $trivyProductSev = 7 -}}
{{- $trivyNormalizedSev = 70 -}}
{{- else if eq .Severity "CRITICAL" -}}
{{- $trivyProductSev = 9 -}}
{{- $trivyNormalizedSev = 90 -}}
{{- end }}
{{- $description := .Description -}}
{{- if gt (len $description ) 1021 -}}
{{- $description = (slice $description 0 1021) | printf "%v .." -}}
{{- end}}
{
"SchemaVersion": "2018-10-08",
"Id": "{{ $target }}/{{ .VulnerabilityID }}",
"ProductArn": "arn:aws:securityhub:{{ getEnv "AWS_REGION" }}::product/aquasecurity/aquasecurity",
"GeneratorId": "Trivy",
"AwsAccountId": "{{ getEnv "AWS_ACCOUNT_ID" }}",
"Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ],
"CreatedAt": "{{ getCurrentTime }}",
"UpdatedAt": "{{ getCurrentTime }}",
"Severity": {
"Product": {{ $trivyProductSev }},
"Normalized": {{ $trivyNormalizedSev }}
},
"Title": "Trivy found a vulnerability to {{ .VulnerabilityID }} in container {{ $target }}",
"Description": {{ escapeString $description | printf "%q" }},
"Remediation": {
"Recommendation": {
"Text": "More information on this vulnerability is provided in the hyperlink",
"Url": "{{ .PrimaryURL }}"
}
},
"ProductFields": { "Product Name": "Trivy" },
"Resources": [
{
"Type": "Container",
"Id": "{{ $target }}",
"Partition": "aws",
"Region": "{{ getEnv "AWS_REGION" }}",
"Details": {
"Container": { "ImageName": "{{ $target }}" },
"Other": {
"CVE ID": "{{ .VulnerabilityID }}",
"CVE Title": {{ .Title | printf "%q" }},
"PkgName": "{{ .PkgName }}",
"Installed Package": "{{ .InstalledVersion }}",
"Patched Package": "{{ .FixedVersion }}",
"NvdCvssScoreV3": "{{ (index .CVSS "nvd").V3Score }}",
"NvdCvssVectorV3": "{{ (index .CVSS "nvd").V3Vector }}",
"NvdCvssScoreV2": "{{ (index .CVSS "nvd").V2Score }}",
"NvdCvssVectorV2": "{{ (index .CVSS "nvd").V2Vector }}"
{
"Findings": [
{{- $t_first := true -}}
{{- range . -}}
{{- $target := .Target -}}
{{- $image := .Target -}}
{{- if gt (len $image) 127 -}}
{{- $image = $image | regexFind ".{124}$" | printf "...%v" -}}
{{- end}}
{{- range .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{- else -}}
,
{{- end -}}
{{- $severity := .Severity -}}
{{- if eq $severity "UNKNOWN" -}}
{{- $severity = "INFORMATIONAL" -}}
{{- end -}}
{{- $description := .Description -}}
{{- if gt (len $description ) 512 -}}
{{- $description = (substr 0 512 $description) | printf "%v .." -}}
{{- end}}
{
"SchemaVersion": "2018-10-08",
"Id": "{{ $target }}/{{ .VulnerabilityID }}",
"ProductArn": "arn:aws:securityhub:{{ env "AWS_REGION" }}::product/aquasecurity/aquasecurity",
"GeneratorId": "Trivy/{{ .VulnerabilityID }}",
"AwsAccountId": "{{ env "AWS_ACCOUNT_ID" }}",
"Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ],
"CreatedAt": "{{ now | date "2006-01-02T15:04:05.999999999Z07:00" }}",
"UpdatedAt": "{{ now | date "2006-01-02T15:04:05.999999999Z07:00" }}",
"Severity": {
"Label": "{{ $severity }}"
},
"Title": "Trivy found a vulnerability to {{ .VulnerabilityID }} in container {{ $target }}",
"Description": {{ escapeString $description | printf "%q" }},
{{ if not (empty .PrimaryURL) -}}
"Remediation": {
"Recommendation": {
"Text": "More information on this vulnerability is provided in the hyperlink",
"Url": "{{ .PrimaryURL }}"
}
},
{{ end -}}
"ProductFields": { "Product Name": "Trivy" },
"Resources": [
{
"Type": "Container",
"Id": "{{ $target }}",
"Partition": "aws",
"Region": "{{ env "AWS_REGION" }}",
"Details": {
"Container": { "ImageName": "{{ $image }}" },
"Other": {
"CVE ID": "{{ .VulnerabilityID }}",
"CVE Title": {{ .Title | printf "%q" }},
"PkgName": "{{ .PkgName }}",
"Installed Package": "{{ .InstalledVersion }}",
"Patched Package": "{{ .FixedVersion }}",
"NvdCvssScoreV3": "{{ (index .CVSS (sourceID "nvd")).V3Score }}",
"NvdCvssVectorV3": "{{ (index .CVSS (sourceID "nvd")).V3Vector }}",
"NvdCvssScoreV2": "{{ (index .CVSS (sourceID "nvd")).V2Score }}",
"NvdCvssVectorV2": "{{ (index .CVSS (sourceID "nvd")).V2Vector }}"
}
}
}
}
],
"RecordState": "ACTIVE"
}
{{- end -}}
{{- end }}
]
],
"RecordState": "ACTIVE"
}
{{- end -}}
{{- range .Misconfigurations -}}
{{- if $t_first -}}{{- $t_first = false -}}{{- else -}},{{- end -}}
{{- $severity := .Severity -}}
{{- if eq $severity "UNKNOWN" -}}
{{- $severity = "INFORMATIONAL" -}}
{{- end -}}
{{- $description := .Description -}}
{{- if gt (len $description ) 512 -}}
{{- $description = (substr 0 512 $description) | printf "%v .." -}}
{{- end}}
{
"SchemaVersion": "2018-10-08",
"Id": "{{ $target }}/{{ .ID }}",
"ProductArn": "arn:aws:securityhub:{{ env "AWS_REGION" }}::product/aquasecurity/aquasecurity",
"GeneratorId": "Trivy/{{ .ID }}",
"AwsAccountId": "{{ env "AWS_ACCOUNT_ID" }}",
"Types": [ "Software and Configuration Checks" ],
"CreatedAt": "{{ now | date "2006-01-02T15:04:05.999999999Z07:00" }}",
"UpdatedAt": "{{ now | date "2006-01-02T15:04:05.999999999Z07:00" }}",
"Severity": {
"Label": "{{ $severity }}"
},
"Title": "Trivy found a misconfiguration in {{ $target }}: {{ .Title }}",
"Description": {{ escapeString $description | printf "%q" }},
"Remediation": {
"Recommendation": {
"Text": "{{ .Resolution }}",
"Url": "{{ .PrimaryURL }}"
}
},
"ProductFields": { "Product Name": "Trivy" },
"Resources": [
{
"Type": "Other",
"Id": "{{ $target }}",
"Partition": "aws",
"Region": "{{ env "AWS_REGION" }}",
"Details": {
"Other": {
"Message": "{{ .Message }}",
"Filename": "{{ $target }}",
"StartLine": "{{ .CauseMetadata.StartLine }}",
"EndLine": "{{ .CauseMetadata.EndLine }}"
}
}
}
],
"RecordState": "ACTIVE"
}
{{- end -}}
{{- end }}
]
}

View File

@@ -5,30 +5,42 @@ import data.lib.trivy
default ignore = false
nvd_v3_vector = v {
v := input.CVSS.nvd.v3
v := input.CVSS.nvd.V3Vector
}
redhat_v3_vector = v {
v := input.CVSS.redhat.V3Vector
}
# Ignore a vulnerability which requires high privilege
ignore {
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
cvss_vector.PrivilegesRequired == "High"
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector.PrivilegesRequired == "High"
# Check against RedHat scores as well as NVD
redhat_cvss_vector := trivy.parse_cvss_vector_v3(redhat_v3_vector)
redhat_cvss_vector.PrivilegesRequired == "High"
}
# Ignore a vulnerability which requires user interaction
ignore {
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
cvss_vector.UserInteraction == "Required"
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector.UserInteraction == "Required"
# Check against RedHat scores as well as NVD
redhat_cvss_vector := trivy.parse_cvss_vector_v3(redhat_v3_vector)
redhat_cvss_vector.UserInteraction == "Required"
}
ignore {
input.PkgName == "openssl"
# Split CVSSv3 vector
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
# Evaluate Attack Vector
ignore_attack_vectors := {"Physical", "Local"}
cvss_vector.AttackVector == ignore_attack_vectors[_]
nvd_cvss_vector.AttackVector == ignore_attack_vectors[_]
}
ignore {
@@ -50,11 +62,11 @@ ignore {
input.PkgName == "bash"
# Split CVSSv3 vector
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
# Evaluate Attack Vector
ignore_attack_vectors := {"Physical", "Local", "Adjacent"}
cvss_vector.AttackVector == ignore_attack_vectors[_]
nvd_cvss_vector.AttackVector == ignore_attack_vectors[_]
# Evaluate severity
input.Severity == {"LOW", "MEDIUM", "HIGH"}[_]
@@ -64,11 +76,11 @@ ignore {
input.PkgName == "django"
# Split CVSSv3 vector
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
# Evaluate Attack Vector
ignore_attack_vectors := {"Physical", "Local"}
cvss_vector.AttackVector == ignore_attack_vectors[_]
nvd_cvss_vector.AttackVector == ignore_attack_vectors[_]
# Evaluate severity
input.Severity == {"LOW", "MEDIUM"}[_]
@@ -86,7 +98,7 @@ ignore {
input.PkgName == "jquery"
# Split CVSSv3 vector
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
# Evaluate CWE-ID
deny_cwe_ids := {"CWE-79"} # XSS

View File

@@ -9,7 +9,11 @@ ignore_pkgs := {"bash", "bind-license", "rpm", "vim", "vim-minimal"}
ignore_severities := {"LOW", "MEDIUM"}
nvd_v3_vector = v {
v := input.CVSS.nvd.v3
v := input.CVSS.nvd.V3Vector
}
redhat_v3_vector = v {
v := input.CVSS.redhat.V3Vector
}
ignore {
@@ -22,20 +26,29 @@ ignore {
# Ignore a vulnerability which is not remotely exploitable
ignore {
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
cvss_vector.AttackVector != "Network"
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector.AttackVector != "Network"
redhat_cvss_vector := trivy.parse_cvss_vector_v3(redhat_v3_vector)
redhat_cvss_vector.AttackVector != "Network"
}
# Ignore a vulnerability which requires high privilege
ignore {
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
cvss_vector.PrivilegesRequired == "High"
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector.PrivilegesRequired == "High"
redhat_cvss_vector := trivy.parse_cvss_vector_v3(redhat_v3_vector)
redhat_cvss_vector.PrivilegesRequired == "High"
}
# Ignore a vulnerability which requires user interaction
ignore {
cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
cvss_vector.UserInteraction == "Required"
nvd_cvss_vector := trivy.parse_cvss_vector_v3(nvd_v3_vector)
nvd_cvss_vector.UserInteraction == "Required"
redhat_cvss_vector := trivy.parse_cvss_vector_v3(redhat_v3_vector)
redhat_cvss_vector.UserInteraction == "Required"
}
# Ignore CSRF

View File

@@ -0,0 +1,71 @@
{{- /* Template based on https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types */ -}}
[
{{- $t_first := true }}
{{- range . }}
{{- $target := .Target }}
{{- range .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{ else -}}
,
{{- end }}
{
"type": "issue",
"check_name": "container_scanning",
"categories": [ "Security" ],
"description": {{ list .VulnerabilityID .PkgName .InstalledVersion .Title | join " - " | printf "%q" }},
"fingerprint": "{{ list .VulnerabilityID .PkgName .InstalledVersion $target | join "" | sha1sum }}",
"content": {{ .Description | printf "%q" }},
"severity": {{ if eq .Severity "LOW" -}}
"info"
{{- else if eq .Severity "MEDIUM" -}}
"minor"
{{- else if eq .Severity "HIGH" -}}
"major"
{{- else if eq .Severity "CRITICAL" -}}
"critical"
{{- else -}}
"info"
{{- end }},
"location": {
"path": "{{ $target }}",
"lines": {
"begin": 0
}
}
}
{{- end -}}
{{- range .Misconfigurations -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{ else -}}
,
{{- end }}
{
"type": "issue",
"check_name": "container_scanning",
"categories": [ "Security" ],
"description": {{ list .ID .Title | join ": " | printf "%q" }},
"fingerprint": "{{ list .ID .Title $target | join "" | sha1sum }}",
"content": {{ .Description | printf "%q" }},
"severity": {{ if eq .Severity "LOW" -}}
"info"
{{- else if eq .Severity "MEDIUM" -}}
"minor"
{{- else if eq .Severity "HIGH" -}}
"major"
{{- else if eq .Severity "CRITICAL" -}}
"critical"
{{- else -}}
"info"
{{- end }},
"location": {
"path": "{{ $target }}",
"lines": {
"begin": {{ .CauseMetadata.StartLine }}
}
}
}
{{- end -}}
{{- end }}
]

View File

@@ -52,7 +52,7 @@
}
a.toggle-more-links { cursor: pointer; }
</style>
<title>{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ getCurrentTime }}</title>
<title>{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }} </title>
<script>
window.onload = function() {
document.querySelectorAll('td.links').forEach(function(linkCell) {
@@ -82,7 +82,7 @@
</script>
</head>
<body>
<h1>{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ getCurrentTime }}</h1>
<h1>{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }}</h1>
<table>
{{- range . }}
<tr class="group-header"><th colspan="6">{{ escapeXML .Type }}</th></tr>
@@ -112,6 +112,31 @@
</tr>
{{- end }}
{{- end }}
{{- if (eq (len .Misconfigurations ) 0) }}
<tr><th colspan="6">No Misconfigurations found</th></tr>
{{- else }}
<tr class="sub-header">
<th>Type</th>
<th>Misconf ID</th>
<th>Check</th>
<th>Severity</th>
<th>Message</th>
</tr>
{{- range .Misconfigurations }}
<tr class="severity-{{ escapeXML .Severity }}">
<td class="misconf-type">{{ escapeXML .Type }}</td>
<td>{{ escapeXML .ID }}</td>
<td class="misconf-check">{{ escapeXML .Title }}</td>
<td class="severity">{{ escapeXML .Severity }}</td>
<td class="link" data-more-links="off" style="white-space:normal;"">
{{ escapeXML .Message }}
<br>
<a href={{ escapeXML .PrimaryURL | printf "%q" }}>{{ escapeXML .PrimaryURL }}</a>
</br>
</td>
</tr>
{{- end }}
{{- end }}
{{- end }}
</table>
{{- else }}

View File

@@ -182,11 +182,11 @@ log_tag() {
}
log_debug() {
log_priority 7 || return 0
echoerr "$(log_prefix)" "$(log_tag 7)" "$@"
echo "$(log_prefix)" "$(log_tag 7)" "$@"
}
log_info() {
log_priority 6 || return 0
echoerr "$(log_prefix)" "$(log_tag 6)" "$@"
echo "$(log_prefix)" "$(log_tag 6)" "$@"
}
log_err() {
log_priority 3 || return 0

View File

@@ -14,5 +14,18 @@
</testcase>
{{- end }}
</testsuite>
{{- $failures := len .Misconfigurations }}
<testsuite tests="{{ $failures }}" failures="{{ $failures }}" name="{{ .Target }}" errors="0" skipped="0" time="">
{{- if not (eq .Type "") }}
<properties>
<property name="type" value="{{ .Type }}"></property>
</properties>
{{- end -}}
{{ range .Misconfigurations }}
<testcase classname="{{ .Type }}" name="[{{ .Severity }}] {{ .ID }}" time="">
<failure message="{{ escapeXML .Title }}" type="description">{{ escapeXML .Description }}</failure>
</testcase>
{{- end }}
</testsuite>
{{- end }}
</testsuites>

View File

@@ -1,95 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "Trivy",
"informationUri": "https://github.com/aquasecurity/trivy",
"fullName": "Trivy Vulnerability Scanner",
"version": "0.15.0",
"rules": [
{{- $t_first := true }}
{{- range . }}
{{- $vulnerabilityType := .Type }}
{{- range .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{ else -}}
,
{{- end }}
{
"id": "{{ .VulnerabilityID }}/{{ .PkgName }}",
"name": "{{ toSarifRuleName $vulnerabilityType }}",
"shortDescription": {
"text": {{ printf "%v Package: %v" .VulnerabilityID .PkgName | printf "%q" }}
},
"fullDescription": {
"text": {{ endWithPeriod (escapeString .Title) | printf "%q" }}
},
"defaultConfiguration": {
"level": "{{ toSarifErrorLevel .Vulnerability.Severity }}"
}
{{- with $help_uri := .PrimaryURL -}}
,
{{ $help_uri | printf "\"helpUri\": %q," -}}
{{- else -}}
,
{{- end }}
"help": {
"text": {{ printf "Vulnerability %v\nSeverity: %v\nPackage: %v\nInstalled Version: %v\nFixed Version: %v\nLink: [%v](%v)" .VulnerabilityID .Vulnerability.Severity .PkgName .InstalledVersion .FixedVersion .VulnerabilityID .PrimaryURL | printf "%q"}},
"markdown": {{ printf "**Vulnerability %v**\n| Severity | Package | Installed Version | Fixed Version | Link |\n| --- | --- | --- | --- | --- |\n|%v|%v|%v|%v|[%v](%v)|\n" .VulnerabilityID .Vulnerability.Severity .PkgName .InstalledVersion .FixedVersion .VulnerabilityID .PrimaryURL | printf "%q"}}
},
"properties": {
"tags": [
"vulnerability",
"{{ .Vulnerability.Severity }}",
{{ .PkgName | printf "%q" }}
],
"precision": "very-high"
}
}
{{- end -}}
{{- end -}}
]
}
},
"results": [
{{- $t_first := true }}
{{- range . }}
{{- $filePath := .Target }}
{{- range $index, $vulnerability := .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
{{ else -}}
,
{{- end }}
{
"ruleId": "{{ $vulnerability.VulnerabilityID }}/{{ $vulnerability.PkgName }}",
"ruleIndex": {{ $index }},
"level": "{{ toSarifErrorLevel $vulnerability.Vulnerability.Severity }}",
"message": {
"text": {{ endWithPeriod (escapeString $vulnerability.Description) | printf "%q" }}
},
"locations": [{
"physicalLocation": {
"artifactLocation": {
"uri": "{{ toPathUri $filePath }}",
"uriBaseId": "ROOTPATH"
}
}
}]
}
{{- end -}}
{{- end -}}
],
"columnKind": "utf16CodeUnits",
"originalUriBaseIds": {
"ROOTPATH": {
"uri": "/"
}
}
}
]
}

View File

@@ -1,57 +0,0 @@
# Air-Gapped Environment
Trivy can be used in air-gapped environments.
## Download the vulnerability database
At first, you need to download the vulnerability database for use in air-gapped environments.
Go to [trivy-db][trivy-db] and download `trivy-offline.db.tgz` in the latest release.
If you download `trivy-light-offline.db.tgz`, you have to run Trivy with `--light` option.
```
$ wget https://github.com/aquasecurity/trivy-db/releases/latest/download/trivy-offline.db.tgz
```
## Transfer the DB file into the air-gapped environment
The way of transfer depends on the environment.
```
$ rsync -av -e ssh /path/to/trivy-offline.db.tgz [user]@[host]:dst
```
## Put the DB file in Trivy's cache directory
You have to know where to put the DB file. The following command shows the default cache directory.
```
$ ssh user@host
$ trivy -h | grep cache
--cache-dir value cache directory (default: "/home/myuser/.cache/trivy") [$TRIVY_CACHE_DIR]
```
Put the DB file in the cache directory + `/db`.
```
$ mkdir -p /home/myuser/.cache/trivy/db
$ cd /home/myuser/.cache/trivy/db
$ mv /path/to/trivy-offline.db.tgz .
```
Then, decompress it.
`trivy-offline.db.tgz` file includes two files, `trivy.db` and `metadata.json`.
```
$ tar xvf trivy-offline.db.tgz
x trivy.db
x metadata.json
$ rm trivy-offline.db.tgz
```
In an air-gapped environment it is your responsibility to update the Trivy database on a regular basis, so that the scanner can detect recently-identified vulnerabilities.
## Run Trivy with --skip-update option
In an air-gapped environment, specify `--skip-update` so that Trivy doesn't attempt to download the latest database file.
```
$ trivy image --skip-update alpine:3.12
```
[trivy-db]: https://github.com/aquasecurity/trivy-db/releases

View File

@@ -1,4 +1,4 @@
FROM squidfunk/mkdocs-material
FROM squidfunk/mkdocs-material:8.2.10
## If you want to see exactly the same version as is published to GitHub pages
## use a private image for insiders, which requires authentication.
@@ -6,4 +6,5 @@ FROM squidfunk/mkdocs-material
# docker login -u ${GITHUB_USERNAME} -p ${GITHUB_TOKEN} ghcr.io
# FROM ghcr.io/squidfunk/mkdocs-material-insiders
RUN pip install mike mkdocs-macros-plugin
COPY requirements.txt .
RUN pip install -r requirements.txt

30
docs/build/requirements.txt vendored Normal file
View File

@@ -0,0 +1,30 @@
click==8.1.2
csscompressor==0.9.5
ghp-import==2.0.2
htmlmin==0.1.12
importlib-metadata==4.11.3
Jinja2==3.1.1
jsmin==3.0.1
Markdown==3.3.6
MarkupSafe==2.1.1
mergedeep==1.3.4
mike==1.1.2
mkdocs==1.3.0
mkdocs-macros-plugin==0.7.0
mkdocs-material==8.2.10
mkdocs-material-extensions==1.0.3
mkdocs-minify-plugin==0.5.0
mkdocs-redirects==1.0.4
packaging==21.3
Pygments==2.11.2
pymdown-extensions==9.3
pyparsing==3.0.8
python-dateutil==2.8.2
PyYAML==6.0
pyyaml-env-tag==0.1
six==1.16.0
termcolor==1.1.0
verspec==0.1.0
watchdog==2.1.7
zipp==3.8.0

21
docs/community/cks.md Normal file
View File

@@ -0,0 +1,21 @@
# CKS preparation resources
Community Resources
- [Trivy Video overview (short)][overview]
- [Example questions from the exam][exam]
- [More example questions][questions]
Aqua Security Blog posts
- Supply chain security best [practices][supply-chain-best-practices]
- Supply chain [attacks][supply-chain-attacks]
-
If you know of interesting resources, please start a PR to add those to the list.
[overview]: https://youtu.be/2cjH6Zkieys
[exam]: https://jonathan18186.medium.com/certified-kubernetes-security-specialist-cks-preparation-part-7-supply-chain-security-9cf62c34cf6a
[questions]: https://github.com/kodekloudhub/certified-kubernetes-security-specialist-cks-course/blob/main/docs/06-Supply-Chain-Security/09-Scan-images-for-known-vulnerabilities-(Trivy).md
[supply-chain-best-practices]: https://blog.aquasec.com/supply-chain-security-best-practices
[supply-chain-attacks]: https://blog.aquasec.com/supply-chain-threats-using-container-images

View File

@@ -0,0 +1,31 @@
Thank you for taking interest in contributing to Trivy!
- Feel free to open issues for any reason. When you open a new issue, you'll have to select an issue kind: bug/feature/support and fill the required information based on the selected template.
- Please spend a small amount of time giving due diligence to the issue tracker. Your issue might be a duplicate. If it is, please add your comment to the existing issue.
- Remember that users might search for your issue in the future, so please give it a meaningful title to help others.
- The issue should clearly explain the reason for opening, the proposal if you have any, and any relevant technical information.
## Wrong detection
Trivy depends on [multiple data sources](https://aquasecurity.github.io/trivy/latest/docs/vulnerability/detection/data-source/).
Sometime these databases contain mistakes.
If Trivy can't detect any CVE-IDs or shows false positive result, at first please follow the next steps:
1. Run Trivy with `-f json` that shows data sources.
2. According to the shown data source, make sure that the security advisory in the data source is correct.
If the data source is correct and Trivy shows wrong results, please raise an issue on Trivy.
### GitHub Advisory Database
Visit [here](https://github.com/advisories) and search CVE-ID.
If you find a problem, it'll be nice to fix it: [How to contribute to a GitHub security advisory](https://github.blog/2022-02-22-github-advisory-database-now-open-to-community-contributions/)
### GitLab Advisory Database
Visit [here](https://advisories.gitlab.com/) and search CVE-ID.
If you find a problem, it'll be nice to fix it: [Create an issue to GitLab Advisory Database](https://gitlab.com/gitlab-org/security-products/gemnasium-db/-/issues/new)
### Red Hat CVE Database
Visit [here](https://access.redhat.com/security/security-updates/?cwe=476#/cve) and search CVE-ID.

View File

@@ -0,0 +1,164 @@
Thank you for taking interest in contributing to Trivy!
1. Every Pull Request should have an associated bug or feature issue unless you are fixing a trivial documentation issue.
1. Please add the associated Issue link in the PR description.
1. Your PR is more likely to be accepted if it focuses on just one change.
1. There's no need to add or tag reviewers.
1. If a reviewer commented on your code or asked for changes, please remember to respond with comment. Do not mark discussion as resolved. It's up to reviewer to mark it resolved (in case if suggested fix addresses problem properly). PRs with unresolved issues should not be merged (even if the comment is unclear or requires no action from your side).
1. Please include a comment with the results before and after your change.
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.
### Title
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.
#### Format of the title
```
<type>(<scope>): <subject>
```
The `type` and `scope` should always be lowercase as shown below.
**Allowed `<type>` values:**
- **feat** for a new feature for the user, not a new feature for build script. Such commit will trigger a release bumping a MINOR version.
- **fix** for a bug fix for the user, not a fix to a build script. Such commit will trigger a release bumping a PATCH version.
- **perf** for performance improvements. Such commit will trigger a release bumping a PATCH version.
- **docs** for changes to the documentation.
- **style** for formatting changes, missing semicolons, etc.
- **refactor** for refactoring production code, e.g. renaming a variable.
- **test** for adding missing tests, refactoring tests; no production code change.
- **build** for updating build configuration, development tools or other changes irrelevant to the user.
- **chore** for updates that do not apply to the above, such as dependency updates.
- **ci** for changes to CI configuration files and scripts
- **revert** for revert to a previous commit
**Allowed `<scope>` values:**
checks:
- vuln
- misconf
- secret
mode:
- image
- fs
- repo
- sbom
- server
os:
- alpine
- redhat
- alma
- rocky
- mariner
- oracle
- debian
- ubuntu
- amazon
- suse
- photon
- distroless
language:
- ruby
- php
- python
- nodejs
- rust
- dotnet
- java
- go
vuln:
- os
- lang
config:
- kubernetes
- dockerfile
- terraform
- cloudformation
container
- docker
- podman
- containerd
- oci
cli:
- cli
- flag
others:
- helm
- report
- db
- deps
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
```
feat(alma): add support for AlmaLinux
```
```
fix(oracle): handle advisories with ksplice versions
```
```
docs(misconf): add comparison with Conftest and TFsec
```
```
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.
The PR title should describe what the PR adds or fixes even though it just updates the dependency in Trivy.
### Unit tests
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
Trivy is composed of several repositories that work together:
- [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-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.
- [fanal](https://github.com/aquasecurity/fanal) is a library for extracting system information from containers. It is being used by Trivy to find testable subjects in the container image.
- [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.

10
docs/community/credit.md Normal file
View File

@@ -0,0 +1,10 @@
# Author
[Teppei Fukuda][knqyf263] (knqyf263)
# Contributors
Thanks to all [contributors][contributors]
[knqyf263]: https://github.com/knqyf263
[contributors]: https://github.com/aquasecurity/trivy/graphs/contributors

View File

@@ -1,7 +1,10 @@
# Triage
Triage is an important part of maintaining the health of the trivy repo.
A well organized repo allows maintainers to prioritize feature requests, fix bugs, and respond to users facing difficulty with the tool as quickly as possible.
Triage includes:
- Labeling issues
- Responding to issues
- Closing issues
@@ -185,7 +188,7 @@ We use two labels [help wanted](https://github.com/aquasecurity/trivy/issues?q=i
and [good first issue](https://github.com/aquasecurity/trivy/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
to identify issues that have been specially groomed for new contributors.
We have specific [guidelines](/docs/contrib/help-wanted.md)
We have specific [guidelines](/docs/community/maintainer/help-wanted.md)
for how to use these labels. If you see an issue that satisfies these
guidelines, you can add the `help wanted` label and the `good first issue` label.
Please note that adding the `good first issue` label must also

View File

@@ -0,0 +1,48 @@
# Additional References
There are external blogs and evaluations.
## Blogs
- [Trivy Vulnerability Scanner Joins the Aqua Open-source Family][join]
- [Trivy Image Vulnerability Scanner Now Under Apache 2.0 License][license]
- [DevSecOps with Trivy and GitHub Actions][actions]
- [Find Image Vulnerabilities Using GitHub and Aqua Security Trivy Action][actions2]
- [Using Trivy to Discover Vulnerabilities in VS Code Projects][vscode]
- [the vulnerability remediation lifecycle of Alpine containers][alpine]
- [Continuous Container Vulnerability Testing with Trivy][semaphore]
- [Open Source CVE Scanner Round-Up: Clair vs Anchore vs Trivy][round-up]
- [Docker Image Security: Static Analysis Tool Comparison Anchore Engine vs Clair vs Trivy][tool-comparison]
## Links
- [Research Spike: evaluate Trivy for scanning running containers][gitlab]
- [Istio evaluates scanners][istio]
## Presentations
- Aqua Security YouTube Channel
- [Trivy - container image scanning][intro]
- [Using Trivy in client server mode][server]
- [Tweaking Trivy output to fit your workflow][tweaking]
- [How does a vulnerability scanner identify packages?][identify]
- CNCF Webinar 2020
- [Trivy Open Source Scanner for Container Images Just Download and Run!][cncf]
- KubeCon + CloudNativeCon Europe 2020 Virtual
- [Handling Container Vulnerabilities with Open Policy Agent - Teppei Fukuda, Aqua Security][kubecon]
[alpine]: https://ariadne.space/2021/06/08/the-vulnerability-remediation-lifecycle-of-alpine-containers/
[semaphore]: https://semaphoreci.com/blog/continuous-container-vulnerability-testing-with-trivy
[round-up]: https://boxboat.com/2020/04/24/image-scanning-tech-compared/
[tool-comparison]: https://www.a10o.net/devsecops/docker-image-security-static-analysis-tool-comparison-anchore-engine-vs-clair-vs-trivy/
[gitlab]: https://gitlab.com/gitlab-org/gitlab/-/issues/270888
[istio]: https://github.com/istio/release-builder/pull/687#issuecomment-874938417
[intro]: https://www.youtube.com/watch?v=AzOBGm7XxOA
[cncf]: https://www.youtube.com/watch?v=XnYxX9uueoQ
[server]: https://www.youtube.com/watch?v=tNQ-VlahtYM
[kubecon]: https://www.youtube.com/watch?v=WKE2XNZ2zr4
[identify]: https://www.youtube.com/watch?v=PaMnzeHBa8M
[tweaking]: https://www.youtube.com/watch?v=wFIGUjcRLnU
[join]: https://blog.aquasec.com/trivy-vulnerability-scanner-joins-aqua-family
[license]: https://blog.aquasec.com/trivy-open-source-vulnerability-scanner-apache2.0-license
[actions]: https://blog.aquasec.com/devsecops-with-trivy-github-actions
[actions2]: https://blog.aquasec.com/github-vulnerability-scanner-trivy
[vscode]: https://blog.aquasec.com/trivy-open-source-vulnerability-scanner-vs-code

37
docs/community/tools.md Normal file
View File

@@ -0,0 +1,37 @@
# Community Tools
The open source community has been hard at work developing new tools for Trivy. You can check out some of them here.
Have you created a tool thats not listed? Add the name and description of your integration and open a pull request in the GitHub repository to get your change merged.
## GitHub Actions
| Actions | Description |
| ------------------------------------------ | -------------------------------------------------------------------------------- |
| [gitrivy][gitrivy] | GitHub Issue + Trivy |
| [trivy-github-issues][trivy-github-issues] | GitHub Actions for creating GitHub Issues according to the Trivy scanning result |
## Semaphore
| Name | Description |
| -------------------------------------------------------| ----------------------------------------- |
| [Continuous Vulnerability Testing with Trivy][semaphore-tutorial] | Tutorial on scanning code, containers, infrastructure, and Kubernetes with Semaphore CI/CD. |
## CircleCI
| Orb | Description |
| -----------------------------------------| ----------------------------------------- |
| [fifteen5/trivy-orb][fifteen5/trivy-orb] | Orb for running Trivy, a security scanner |
## Others
| Name | Description |
| -----------------------------------------| ----------------------------------------- |
| [Trivy Vulnerability Explorer][explorer] | Explore trivy vulnerability reports in your browser and create .trivyignore files interactively. Can be integrated in your CI/CD tooling with deep links. |
[trivy-github-issues]: https://github.com/marketplace/actions/trivy-github-issues
[fifteen5/trivy-orb]: https://circleci.com/developer/orbs/orb/fifteen5/trivy-orb
[gitrivy]: https://github.com/marketplace/actions/trivy-action
[explorer]: https://dbsystel.github.io/trivy-vulnerability-explorer/
[semaphore-tutorial]: https://semaphoreci.com/blog/continuous-container-vulnerability-testing-with-trivy

View File

@@ -1,17 +0,0 @@
# Comparison with other scanners
| Scanner | OS<br>Packages | Application<br>Dependencies | Easy to use | Accuracy | Suitable<br>for CI |
| -------------- | :-------------: | :-------------------------: | :----------: | :---------: | :-----------------: |
| Trivy | ✅ | ✅<br>(8 languages) | ⭐ ⭐ ⭐ | ⭐ ⭐ ⭐ | ⭐ ⭐ ⭐ |
| Clair | ✅ | × | ⭐ | ⭐ ⭐ | ⭐ ⭐ |
| Anchore Engine | ✅ | ✅<br>(4 languages) | ⭐ ⭐ | ⭐ ⭐ | ⭐ ⭐ ⭐ |
| Quay | ✅ | × | ⭐ ⭐ ⭐ | ⭐ ⭐ | × |
| Docker Hub | ✅ | × | ⭐ ⭐ ⭐ | ⭐ | × |
| GCR | ✅ | × | ⭐ ⭐ ⭐ | ⭐ ⭐ | × |
- [Open Source CVE Scanner Round-Up: Clair vs Anchore vs Trivy][round-up]
- [Docker Image Security: Static Analysis Tool Comparison Anchore Engine vs Clair vs Trivy][tool-comparison]
- [Research Spike: evaluate Trivy for scanning running containers](https://gitlab.com/gitlab-org/gitlab/-/issues/270888)
[round-up]: https://boxboat.com/2020/04/24/image-scanning-tech-compared/
[tool-comparison]: https://www.a10o.net/devsecops/docker-image-security-static-analysis-tool-comparison-anchore-engine-vs-clair-vs-trivy/

View File

@@ -1,14 +0,0 @@
# Special Thanks to
- [Tomoya Amachi][tomoyamachi]
- [Masahiro Fujimura][masahiro331]
- [Naoki Harima][XapiMa]
# Author
[Teppei Fukuda][knqyf263] (knqyf263)
[tomoyamachi]: https://github.com/tomoyamachi
[masahiro331]: https://github.com/masahiro331
[XapiMa]: https://github.com/XapiMa
[knqyf263]: https://github.com/knqyf263

View File

@@ -0,0 +1,66 @@
# Air-Gapped Environment
Trivy can be used in air-gapped environments. Note that an allowlist is [here][allowlist].
## Air-Gapped Environment for vulnerabilities
### Download the vulnerability database
At first, you need to download the vulnerability database for use in air-gapped environments.
Please follow [oras installation instruction][oras].
Download `db.tar.gz`:
```
$ oras pull ghcr.io/aquasecurity/trivy-db:2 -a
```
### Transfer the DB file into the air-gapped environment
The way of transfer depends on the environment.
```
$ rsync -av -e ssh /path/to/db.tar.gz [user]@[host]:dst
```
### Put the DB file in Trivy's cache directory
You have to know where to put the DB file. The following command shows the default cache directory.
```
$ ssh user@host
$ trivy -h | grep cache
--cache-dir value cache directory (default: "/home/myuser/.cache/trivy") [$TRIVY_CACHE_DIR]
```
Put the DB file in the cache directory + `/db`.
```
$ mkdir -p /home/myuser/.cache/trivy/db
$ cd /home/myuser/.cache/trivy/db
$ tar xvf /path/to/db.tar.gz -C /home/myuser/.cache/trivy/db
x trivy.db
x metadata.json
$ rm /path/to/db.tar.gz
```
In an air-gapped environment it is your responsibility to update the Trivy database on a regular basis, so that the scanner can detect recently-identified vulnerabilities.
### Run Trivy with --skip-update and --offline-scan option
In an air-gapped environment, specify `--skip-update` so that Trivy doesn't attempt to download the latest database file.
In addition, if you want to scan Java dependencies such as JAR and pom.xml, you need to specify `--offline-scan` since Trivy tries to issue API requests for scanning Java applications by default.
```
$ trivy image --skip-update --offline-scan alpine:3.12
```
## Air-Gapped Environment for misconfigurations
No special measures are required to detect misconfigurations in an air-gapped environment.
### Run Trivy with --skip-policy-update option
In an air-gapped environment, specify `--skip-policy-update` so that Trivy doesn't attempt to download the latest misconfiguration policies.
```
$ trivy conf --skip-policy-update /path/to/conf
```
[allowlist]: ../references/troubleshooting.md
[oras]: https://oras.land/cli/

View File

@@ -0,0 +1,22 @@
# containerd
!!! warning "EXPERIMENTAL"
This feature might change without preserving backwards compatibility.
Scan your image in [containerd][containerd] running locally.
```bash
$ nerdctl images
REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE
aquasec/nginx latest 2bcabc23b454 3 hours ago linux/amd64 149.1 MiB 54.1 MiB
$ trivy image aquasec/nginx
```
If your containerd socket is not the default path (`//run/containerd/containerd.sock`), you can override it via `CONTAINERD_ADDRESS`.
```bash
$ export CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock
$ trivy image aquasec/nginx
```
[containerd]: https://containerd.io/

View File

@@ -10,7 +10,7 @@ FROM alpine:3.7
RUN apk add curl \
&& curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \
&& trivy filesystem --exit-code 1 --no-progress /
&& trivy rootfs --exit-code 1 --no-progress /
$ docker build -t vulnerable-image .
```
@@ -21,7 +21,7 @@ insecure `curl | sh`. Also the image is not changed.
# Run vulnerability scan on build image
FROM build AS vulnscan
COPY --from=aquasec/trivy:latest /usr/local/bin/trivy /usr/local/bin/trivy
RUN trivy filesystem --exit-code 1 --no-progress /
RUN trivy rootfs --exit-code 1 --no-progress /
[...]
```

View File

@@ -1,6 +1,6 @@
# OCI
# OCI Image Layout
An image directory compliant with "Open Container Image Layout Specification".
An image directory compliant with [Open Container Image Layout Specification](https://github.com/opencontainers/image-spec/blob/master/spec.md).
Buildah:

View File

@@ -1,10 +1,12 @@
# Podman
[EXPERIMENTAL] This feature might change without preserving backwards compatibility.
!!! warning "EXPERIMENTAL"
This feature might change without preserving backwards compatibility.
Scan your image in Podman (>=2.0) running locally. The remote Podman is not supported.
Before performing Trivy commands, you must enable the podman.sock systemd service on your machine.
For more details, see [here][sock]
For more details, see [here][sock].
```bash
$ systemctl --user enable --now podman.socket

View File

@@ -1,12 +1,12 @@
# Unpacked Filesystem
Scan aan unpacked container image filesystem.
Scan an unpacked container image filesystem.
In this case, Trivy works the same way when scanning containers
```bash
$ docker export $(docker create alpine:3.10.2) | tar -C /tmp/rootfs -xvf -
$ trivy fs /tmp/rootfs
$ trivy rootfs /tmp/rootfs
```
<details>

View File

@@ -0,0 +1,358 @@
# Modules
!!! warning "EXPERIMENTAL"
This feature might change without preserving backwards compatibility.
Trivy provides a module feature to allow others to extend the Trivy CLI without the need to change the Trivy code base.
It changes the behavior during scanning by WebAssembly.
## Overview
Trivy modules are add-on tools that integrate seamlessly with Trivy.
They provide a way to extend the core feature set of Trivy, but without updating the Trivy binary.
- They can be added and removed from a Trivy installation without impacting the core Trivy tool.
- They can be written in any programming language supporting WebAssembly.
- It supports only [TinyGo][tinygo] at the moment.
You can write your own detection logic.
- Evaluate complex vulnerability conditions like [Spring4Shell][spring4shell]
- Detect a shell script communicating with malicious domains
- Detect malicious python install script (setup.py)
- Even detect misconfigurations in WordPress setting
- etc.
Then, you can update the scan result however you want.
- Change a severity
- Remove a vulnerability
- Add a new vulnerability
- etc.
Modules should be distributed in OCI registries like GitHub Container Registry.
!!! warning
WebAssembly doesn't allow file access and network access by default.
Modules can read required files only, but cannot overwrite them.
WebAssembly is sandboxed and secure by design, but Trivy modules available in public are not audited for security.
You should install and run third-party modules at your own risk even though
Under the hood Trivy leverages [wazero][wazero] to run WebAssembly modules without CGO.
## Installing a Module
A module can be installed using the `trivy module install` command.
This command takes an url. It will download the module and install it in the module cache.
Trivy adheres to the XDG specification, so the location depends on whether XDG_DATA_HOME is set.
Trivy will now search XDG_DATA_HOME for the location of the Trivy modules cache.
The preference order is as follows:
- XDG_DATA_HOME if set and .trivy/plugins exists within the XDG_DATA_HOME dir
- $HOME/.trivy/plugins
For example, to download the WebAssembly module, you can execute the following command:
```bash
$ trivy module install ghcr.io/aquasecurity/trivy-module-spring4shell
```
## Using Modules
Once the module is installed, Trivy will load all available modules in the cache on the start of the next Trivy execution.
The modules may inject custom logic into scanning and change the result.
You can run Trivy as usual and modules are loaded automatically.
You will see the log messages about WASM modules.
```shell
$ trivy image ghcr.io/aquasecurity/trivy-test-images:spring4shell-jre8
2022-06-12T12:57:13.210+0300 INFO Loading ghcr.io/aquasecurity/trivy-module-spring4shell/spring4shell.wasm...
2022-06-12T12:57:13.596+0300 INFO Registering WASM module: spring4shell@v1
...
2022-06-12T12:57:14.865+0300 INFO Module spring4shell: Java Version: 8, Tomcat Version: 8.5.77
2022-06-12T12:57:14.865+0300 INFO Module spring4shell: change CVE-2022-22965 severity from CRITICAL to LOW
Java (jar)
Total: 9 (UNKNOWN: 1, LOW: 3, MEDIUM: 2, HIGH: 3, CRITICAL: 0)
┌──────────────────────────────────────────────────────────────┬─────────────────────┬──────────┬───────────────────┬────────────────────────┬────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼───────────────────┼────────────────────────┼────────────────────────────────────────────────────────────┤
│ org.springframework.boot:spring-boot (helloworld.war) │ CVE-2022-22965 │ LOW │ 2.6.3 │ 2.5.12, 2.6.6 │ spring-framework: RCE via Data Binding on JDK 9+ │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-22965 │
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼───────────────────┼────────────────────────┼────────────────────────────────────────────────────────────┤
...(snip)...
```
In the above example, the Spring4Shell module changed the severity from CRITICAL to LOW because the application doesn't satisfy one of conditions.
## Uninstalling Modules
Specify a module repository with `trivy module uninstall` command.
```bash
$ trivy module uninstall ghcr.io/aquasecurity/trivy-module-spring4shell
```
## Building Modules
It supports TinyGo only at the moment.
### TinyGo
Trivy provides Go SDK including three interfaces.
Your own module needs to implement either or both `Analyzer` and `PostScanner` in addition to `Module`.
```go
type Module interface {
Version() int
Name() string
}
type Analyzer interface {
RequiredFiles() []string
Analyze(filePath string) (*serialize.AnalysisResult, error)
}
type PostScanner interface {
PostScanSpec() serialize.PostScanSpec
PostScan(serialize.Results) (serialize.Results, error)
}
```
In the following tutorial, it creates a WordPress module that detects a WordPress version and a critical vulnerability accordingly.
!!! tips
You can use logging functions such as `Debug` and `Info` for debugging.
See [examples](#examples) for the detail.
#### Initialize your module
Replace the repository name with yours.
```
$ go mod init github.com/aquasecurity/trivy-module-wordpress
```
#### Module interface
`Version()` returns your module version and should be incremented after updates.
`Name()` returns your module name.
```go
package main
const (
version = 1
name = "wordpress-module"
)
type WordpressModule struct{
// Cannot define fields as modules can't keep state.
}
func (WordpressModule) Version() int {
return version
}
func (WordpressModule) Name() string {
return name
}
```
!!! info
A struct cannot have any fields. Each method invocation is performed in different states.
#### Analyzer interface
If you implement the `Analyzer` interface, `Analyze` method is called when the file path is matched to file patterns returned by `RequiredFiles()`.
A file pattern must be a regular expression. The syntax detail is [here][regexp].
`Analyze` takes the matched file path, then the file can be opened by `os.Open()`.
```go
const typeWPVersion = "wordpress-version"
func (WordpressModule) RequiredFiles() []string {
return []string{
`wp-includes\/version.php`,
}
}
func (WordpressModule) Analyze(filePath string) (*serialize.AnalysisResult, error) {
f, err := os.Open(filePath) // e.g. filePath: /usr/src/wordpress/wp-includes/version.php
if err != nil {
return nil, err
}
defer f.Close()
var wpVersion string
scanner := bufio.NewScanner(f)
for scanner.Scan() {
line := scanner.Text()
if !strings.HasPrefix(line, "$wp_version=") {
continue
}
ss := strings.Split(line, "=")
if len(ss) != 2 {
return nil, fmt.Errorf("invalid wordpress version: %s", line)
}
// NOTE: it is an example; you actually need to handle comments, etc
ss[1] = strings.TrimSpace(ss[1])
wpVersion = strings.Trim(ss[1], `";`)
}
if err = scanner.Err(); err != nil {
return nil, err
}
return &serialize.AnalysisResult{
CustomResources: []serialize.CustomResource{
{
Type: typeWPVersion,
FilePath: filePath,
Data: wpVersion,
},
},
}, nil
}
```
!!! tips
Trivy caches analysis results according to the module version.
We'd recommend cleaning the cache or changing the module version every time you update `Analyzer`.
#### PostScanner interface
`PostScan` is called after scanning and takes the scan result as an argument from Trivy.
In post scanning, your module can perform one of three actions:
- Insert
- Add a new security finding
- e.g. Add a new vulnerability and misconfiguration
- Update
- Update the detected vulnerability and misconfiguration
- e.g. Change a severity
- Delete
- Delete the detected vulnerability and misconfiguration
- e.g. Remove Spring4Shell because it is not actually affected.
`PostScanSpec()` returns which action the module does.
If it is `Update` or `Delete`, it also needs to return IDs such as CVE-ID and misconfiguration ID, which your module wants to update or delete.
`serialize.Results` contains the filtered results matching IDs you specified.
Also, it includes `CustomResources` with the values your `Analyze` returns, so you can modify the scan result according to the custom resources.
```go
func (WordpressModule) PostScanSpec() serialize.PostScanSpec {
return serialize.PostScanSpec{
Action: api.ActionInsert, // Add new vulnerabilities
}
}
func (WordpressModule) PostScan(results serialize.Results) (serialize.Results, error) {
// e.g. results
// [
// {
// "Target": "",
// "Class": "custom",
// "CustomResources": [
// {
// "Type": "wordpress-version",
// "FilePath": "/usr/src/wordpress/wp-includes/version.php",
// "Layer": {
// "DiffID": "sha256:057649e61046e02c975b84557c03c6cca095b8c9accd3bd20eb4e432f7aec887"
// },
// "Data": "5.7.1"
// }
// ]
// }
// ]
var wpVersion int
for _, result := range results {
if result.Class != types.ClassCustom {
continue
}
for _, c := range result.CustomResources {
if c.Type != typeWPVersion {
continue
}
wpVersion = c.Data.(string)
wasm.Info(fmt.Sprintf("WordPress Version: %s", wpVersion))
...snip...
if affectedVersion.Check(ver) {
vulnerable = true
}
break
}
}
if vulnerable {
// Add CVE-2020-36326
results = append(results, serialize.Result{
Target: wpPath,
Class: types.ClassLangPkg,
Type: "wordpress",
Vulnerabilities: []types.DetectedVulnerability {
{
VulnerabilityID: "CVE-2020-36326",
PkgName: "wordpress",
InstalledVersion: wpVersion,
FixedVersion: "5.7.2",
Vulnerability: dbTypes.Vulnerability{
Title: "PHPMailer 6.1.8 through 6.4.0 allows object injection through Phar Deserialization via addAttachment with a UNC pathname.",
Severity: "CRITICAL",
},
},
},
})
}
return results, nil
}
```
The new vulnerability will be added to the scan results.
This example shows how the module inserts a new finding.
If you are interested in `Update`, you can see an example of [Spring4Shell][trivy-module-spring4shell].
In the `Delete` action, `PostScan` needs to return results you want to delete.
If `PostScan` returns an empty, Trivy will not delete anything.
#### Build
Follow [the install guide][tinygo-installation] and install TinyGo.
```bash
$ tinygo build -o wordpress.wasm -scheduler=none -target=wasi --no-debug wordpress.go
```
Put the built binary to the module directory that is under the home directory by default.
```bash
$ mkdir -p ~/.trivy/modules
$ cp spring4shell.wasm ~/.trivy/modules
```
## Distribute Your Module
You can distribute your own module in OCI registries. Please follow [the oras installation instruction][oras].
```bash
oras push ghcr.io/aquasecurity/trivy-module-wordpress:latest wordpress.wasm:application/vnd.module.wasm.content.layer.v1+wasm
Uploading 3daa3dac086b wordpress.wasm
Pushed ghcr.io/aquasecurity/trivy-module-wordpress:latest
Digest: sha256:6416d0199d66ce52ced19f01d75454b22692ff3aa7737e45f7a189880840424f
```
## Examples
- [Spring4Shell][trivy-module-spring4shell]
- [WordPress][trivy-module-wordpress]
[regexp]: https://github.com/google/re2/wiki/Syntax
[tinygo]: https://tinygo.org/
[spring4shell]: https://blog.aquasec.com/zero-day-rce-vulnerability-spring4shell
[wazero]: https://github.com/tetratelabs/wazero
[trivy-module-spring4shell]: https://github.com/aquasecurity/trivy/tree/main/examples/module/spring4shell
[trivy-module-wordpress]: https://github.com/aquasecurity/trivy-module-wordpress
[tinygo-installation]: https://tinygo.org/getting-started/install/
[oras]: https://oras.land/cli/

View File

@@ -0,0 +1,27 @@
# Requirements
None, Trivy uses Azure SDK for Go. You don't need to install `az` command.
# Privileges
Service principal must have the `AcrPull` permissions.
## Creation of a service principal
```bash
export SP_DATA=$(az ad sp create-for-rbac --name TrivyTest --role AcrPull --scope "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.ContainerRegistry/registries/<registry_name>")
```
# Usage
```bash
# must set TRIVY_USERNAME empty char
export AZURE_CLIENT_ID$(echo $SP_DATA | jq -r .appId)
export AZURE_CLIENT_SECRET$(echo $SP_DATA | jq -r .password)
export AZURE_TENANT_ID$(echo $SP_DATA | jq -r .tenant)
```
# Testing
You can test credentials in the following manner.
```bash
docker run -it --rm -v /tmp:/tmp\
-e AZURE_CLIENT_ID=${AZURE_CLIENT_ID} -e AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET} \
-e AZURE_TENANT_ID=${AZURE_TENANT_ID} aquasec/trivy image your_special_project.azurecr.io/your_special_image:your_special_tag
```

View File

@@ -0,0 +1,40 @@
# Requirements
None, Trivy uses Google Cloud SDK. You don't need to install `gcloud` command.
# Privileges
Credential file must have the `roles/storage.objectViewer` permissions.
More information can be found in [Google's documentation](https://cloud.google.com/container-registry/docs/access-control)
## JSON File Format
The JSON file specified should have the following format provided by google's service account mechanisms:
```json
{
"type": "service_account",
"project_id": "your_special_project",
"private_key_id": "XXXXXXXXXXXXXXXXXXXXxx",
"private_key": "-----BEGIN PRIVATE KEY-----\nNONONONO\n-----END PRIVATE KEY-----\n",
"client_email": "somedude@your_special_project.iam.gserviceaccount.com",
"client_id": "1234567890",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/somedude%40your_special_project.iam.gserviceaccount.com"
}
```
# Usage
If you want to use target project's repository, you can set them via `GOOGLE_APPLICATION_CREDENTIALS`.
```bash
# must set TRIVY_USERNAME empty char
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credential.json
```
# Testing
You can test credentials in the following manner (assuming they are in `/tmp` on host machine).
```bash
docker run -it --rm -v /tmp:/tmp\
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/service_account.json\
aquasec/trivy image gcr.io/your_special_project/your_special_image:your_special_tag
```

93
docs/docs/index.md Normal file
View File

@@ -0,0 +1,93 @@
# Docs
Trivy detects two types of security issues:
- [Vulnerabilities][vuln]
- [Misconfigurations][misconf]
Trivy can scan four different artifacts:
- [Container Images][container]
- [Filesystem][filesystem] and [Rootfs][rootfs]
- [Git Repositories][repo]
- [Kubernetes][kubernetes]
Trivy can be run in two different modes:
- [Standalone][standalone]
- [Client/Server][client-server]
Trivy can be run as a Kubernetes Operator:
- [Kubernetes Operator][kubernetesoperator]
It is designed to be used in CI. Before pushing to a container registry or deploying your application, you can scan your local container image and other artifacts easily.
See [Integrations][integrations] for details.
## Features
- Comprehensive vulnerability detection
- [OS packages][os] (Alpine, Red Hat Universal Base Image, Red Hat Enterprise Linux, CentOS, AlmaLinux, Rocky Linux, CBL-Mariner, Oracle Linux, Debian, Ubuntu, Amazon Linux, openSUSE Leap, SUSE Enterprise Linux, Photon OS and Distroless)
- [**Language-specific packages**][lang] (Bundler, Composer, Pipenv, Poetry, npm, yarn, Cargo, NuGet, Maven, and Go)
- Detect IaC misconfigurations
- A wide variety of [built-in policies][builtin] are provided **out of the box**:
- Kubernetes
- Docker
- Terraform
- more coming soon
- Support custom policies
- Simple
- Specify only an image name, a directory containing IaC configs, or an artifact name
- See [Quick Start][quickstart]
- Fast
- The first scan will finish within 10 seconds (depending on your network). Consequent scans will finish in single seconds.
- Unlike other scanners that take long to fetch vulnerability information (~10 minutes) on the first run, and encourage you to maintain a durable vulnerability database, Trivy is stateless and requires no maintenance or preparation.
- Easy installation
- `apt-get install`, `yum install` and `brew install` is possible (See [Installation][installation])
- **No pre-requisites** such as installation of DB, libraries, etc.
- High accuracy
- **Especially Alpine Linux and RHEL/CentOS**
- Other OSes are also high
- DevSecOps
- **Suitable for CI** such as Travis CI, CircleCI, Jenkins, GitLab CI, etc.
- See [CI Example][integrations]
- Support multiple formats
- container image
- A local image in Docker Engine which is running as a daemon
- A local image in [Podman][podman] (>=2.0) which is exposing a socket
- A remote image in Docker Registry such as Docker Hub, ECR, GCR and ACR
- A tar archive stored in the `docker save` / `podman save` formatted file
- An image directory compliant with [OCI Image Format][oci]
- local filesystem and rootfs
- remote git repository
- [SBOM][sbom] (Software Bill of Materials) support
- CycloneDX
- SPDX
Please see [LICENSE][license] for Trivy licensing information.
[installation]: ../getting-started/installation.md
[vuln]: ../docs/vulnerability/scanning/index.md
[misconf]: ../docs/misconfiguration/scanning.md
[kubernetesoperator]: ../docs/kubernetes/operator/index.md
[container]: ../docs/vulnerability/scanning/image.md
[rootfs]: ../docs/vulnerability/scanning/rootfs.md
[filesystem]: ../docs/vulnerability/scanning/filesystem.md
[repo]: ../docs/vulnerability/scanning/git-repository.md
[kubernetes]: ../docs/kubernetes/cli/scanning.md
[standalone]: ../docs/references/modes/standalone.md
[client-server]: ../docs/references/modes/client-server.md
[integrations]: ../docs/integrations/index.md
[os]: ../docs/vulnerability/detection/os.md
[lang]: ../docs/vulnerability/detection/language.md
[builtin]: ../docs/misconfiguration/policy/builtin.md
[quickstart]: ../getting-started/quickstart.md
[podman]: ../docs/advanced/container/podman.md
[sbom]: ../docs/sbom/index.md
[oci]: https://github.com/opencontainers/image-spec
[license]: https://github.com/aquasecurity/trivy/blob/main/LICENSE

View File

@@ -0,0 +1,5 @@
# Bitbucket Pipelines
See [trivy-pipe][trivy-pipe] for the details.
[trivy-pipe]: https://github.com/aquasecurity/trivy-pipe

View File

@@ -19,7 +19,7 @@ jobs:
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
- run:
name: Scan the local image with trivy
command: trivy --exit-code 0 --no-progress trivy-ci-test:${CIRCLE_SHA1}
command: trivy image --exit-code 0 --no-progress trivy-ci-test:${CIRCLE_SHA1}
workflows:
version: 2
release:

View File

@@ -1,7 +1,7 @@
# GitHub Actions
- Here is the [Trivy Github Action][action]
- The Microsoft Azure team have written a [container-scan action][azuer] that uses Trivy and Dockle
- Here is the [Trivy GitHub Action][action]
- The Microsoft Azure team have written a [container-scan action][azure] that uses Trivy and Dockle
- For full control over the options specified to Trivy, this [blog post][blog] describes adding Trivy into your own GitHub action workflows
[action]: https://github.com/aquasecurity/trivy-action

View File

@@ -0,0 +1,181 @@
# GitLab CI
GitLab 15.0 includes [free](https://gitlab.com/groups/gitlab-org/-/epics/2233) integration with Trivy.
To [configure container scanning with Trivy in GitLab](https://docs.gitlab.com/ee/user/application_security/container_scanning/#configuration), simply include the CI template in your `.gitlab-ci.yml` file:
```yaml
include:
- template: Security/Container-Scanning.gitlab-ci.yml
```
If you're a GitLab 14.x Ultimate customer, you can use the same configuration above.
Alternatively, you can always use the example configurations below. Note that the examples use [`contrib/gitlab.tpl`](https://github.com/aquasecurity/trivy/blob/main/contrib/gitlab.tpl), which does not work with GitLab 15.0 and above (for details, see [issue 1598](https://github.com/aquasecurity/trivy/issues/1598)).
```yaml
stages:
- test
trivy:
stage: test
image: docker:stable
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR: ""
IMAGE: trivy-ci-test:$CI_COMMIT_SHA
TRIVY_NO_PROGRESS: "true"
TRIVY_CACHE_DIR: ".trivycache/"
before_script:
- export TRIVY_VERSION=$(wget -qO - "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
- echo $TRIVY_VERSION
- wget --no-verbose https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz -O - | tar -zxvf -
allow_failure: true
script:
# Build image
- docker build -t $IMAGE .
# Build report
- ./trivy image --exit-code 0 --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json $IMAGE
# Print report
- ./trivy image --exit-code 0 --severity HIGH $IMAGE
# Fail on severe vulnerabilities
- ./trivy image --exit-code 1 --severity CRITICAL $IMAGE
cache:
paths:
- .trivycache/
# Enables https://docs.gitlab.com/ee/user/application_security/container_scanning/ (Container Scanning report is available on GitLab EE Ultimate or GitLab.com Gold)
artifacts:
reports:
container_scanning: gl-container-scanning-report.json
```
[Example][example]
[Repository][repository]
### GitLab CI using Trivy container
To scan a previously built image that has already been pushed into the
GitLab container registry the following CI job manifest can be used.
Note that `entrypoint` needs to be unset for the `script` section to work.
In case of a non-public GitLab project Trivy additionally needs to
authenticate to the registry to be able to pull your application image.
Finally, it is not necessary to clone the project repo as we only work
with the container image.
```yaml
container_scanning:
image:
name: docker.io/aquasec/trivy:latest
entrypoint: [""]
variables:
# No need to clone the repo, we exclusively work on artifacts. See
# https://docs.gitlab.com/ee/ci/runners/README.html#git-strategy
GIT_STRATEGY: none
TRIVY_USERNAME: "$CI_REGISTRY_USER"
TRIVY_PASSWORD: "$CI_REGISTRY_PASSWORD"
TRIVY_AUTH_URL: "$CI_REGISTRY"
TRIVY_NO_PROGRESS: "true"
TRIVY_CACHE_DIR: ".trivycache/"
FULL_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
- trivy --version
# cache cleanup is needed when scanning images with the same tags, it does not remove the database
- time trivy image --clear-cache
# update vulnerabilities db
- time trivy image --download-db-only
# Builds report and puts it in the default workdir $CI_PROJECT_DIR, so `artifacts:` can take it from there
- time trivy image --exit-code 0 --format template --template "@/contrib/gitlab.tpl"
--output "$CI_PROJECT_DIR/gl-container-scanning-report.json" "$FULL_IMAGE_NAME"
# Prints full report
- time trivy image --exit-code 0 "$FULL_IMAGE_NAME"
# Fail on critical vulnerabilities
- time trivy image --exit-code 1 --severity CRITICAL "$FULL_IMAGE_NAME"
cache:
paths:
- .trivycache/
# Enables https://docs.gitlab.com/ee/user/application_security/container_scanning/ (Container Scanning report is available on GitLab EE Ultimate or GitLab.com Gold)
artifacts:
when: always
reports:
container_scanning: gl-container-scanning-report.json
tags:
- docker-runner
```
[example]: https://gitlab.com/aquasecurity/trivy-ci-test/pipelines
[repository]: https://github.com/aquasecurity/trivy-ci-test
### GitLab CI alternative template
Depending on the edition of gitlab you have or your desired workflow, the
container scanning template may not meet your needs. As an addition to the
above container scanning template, a template for
[code climate](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html)
has been included. The key things to update from the above examples are
the `template` and `report` type. An updated example is below.
```yaml
stages:
- test
trivy:
stage: test
image: docker:stable
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR: ""
IMAGE: trivy-ci-test:$CI_COMMIT_SHA
TRIVY_NO_PROGRESS: "true"
TRIVY_CACHE_DIR: ".trivycache/"
before_script:
- export TRIVY_VERSION=$(wget -qO - "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
- echo $TRIVY_VERSION
- wget --no-verbose https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz -O - | tar -zxvf -
allow_failure: true
script:
# Build image
- docker build -t $IMAGE .
# Image report
- ./trivy image --exit-code 0 --format template --template "@contrib/gitlab-codequality.tpl" -o gl-codeclimate-image.json $IMAGE
# Filesystem report
- ./trivy filesystem --security-checks config,vuln --exit-code 0 --format template --template "@contrib/gitlab-codequality.tpl" -o gl-codeclimate-fs.json .
# Combine report
- apk update && apk add jq
- jq -s 'add' gl-codeclimate-image.json gl-codeclimate-fs.json > gl-codeclimate.json
cache:
paths:
- .trivycache/
# Enables https://docs.gitlab.com/ee/user/application_security/container_scanning/ (Container Scanning report is available on GitLab EE Ultimate or GitLab.com Gold)
artifacts:
paths:
- gl-codeclimate.json
reports:
codequality: gl-codeclimate.json
```
Currently gitlab only supports a single code quality report. There is an
open [feature request](https://gitlab.com/gitlab-org/gitlab/-/issues/9014)
to support multiple reports. Until this has been implemented, if you
already have a code quality report in your pipeline, you can use
`jq` to combine reports. Depending on how you name your artifacts, it may
be necessary to rename the artifact if you want to reuse the name. To then
combine the previous artifact with the output of trivy, the following `jq`
command can be used, `jq -s 'add' prev-codeclimate.json trivy-codeclimate.json > gl-codeclimate.json`.
### GitLab CI alternative template example report
You'll be able to see a full report in the GitLab pipeline code quality UI, where filesystem vulnerabilities and misconfigurations include links to the flagged files and image vulnerabilities report the image/os or runtime/library that the vulnerability originates from instead.
![codequality](../../imgs/gitlab-codequality.png)

View File

@@ -0,0 +1,2 @@
# Integrations
Scan your image automatically as part of your CI workflow, failing the workflow if a vulnerability is found. When you don't want to fail the test, specify `--exit-code 0`.

View File

@@ -15,8 +15,8 @@ before_install:
- wget https://github.com/aquasecurity/trivy/releases/download/v${VERSION}/trivy_${VERSION}_Linux-64bit.tar.gz
- tar zxvf trivy_${VERSION}_Linux-64bit.tar.gz
script:
- ./trivy --exit-code 0 --severity HIGH --no-progress trivy-ci-test:${COMMIT}
- ./trivy --exit-code 1 --severity CRITICAL --no-progress trivy-ci-test:${COMMIT}
- ./trivy image --exit-code 0 --severity HIGH --no-progress trivy-ci-test:${COMMIT}
- ./trivy image --exit-code 1 --severity CRITICAL --no-progress trivy-ci-test:${COMMIT}
cache:
directories:
- $HOME/.cache/trivy

View File

@@ -0,0 +1,220 @@
# Kubernetes
!!! warning "EXPERIMENTAL"
This feature might change without preserving backwards compatibility.
The Trivy K8s CLI allows you to scan your Kubernetes cluster for Vulnerabilities, Secrets and Misconfigurations. You can either run the CLI locally or integrate it into your CI/CD pipeline. The difference to the Trivy CLI is that the Trivy K8s CLI allows you to scan running workloads directly within your cluster.
If you are looking for continuous cluster audit scanning, have a look at the [Trivy K8s operator.](../operator/getting-started.md)
Trivy uses your local kubectl configuration to access the API server to list artifacts.
## CLI Commands
Scan a full cluster and generate a simple summary report:
```
$ trivy k8s --report=summary cluster
```
![k8s Summary Report](../../../imgs/trivy-k8s.png)
The summary report is the default. To get all of the detail the output contains, use `--report all`.
Filter by severity:
```
$ trivy k8s --severity=CRITICAL --report=all cluster
```
Filter by security check (Vulnerabilities, Secrets or Misconfigurations):
```
$ trivy k8s --security-checks=secret --report=summary cluster
# or
$ trivy k8s --security-checks=config --report=summary cluster
```
Scan a specific namespace:
```
$ trivy k8s -n kube-system --report=summary all
```
Scan a specific resource and get all the output:
```
$ trivy k8s deployment appname
```
If you want to pass in flags before scanning specific workloads, you will have to do it before the resource name.
For example, scanning a deployment in the app namespace of your Kubernetes cluster for critical vulnerabilities would be done through the following command:
```
$ trivy k8s -n app --severity=CRITICAL deployment/appname
```
This is specific to all Trivy CLI commands.
The supported formats are `table`, which is the default, and `json`.
To get a JSON output on a full cluster scan:
```
$ trivy k8s --format json -o results.json cluster
```
<details>
<summary>Result</summary>
```json
{
"ClusterName": "minikube",
"Vulnerabilities": [
{
"Namespace": "default",
"Kind": "Deployment",
"Name": "app",
"Results": [
{
"Target": "ubuntu:latest (ubuntu 22.04)",
"Class": "os-pkgs",
"Type": "ubuntu",
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2016-2781",
"PkgName": "coreutils",
"InstalledVersion": "8.32-4.1ubuntu1",
"Layer": {
"Digest": "sha256:125a6e411906fe6b0aaa50fc9d600bf6ff9bb11a8651727ce1ed482dc271c24c",
"DiffID": "sha256:e59fc94956120a6c7629f085027578e6357b48061d45714107e79f04a81a6f0c"
},
"SeveritySource": "ubuntu",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2016-2781",
"DataSource": {
"ID": "ubuntu",
"Name": "Ubuntu CVE Tracker",
"URL": "https://git.launchpad.net/ubuntu-cve-tracker"
},
"Title": "coreutils: Non-privileged session can escape to the parent session in chroot",
"Description": "chroot in GNU coreutils, when used with --userspec, allows local users to escape to the parent session via a crafted TIOCSTI ioctl call, which pushes characters to the terminal's input buffer.",
"Severity": "LOW",
"CweIDs": [
"CWE-20"
],
"VendorSeverity": {
"cbl-mariner": 2,
"nvd": 2,
"redhat": 2,
"ubuntu": 1
},
"CVSS": {
"nvd": {
"V2Vector": "AV:L/AC:L/Au:N/C:N/I:P/A:N",
"V3Vector": "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N",
"V2Score": 2.1,
"V3Score": 6.5
},
"redhat": {
"V2Vector": "AV:L/AC:H/Au:N/C:C/I:C/A:C",
"V3Vector": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
"V2Score": 6.2,
"V3Score": 8.6
}
},
"References": [
"http://seclists.org/oss-sec/2016/q1/452",
"http://www.openwall.com/lists/oss-security/2016/02/28/2",
"http://www.openwall.com/lists/oss-security/2016/02/28/3",
"https://access.redhat.com/security/cve/CVE-2016-2781",
"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-2781",
"https://lists.apache.org/thread.html/rf9fa47ab66495c78bb4120b0754dd9531ca2ff0430f6685ac9b07772@%3Cdev.mina.apache.org%3E",
"https://lore.kernel.org/patchwork/patch/793178/",
"https://nvd.nist.gov/vuln/detail/CVE-2016-2781"
],
"PublishedDate": "2017-02-07T15:59:00Z",
"LastModifiedDate": "2021-02-25T17:15:00Z"
}
]
}
]
}
],
"Misconfigurations": [
{
"Namespace": "default",
"Kind": "Deployment",
"Name": "app",
"Results": [
{
"Target": "Deployment/app",
"Class": "config",
"Type": "kubernetes",
"MisconfSummary": {
"Successes": 20,
"Failures": 19,
"Exceptions": 0
},
"Misconfigurations": [
{
"Type": "Kubernetes Security Check",
"ID": "KSV001",
"Title": "Process can elevate its own privileges",
"Description": "A program inside the container can elevate its own privileges and run as root, which might give the program control over the container and node.",
"Message": "Container 'app' of Deployment 'app' should set 'securityContext.allowPrivilegeEscalation' to false",
"Namespace": "builtin.kubernetes.KSV001",
"Query": "data.builtin.kubernetes.KSV001.deny",
"Resolution": "Set 'set containers[].securityContext.allowPrivilegeEscalation' to 'false'.",
"Severity": "MEDIUM",
"PrimaryURL": "https://avd.aquasec.com/misconfig/ksv001",
"References": [
"https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted",
"https://avd.aquasec.com/misconfig/ksv001"
],
"Status": "FAIL",
"Layer": {},
"IacMetadata": {
"Provider": "Kubernetes",
"Service": "general",
"StartLine": 121,
"EndLine": 133
}
},
{
"Type": "Kubernetes Security Check",
"ID": "KSV003",
"Title": "Default capabilities not dropped",
"Description": "The container should drop all default capabilities and add only those that are needed for its execution.",
"Message": "Container 'app' of Deployment 'app' should add 'ALL' to 'securityContext.capabilities.drop'",
"Namespace": "builtin.kubernetes.KSV003",
"Query": "data.builtin.kubernetes.KSV003.deny",
"Resolution": "Add 'ALL' to containers[].securityContext.capabilities.drop.",
"Severity": "LOW",
"PrimaryURL": "https://avd.aquasec.com/misconfig/ksv003",
"References": [
"https://kubesec.io/basics/containers-securitycontext-capabilities-drop-index-all/",
"https://avd.aquasec.com/misconfig/ksv003"
],
"Status": "FAIL",
"Layer": {},
"IacMetadata": {
"Provider": "Kubernetes",
"Service": "general",
"StartLine": 121,
"EndLine": 133
}
}
]
}
]
},
{
"Namespace": "default",
"Kind": "ConfigMap",
"Name": "kube-root-ca.crt"
}
]
}
```
</details>

View File

@@ -0,0 +1,107 @@
# Built-in Configuration Audit Policies
The following sections list built-in configuration audit policies installed with trivy-operator. They are stored in the
`trivy-operator-policies-config` ConfigMap created in the installation namespace (e.g. `trivy-system`). You can modify
them or add a new policy. For example, follow the [Writing Custom Configuration Audit Policies] tutorial to add a custom
policy that checks for recommended Kubernetes labels on any resource kind.
## General
| NAME | DESCRIPTION | KINDS |
|--------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| [CPU not limited] | Enforcing CPU limits prevents DoS via resource exhaustion. | Workload |
| [CPU requests not specified] | When containers have resource requests specified, the scheduler can make better decisions about which nodes to place pods on, and how to deal with resource contention. | Workload |
| [SYS_ADMIN capability added] | SYS_ADMIN gives the processes running inside the container privileges that are equivalent to root. | Workload |
| [Default capabilities not dropped] | The container should drop all default capabilities and add only those that are needed for its execution. | Workload |
| [Root file system is not read-only] | An immutable root file system prevents applications from writing to their local disk. This can limit intrusions, as attackers will not be able to tamper with the file system or write foreign executables to disk. | Workload |
| [Memory not limited] | Enforcing memory limits prevents DoS via resource exhaustion. | Workload |
| [Memory requests not specified] | When containers have memory requests specified, the scheduler can make better decisions about which nodes to place pods on, and how to deal with resource contention. | Workload |
| [hostPath volume mounted with docker.sock] | Mounting docker.sock from the host can give the container full root access to the host. | Workload |
| [Runs with low group ID] | Force the container to run with group ID > 10000 to avoid conflicts with the hosts user table. | Workload |
| [Runs with low user ID] | Force the container to run with user ID > 10000 to avoid conflicts with the hosts user table. | Workload |
| [Tiller Is Deployed] | Check if Helm Tiller component is deployed. | Workload |
| [Image tag ':latest' used] | It is best to avoid using the ':latest' image tag when deploying containers in production. Doing so makes it hard to track which version of the image is running, and hard to roll back the version. | Workload |
## Advanced
| NAME | DESCRIPTION | KINDS |
|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| [Unused capabilities should be dropped (drop any)] | Security best practices require containers to run with minimal required capabilities. | Workload |
| [hostAliases is set] | Managing /etc/hosts aliases can prevent the container engine from modifying the file after a pods containers have already been started. | Workload |
| [User Pods should not be placed in kube-system namespace] | ensure that User pods are not placed in kube-system namespace | Workload |
| [Protecting Pod service account tokens] | ensure that Pod specifications disable the secret token being mounted by setting automountServiceAccountToken: false | Workload |
| [Selector usage in network policies] | ensure that network policies selectors are applied to pods or namespaces to restricted ingress and egress traffic within the pod network | NetworkPolicy |
| [limit range usage] | ensure limit range policy has configure in order to limit resource usage for namespaces or nodes | LimitRange |
| [resource quota usage] | ensure resource quota policy has configure in order to limit aggregate resource usage within namespace | ResourceQuota |
| [All container images must start with the *.azurecr.io domain] | Containers should only use images from trusted registries. | Workload |
| [All container images must start with a GCR domain] | Containers should only use images from trusted GCR registries. | Workload |
## Pod Security Standard
### Baseline
| NAME | DESCRIPTION | KINDS |
|------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| [Access to host IPC namespace] | Sharing the hosts IPC namespace allows container processes to communicate with processes on the host. | Workload |
| [Access to host network] | Sharing the hosts network namespace permits processes in the pod to communicate with processes bound to the hosts loopback adapter. | Workload |
| [Access to host PID] | Sharing the hosts PID namespace allows visibility on host processes, potentially leaking information such as environment variables and configuration. | Workload |
| [Privileged container] | Privileged containers share namespaces with the host system and do not offer any security. They should be used exclusively for system containers that require high privileges. | Workload |
| [Non-default capabilities added] | Adding NET_RAW or capabilities beyond the default set must be disallowed. | Workload |
| [hostPath volumes mounted] | HostPath volumes must be forbidden. | Workload |
| [Access to host ports] | HostPorts should be disallowed, or at minimum restricted to a known list. | Workload |
| [Default AppArmor profile not set] | A program inside the container can bypass AppArmor protection policies. | Workload |
| [SELinux custom options set] | Setting a custom SELinux user or role option should be forbidden. | Workload |
| [Non-default /proc masks set] | The default /proc masks are set up to reduce attack surface, and should be required. | Workload |
| [Unsafe sysctl options set] | Sysctls can disable security mechanisms or affect all containers on a host, and should be disallowed except for an allowed 'safe' subset. A sysctl is considered safe if it is namespaced in the container or the Pod, and it is isolated from other Pods or processes on the same Node. | Workload |
### Restricted
| NAME | DESCRIPTION | KINDS |
|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| [Non-ephemeral volume types used] | In addition to restricting HostPath volumes, usage of non-ephemeral volume types should be limited to those defined through PersistentVolumes. | Workload |
| [Process can elevate its own privileges] | A program inside the container can elevate its own privileges and run as root, which might give the program control over the container and node. | Workload |
| [Runs as root user] | 'runAsNonRoot' forces the running image to run as a non-root user to ensure least privileges. | Workload |
| [A root primary or supplementary GID set] | Containers should be forbidden from running with a root primary or supplementary GID. | Workload |
| [Default Seccomp profile not set] | The RuntimeDefault seccomp profile must be required, or allow specific additional profiles. | Workload |
[CPU not limited]: https://avd.aquasec.com/misconfig/kubernetes/ksv011/
[CPU requests not specified]: https://avd.aquasec.com/misconfig/kubernetes/ksv015/
[SYS_ADMIN capability added]: https://avd.aquasec.com/misconfig/kubernetes/ksv005/
[Default capabilities not dropped]: https://avd.aquasec.com/misconfig/kubernetes/ksv003/
[Root file system is not read-only]: https://avd.aquasec.com/misconfig/kubernetes/ksv014/
[Memory not limited]: https://avd.aquasec.com/misconfig/kubernetes/ksv018/
[Memory requests not specified]: https://avd.aquasec.com/misconfig/kubernetes/ksv016/
[hostPath volume mounted with docker.sock]: https://avd.aquasec.com/misconfig/kubernetes/ksv006/
[Runs with low group ID]: https://avd.aquasec.com/misconfig/kubernetes/ksv021/
[Runs with low user ID]: https://avd.aquasec.com/misconfig/kubernetes/ksv020/
[Tiller Is Deployed]: https://avd.aquasec.com/misconfig/kubernetes/ksv102/
[Image tag ':latest' used]: https://avd.aquasec.com/misconfig/kubernetes/ksv013/
[Unused capabilities should be dropped (drop any)]: https://avd.aquasec.com/misconfig/kubernetes/ksv004/
[hostAliases is set]: https://avd.aquasec.com/misconfig/kubernetes/ksv007/
[User Pods should not be placed in kube-system namespace]: https://avd.aquasec.com/misconfig/kubernetes/ksv037/
[Protecting Pod service account tokens]: https://avd.aquasec.com/misconfig/kubernetes/ksv036/
[Selector usage in network policies]: https://avd.aquasec.com/misconfig/kubernetes/ksv038/
[limit range usage]: https://avd.aquasec.com/misconfig/kubernetes/ksv039/
[resource quota usage]: https://avd.aquasec.com/misconfig/kubernetes/ksv040/
[All container images must start with the *.azurecr.io domain]: https://avd.aquasec.com/misconfig/kubernetes/ksv032/
[All container images must start with a GCR domain]: https://avd.aquasec.com/misconfig/kubernetes/ksv033/
[Access to host IPC namespace]: https://avd.aquasec.com/misconfig/kubernetes/ksv008/
[Access to host network]: https://avd.aquasec.com/misconfig/kubernetes/ksv009/
[Access to host PID]: https://avd.aquasec.com/misconfig/kubernetes/ksv010/
[Privileged container]: https://avd.aquasec.com/misconfig/kubernetes/ksv017/
[Non-default capabilities added]: https://avd.aquasec.com/misconfig/kubernetes/ksv022/
[hostPath volumes mounted]: https://avd.aquasec.com/misconfig/kubernetes/ksv023/
[Access to host ports]: https://avd.aquasec.com/misconfig/kubernetes/ksv024/
[Default AppArmor profile not set]: https://avd.aquasec.com/misconfig/kubernetes/ksv002/
[SELinux custom options set]: https://avd.aquasec.com/misconfig/kubernetes/ksv025/
[Non-default /proc masks set]: https://avd.aquasec.com/misconfig/kubernetes/ksv027/
[Unsafe sysctl options set]: https://avd.aquasec.com/misconfig/kubernetes/ksv026/
[Non-ephemeral volume types used]: https://avd.aquasec.com/misconfig/kubernetes/ksv028/
[Process can elevate its own privileges]: https://avd.aquasec.com/misconfig/kubernetes/ksv001/
[Runs as root user]: https://avd.aquasec.com/misconfig/kubernetes/ksv012/
[A root primary or supplementary GID set]: https://avd.aquasec.com/misconfig/kubernetes/ksv029/
[Default Seccomp profile not set]: https://avd.aquasec.com/misconfig/kubernetes/ksv030/

View File

@@ -0,0 +1,18 @@
# Configuration Auditing
As your organization deploys containerized workloads in Kubernetes environments, you will be faced with many
configuration choices related to images, containers, control plane, and data plane. Setting these configurations
improperly creates a high-impact security and compliance risk. DevOps, and platform owners need the ability to
continuously assess build artifacts, workloads, and infrastructure against configuration hardening standards to
remediate any violations.
trivy-operator configuration audit capabilities are purpose-built for Kubernetes environments. In particular, trivy
Operator continuously checks images, workloads, and Kubernetes infrastructure components against common configurations
security standards and generates detailed assessment reports, which are then stored in the default Kubernetes database.
Kubernetes applications and other core configuration objects, such as Ingress, NetworkPolicy and ResourceQuota resources, are evaluated against [Built-in Policies].
Additionally, application and infrastructure owners can integrate these reports into incident response workflows for
active remediation.
[Built-in Policies]: ./built-in-policies.md

View File

@@ -0,0 +1,100 @@
# Configuration
You can configure Trivy-Operator to control it's behavior and adapt it to your needs. Aspects of the operator machinery are configured using environment variables on the operator Pod, while aspects of the scanning behavior are controlled by ConfigMaps and Secrets.
# Operator Configuration
| NAME| DEFAULT| DESCRIPTION|
|---|---|---|
| `OPERATOR_NAMESPACE`| N/A| See [Install modes](#install-modes)|
| `OPERATOR_TARGET_NAMESPACES`| N/A| See [Install modes](#install-modes)|
| `OPERATOR_EXCLUDE_NAMESPACES`| N/A| A comma separated list of namespaces (or glob patterns) to be excluded from scanning in all namespaces [Install mode](#install-modes).|
| `OPERATOR_SERVICE_ACCOUNT`| `trivy-operator`| The name of the service account assigned to the operator's pod|
| `OPERATOR_LOG_DEV_MODE`| `false`| The flag to use (or not use) development mode (more human-readable output, extra stack traces and logging information, etc).|
| `OPERATOR_SCAN_JOB_TIMEOUT`| `5m`| The length of time to wait before giving up on a scan job|
| `OPERATOR_CONCURRENT_SCAN_JOBS_LIMIT`| `10`| The maximum number of scan jobs create by the operator|
| `OPERATOR_SCAN_JOB_RETRY_AFTER`| `30s`| The duration to wait before retrying a failed scan job|
| `OPERATOR_BATCH_DELETE_LIMIT`| `10`| The maximum number of config audit reports deleted by the operator when the plugin's config has changed.|
| `OPERATOR_BATCH_DELETE_DELAY`| `10s`| The duration to wait before deleting another batch of config audit reports.|
| `OPERATOR_METRICS_BIND_ADDRESS`| `:8080`| The TCP address to bind to for serving [Prometheus][prometheus] metrics. It can be set to `0` to disable the metrics serving.|
| `OPERATOR_HEALTH_PROBE_BIND_ADDRESS`| `:9090`| The TCP address to bind to for serving health probes, i.e. `/healthz/` and `/readyz/` endpoints.|
| `OPERATOR_VULNERABILITY_SCANNER_ENABLED`| `true`| The flag to enable vulnerability scanner|
| `OPERATOR_CONFIG_AUDIT_SCANNER_ENABLED`| `false`| The flag to enable configuration audit scanner|
| `OPERATOR_CONFIG_AUDIT_SCANNER_SCAN_ONLY_CURRENT_REVISIONS`| `false`| The flag to enable config audit scanner to only scan the current revision of a deployment|
| `OPERATOR_CONFIG_AUDIT_SCANNER_BUILTIN`| `true`| The flag to enable built-in configuration audit scanner|
| `OPERATOR_VULNERABILITY_SCANNER_SCAN_ONLY_CURRENT_REVISIONS`| `false`| The flag to enable vulnerability scanner to only scan the current revision of a deployment|
| `OPERATOR_VULNERABILITY_SCANNER_REPORT_TTL`| `""`| The flag to set how long a vulnerability report should exist. When a old report is deleted a new one will be created by the controller. It can be set to `""` to disabled the TTL for vulnerability scanner. |
| `OPERATOR_LEADER_ELECTION_ENABLED`| `false`| The flag to enable operator replica leader election|
| `OPERATOR_LEADER_ELECTION_ID`| `trivy-operator-lock`| The name of the resource lock for leader election|
The values of the `OPERATOR_NAMESPACE` and `OPERATOR_TARGET_NAMESPACES` determine the install mode, which in turn determines the multitenancy support of the operator.
| MODE| OPERATOR_NAMESPACE | OPERATOR_TARGET_NAMESPACES | DESCRIPTION|
|---|---|---|---|
| OwnNamespace| `operators`| `operators`| The operator can be configured to watch events in the namespace it is deployed in. |
| SingleNamespace| `operators`| `foo`| The operator can be configured to watch for events in a single namespace that the operator is not deployed in. |
| MultiNamespace| `operators`| `foo,bar,baz`| The operator can be configured to watch for events in more than one namespace. |
| AllNamespaces| `operators`| (blank string)| The operator can be configured to watch for events in all namespaces.|
## Example - configure namespaces to scan
To change the target namespace from all namespaces to the `default` namespace edit the `trivy-operator` Deployment and change the value of the `OPERATOR_TARGET_NAMESPACES` environment variable from the blank string (`""`) to the `default` value.
# Scanning configuration
| CONFIGMAP KEY| DEFAULT| DESCRIPTION|
|---|---|---|
| `vulnerabilityReports.scanner`| `Trivy`| The name of the plugin that generates vulnerability reports. Either `Trivy` or `Aqua`.|
| `vulnerabilityReports.scanJobsInSameNamespace` | `"false"`| Whether to run vulnerability scan jobs in same namespace of workload. Set `"true"` to enable.|
| `scanJob.tolerations`| N/A| JSON representation of the [tolerations] to be applied to the scanner pods so that they can run on nodes with matching taints. Example: `'[{"key":"key1", "operator":"Equal", "value":"value1", "effect":"NoSchedule"}]'`|
| `scanJob.annotations`| N/A| One-line comma-separated representation of the annotations which the user wants the scanner pods to be annotated with. Example: `foo=bar,env=stage` will annotate the scanner pods with the annotations `foo: bar` and `env: stage` |
| `scanJob.templateLabel`| N/A| One-line comma-separated representation of the template labels which the user wants the scanner pods to be labeled with. Example: `foo=bar,env=stage` will labeled the scanner pods with the labels `foo: bar` and `env: stage`|
## Example - patch ConfigMap
By default Trivy displays vulnerabilities with all severity levels (`UNKNOWN`, `LOW`, `MEDIUM`, `HIGH`, `CRITICAL`). To display only `HIGH` and `CRITICAL` vulnerabilities by patching the `trivy.severity` value in the `trivy-operator-trivy-config` ConfigMap:
```bash
kubectl patch cm trivy-operator-trivy-config -n trivy-operator \
--type merge \
-p "$(cat <<EOF
{
"data": {
"trivy.severity": "HIGH,CRITICAL"
}
}
EOF
)"
```
## Example - patch Secret
To set the GitHub token used by Trivy scanner add the `trivy.githubToken` value to the `trivy-operator-trivy-config` Secret:
```bash
kubectl patch secret trivy-operator-trivy-config -n trivy-operator \
--type merge \
-p "$(cat <<EOF
{
"data": {
"trivy.githubToken": "$(echo -n <your token> | base64)"
}
}
EOF
)"
```
## Example - delete a key
The following `kubectl patch` command deletes the `trivy.httpProxy` key:
```bash
kubectl patch cm trivy-operator-trivy-config -n trivy-operator \
--type json \
-p '[{"op": "remove", "path": "/data/trivy.httpProxy"}]'
```
[tolerations]: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration
[prometheus]: https://github.com/prometheus

View File

@@ -0,0 +1,195 @@
# Getting Started
## Before you Begin
You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your
cluster. If you do not already have a cluster, you can create one by installing [minikube], [kind] or [microk8s], or you can use the following [Kubernetes playground].
You also need the Trivy-Operator to be installed in the `trivy-system` namespace, e.g. with
[kubectl](./installation/kubectl.md) or [Helm](./installation/helm.md). Let's also assume that the operator is
configured to discover built-in Kubernetes resources in all namespaces, except `kube-system` and `trivy-system`.
## Workloads Scanning
Let's create the `nginx` Deployment that we know is vulnerable:
```
kubectl create deployment nginx --image nginx:1.16
```
When the `nginx` Deployment is created, the operator immediately detects its current revision (aka active ReplicaSet)
and scans the `nginx:1.16` image for vulnerabilities. It also audits the ReplicaSet's specification for common pitfalls
such as running the `nginx` container as root.
If everything goes fine, the operator saves scan reports as VulnerabilityReport and ConfigAuditReport resources in the
`default` namespace. Reports are named after the scanned ReplicaSet. For image vulnerability scans, the operator creates
a VulnerabilityReport for each different container. In this example there is just one container image called `nginx`:
```
kubectl get vulnerabilityreports -o wide
```
<details>
<summary>Result</summary>
```
NAME REPOSITORY TAG SCANNER AGE CRITICAL HIGH MEDIUM LOW UNKNOWN
replicaset-nginx-78449c65d4-nginx library/nginx 1.16 Trivy 85s 33 62 49 114 1
```
</details>
```
kubectl get configauditreports -o wide
```
<details>
<summary>Result</summary>
```
NAME SCANNER AGE CRITICAL HIGH MEDIUM LOW
replicaset-nginx-78449c65d4 Trivy-Operator 2m7s 0 0 6 7
```
</details>
Notice that scan reports generated by the operator are controlled by Kubernetes workloads. In our example,
VulnerabilityReport and ConfigAuditReport resources are controlled by the active ReplicaSet of the `nginx` Deployment:
```console
kubectl tree deploy nginx
```
<details>
<summary>Result</summary>
```
NAMESPACE NAME READY REASON AGE
default Deployment/nginx - 7h2m
default └─ReplicaSet/nginx-78449c65d4 - 7h2m
default ├─ConfigAuditReport/replicaset-nginx-78449c65d4 - 2m31s
default ├─Pod/nginx-78449c65d4-5wvdx True 7h2m
default └─VulnerabilityReport/replicaset-nginx-78449c65d4-nginx - 2m7s
```
</details>
!!! note
The [tree] command is a kubectl plugin to browse Kubernetes object hierarchies as a tree.
Moving forward, let's update the container image of the `nginx` Deployment from `nginx:1.16` to `nginx:1.17`. This will
trigger a rolling update of the Deployment and eventually create another ReplicaSet.
```
kubectl set image deployment nginx nginx=nginx:1.17
```
Even this time the operator will pick up changes and rescan our Deployment with updated configuration:
```
kubectl tree deploy nginx
```
<details>
<summary>Result</summary>
```
NAMESPACE NAME READY REASON AGE
default Deployment/nginx - 7h5m
default ├─ReplicaSet/nginx-5fbc65fff - 2m36s
default │ ├─ConfigAuditReport/replicaset-nginx-5fbc65fff - 2m36s
default │ ├─Pod/nginx-5fbc65fff-j7zl2 True 2m36s
default │ └─VulnerabilityReport/replicaset-nginx-5fbc65fff-nginx - 2m22s
default └─ReplicaSet/nginx-78449c65d4 - 7h5m
default ├─ConfigAuditReport/replicaset-nginx-78449c65d4 - 5m46s
default └─VulnerabilityReport/replicaset-nginx-78449c65d4-nginx - 5m22s
```
</details>
By following this guide you could realize that the operator knows how to attach VulnerabilityReport and
ConfigAuditReport resources to build-in Kubernetes objects. What's more, in this approach where a custom resource
inherits a life cycle of the built-in resource we could leverage Kubernetes garbage collection. For example, when the
previous ReplicaSet named `nginx-78449c65d4` is deleted the VulnerabilityReport named `replicaset-nginx-78449c65d4-nginx`
as well as the ConfigAuditReport named `replicaset-nginx-78449c65d46` are automatically garbage collected.
!!! tip
If you only want the latest ReplicaSet in your Deployment to be scanned for vulnerabilities, you can set the value
of the `OPERATOR_VULNERABILITY_SCANNER_SCAN_ONLY_CURRENT_REVISIONS` environment variable to `true` in the operator's
deployment descriptor. This is useful to identify vulnerabilities that impact only the running workloads.
!!! tip
If you only want the latest ReplicaSet in your Deployment to be scanned for config audit, you can set the value
of the `OPERATOR_CONFIG_AUDIT_SCANNER_SCAN_ONLY_CURRENT_REVISIONS` environment variable to `true` in the operator's
deployment descriptor. This is useful to identify config issues that impact only the running workloads.
!!! tip
You can get and describe `vulnerabilityreports` and `configauditreports` as built-in Kubernetes objects:
```
kubectl get vulnerabilityreport replicaset-nginx-5fbc65fff-nginx -o json
kubectl describe configauditreport replicaset-nginx-5fbc65fff
```
Notice that scaling up the `nginx` Deployment will not schedule new scans because all replica Pods refer to the same Pod
template defined by the `nginx-5fbc65fff` ReplicaSet.
```
kubectl scale deploy nginx --replicas 3
```
```
kubectl tree deploy nginx
```
<details>
<summary>Result</summary>
```
NAMESPACE NAME READY REASON AGE
default Deployment/nginx - 7h6m
default ├─ReplicaSet/nginx-5fbc65fff - 4m7s
default │ ├─ConfigAuditReport/replicaset-nginx-5fbc65fff - 4m7s
default │ ├─Pod/nginx-5fbc65fff-458n7 True 8s
default │ ├─Pod/nginx-5fbc65fff-fk847 True 8s
default │ ├─Pod/nginx-5fbc65fff-j7zl2 True 4m7s
default │ └─VulnerabilityReport/replicaset-nginx-5fbc65fff-nginx - 3m53s
default └─ReplicaSet/nginx-78449c65d4 - 7h6m
default ├─ConfigAuditReport/replicaset-nginx-78449c65d4 - 7m17s
default └─VulnerabilityReport/replicaset-nginx-78449c65d4-nginx - 6m53s
```
</details>
Finally, when you delete the `nginx` Deployment, orphaned security reports will be deleted in the background by the
Kubernetes garbage collection controller.
```
kubectl delete deploy nginx
```
```console
kubectl get vuln,configaudit
```
<details>
<summary>Result</summary>
```
No resources found in default namespace.
```
</details>
!!! Tip
Use `vuln` and `configaudit` as short names for `vulnerabilityreports` and `configauditreports` resources.
!!! Note
You can define the validity period for VulnerabilityReports by setting the duration as the value of the
`OPERATOR_VULNERABILITY_SCANNER_REPORT_TTL` environment variable. For example, setting the value to `24h`
would delete reports after 24 hours. When a VulnerabilityReport gets deleted Trivy-Operator will automatically
## What's Next?
- Find out how the operator scans workloads that use container images from [Private Registries].
- By default, the operator uses Trivy as [Vulnerability Scanner] and Polaris as [Configuration Checker], but you can
choose other tools that are integrated with Trivy-Operator or even implement you own plugin.
[minikube]: https://minikube.sigs.k8s.io/docs/
[kind]: https://kind.sigs.k8s.io/docs/
[microk8s]: https://microk8s.io/
[Kubernetes playground]: http://labs.play-with-k8s.com/
[tree]: https://github.com/ahmetb/kubectl-tree

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path d="M19.90856,11.37359l-.94046,1.16318.04433.42088a.66075.66075,0,0,1,.00653.25385l-.00778.04071a.66193.66193,0,0,1-.08906.21314c-.01313.01986-.027.03932-.0384.0537l-4.57928,5.69351a.70189.70189,0,0,1-.53066.25266l-7.34439-.00171a.70458.70458,0,0,1-.52974-.25154L1.32209,13.51754a.64957.64957,0,0,1-.096-.16658.71032.71032,0,0,1-.02863-.08952.66205.66205,0,0,1-.00515-.30511l1.6348-7.10077a.66883.66883,0,0,1,.1355-.274.65915.65915,0,0,1,.22568-.17666L9.80881,2.24386a.69063.69063,0,0,1,.29475-.0667l.00515.0002.03424.00112a.68668.68668,0,0,1,.25649.06544l6.61569,3.161a.66765.66765,0,0,1,.21678.165.675.675,0,0,1,.14909.29139l.60521,2.64815,1.1606-.20569-.61853-2.70614a1.85372,1.85372,0,0,0-1.00544-1.25474l-6.616-3.16113a1.84812,1.84812,0,0,0-.67883-.17726l-.03061-.00218c-.02692-.00125-.05416-.00152-.05851-.00152L10.10146,1a1.87317,1.87317,0,0,0-.80022.18175l-6.62038,3.161a1.83083,1.83083,0,0,0-.62572.48916,1.84956,1.84956,0,0,0-.37523.75964L.04518,12.69226a1.84474,1.84474,0,0,0,.00956.8516,1.88289,1.88289,0,0,0,.07772.24244,1.826,1.826,0,0,0,.27219.46878L4.98281,19.9503a1.8815,1.8815,0,0,0,1.4473.6903l7.34394.00172a1.87874,1.87874,0,0,0,1.4475-.69182l4.58278-5.698c.03609-.04578.07026-.093.10252-.14243a1.82018,1.82018,0,0,0,.25207-.59695c.00805-.03517.01484-.07079.021-.10773a1.8273,1.8273,0,0,0-.02032-.71135Z" style="fill:#fff"/><polygon points="9.436 4.863 9.332 11.183 12.92 10.115 9.436 4.863" style="fill:#fff"/><polygon points="7.913 11.605 8.265 11.5 8.617 11.395 8.629 11.392 8.74 4.605 8.753 3.838 8.384 4.915 8.015 5.994 5.964 11.986 6.684 11.971 7.913 11.605" style="fill:#fff"/><polygon points="5.738 13.279 5.888 12.956 6.014 12.685 5.723 12.691 5.352 12.699 5.06 12.705 1.918 12.771 4.498 15.952 5.588 13.603 5.738 13.279" style="fill:#fff"/><polygon points="14.026 10.516 13.675 10.621 13.324 10.725 9.32 11.917 8.969 12.021 8.617 12.126 8.604 12.13 8.252 12.235 7.9 12.339 7.593 12.431 7.894 12.688 8.238 12.982 8.583 13.277 8.598 13.289 8.943 13.584 9.288 13.879 9.61 14.154 9.896 14.398 10.183 14.643 14.064 17.958 22 8.143 14.026 10.516" style="fill:#fff"/><polygon points="9.273 14.787 9.229 14.749 8.943 14.505 8.928 14.492 8.583 14.197 8.567 14.183 8.222 13.889 7.877 13.594 7.362 13.154 7.086 12.919 6.81 12.683 6.794 12.669 6.641 12.998 6.488 13.328 6.468 13.371 6.318 13.694 6.168 14.017 4.989 16.557 4.989 16.558 4.99 16.558 4.992 16.559 5.341 16.638 5.691 16.716 12.164 18.175 12.895 18.339 13.625 18.504 9.516 14.994 9.273 14.787" style="fill:#fff"/></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -0,0 +1,15 @@
# Trivy Operator
Trivy has a native [Kubernetes Operator](operator) which continuously scans your Kubernetes cluster for security issues, and generates security reports as Kubernetes [Custom Resources](crd). It does it by watching Kubernetes for state changes and automatically triggering scans in response to changes, for example initiating a vulnerability scan when a new Pod is created.
> Trivy Operator is based on existing Aqua OSS project - [Starboard], and shares some of the design, principles and code with it. Existing content that relates to Starboard Operator might also be relevant for Trivy Operator. To learn more about the transition from Starboard from Trivy, see the [announcement discussion](starboard-announcement).
<figure>
<img src="./images/operator/trivy-operator-workloads.png" />
<figcaption>Workload reconcilers discover K8s controllers, manage scan jobs, and create VulnerabilityReport and ConfigAuditReport objects.</figcaption>
</figure>
[operator]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
[crd]: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
[Starboard]: https://github.com/aquasecurity/starboard
[starboard-announcement]: https://github.com/aquasecurity/starboard/discussions/1173

View File

@@ -0,0 +1,90 @@
# Helm
[Helm], which is a popular package manager for Kubernetes, allows installing applications from parameterized
YAML manifests called Helm [charts].
The Helm chart is available on GitHub in [https://github.com/aquasecurity/trivy-operator](https://github.com/aquasecurity/trivy-operator) under `/deploy/helm` and is also hosted in a Chart repository for your convenience under [https://aquasecurity.github.io/helm-charts/](https://aquasecurity.github.io/helm-charts/).
## Example - Chart repository
This will install the operator in the `trivy-system` namespace and configure it to scan all namespaces, except `kube-system` and `trivy-system`:
```bash
helm repo add aqua https://aquasecurity.github.io/helm-charts/
helm repo update
helm install trivy-operator aqua/trivy-operator \
--namespace trivy-system \
--create-namespace \
--set="trivy.ignoreUnfixed=true" \
--version {{ var.operator_version }}
```
## Example - Download the chart
This will install the operator in the `trivy-system` namespace and configure it to scan all namespaces, except `kube-system` and `trivy-system`:
```bash
git clone --depth 1 --branch {{ var.operator_version }} https://github.com/aquasecurity/trivy-operator.git
cd trivy-operator
helm install trivy-operator ./deploy/helm \
--namespace trivy-system \
--create-namespace \
--set="trivy.ignoreUnfixed=true"
```
## Post install sanity check
Check that the `trivy-operator` Helm release is created in the `trivy-system` namespace, and it has status `deployed`:
```console
$ helm list -n trivy-system
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
trivy-operator trivy-system 1 2021-01-27 20:09:53.158961 +0100 CET deployed trivy-operator-{{ var.operator_version }} {{ var.operator_version[1:] }}
```
To confirm that the operator is running, check that the `trivy-operator` Deployment in the `trivy-system`
namespace is available and all its containers are ready:
```console
$ kubectl get deployment -n trivy-system
NAME READY UP-TO-DATE AVAILABLE AGE
trivy-operator 1/1 1 1 11m
```
If for some reason it's not ready yet, check the logs of the Deployment for errors:
```
kubectl logs deployment/trivy-operator -n trivy-system
```
## Advanced Configuration
The Helm chart supports all available [installation modes](./../configuration.md#install-modes) of Trivy Operator.
Please refer to the chart's [values] file for configuration options.
## Uninstall
You can uninstall the operator with the following command:
```
helm uninstall trivy-operator -n trivy-system
```
You have to manually delete custom resource definitions created by the `helm install` command:
!!! danger
Deleting custom resource definitions will also delete all security reports generated by the operator.
```
kubectl delete crd vulnerabilityreports.aquasecurity.github.io
kubectl delete crd clustervulnerabilityreports.aquasecurity.github.io
kubectl delete crd configauditreports.aquasecurity.github.io
kubectl delete crd clusterconfigauditreports.aquasecurity.github.io
kubectl delete crd clustercompliancereports.aquasecurity.github.io
kubectl delete crd clustercompliancedetailreports.aquasecurity.github.io
```
[Helm]: https://helm.sh/
[charts]: https://helm.sh/docs/topics/charts/
[values]: https://raw.githubusercontent.com/aquasecurity/trivy-operator/{{ var.operator_version }}/deploy/helm/values.yaml

View File

@@ -0,0 +1,45 @@
# kubectl
Kubernetes Yaml deployment files are available on GitHub in [https://github.com/aquasecurity/trivy-operator](https://github.com/aquasecurity/trivy-operator) under `/deploy/static`.
## Example - Deploy from GitHub
This will install the operator in the `trivy-system` namespace and configure it to scan all namespaces, except `kube-system` and `trivy-system`:
```bash
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/trivy-operator/{{ var.operator_version }}/deploy/static/trivy-operator.yaml
```
To confirm that the operator is running, check that the `trivy-operator` Deployment in the `trivy-system`
namespace is available and all its containers are ready:
```bash
$ kubectl get deployment -n trivy-system
NAME READY UP-TO-DATE AVAILABLE AGE
trivy-operator 1/1 1 1 11m
```
If for some reason it's not ready yet, check the logs of the `trivy-operator` Deployment for errors:
```bash
kubectl logs deployment/trivy-operator -n trivy-system
```
## Advanced Configuration
You can configure Trivy-Operator to control it's behavior and adapt it to your needs. Aspects of the operator machinery are configured using environment variables on the operator Pod, while aspects of the scanning behavior are controlled by ConfigMaps and Secrets.
To learn more, please refer to the [Configuration](config) documentation.
## Uninstall
!!! danger
Uninstalling the operator and deleting custom resource definitions will also delete all generated security reports.
You can uninstall the operator with the following command:
```
kubectl delete -f https://raw.githubusercontent.com/aquasecurity/trivy-operator/{{ var.operator_version }}/deploy/static/trivy-operator.yaml
```
[Settings]: ./../../settings.md
[Helm]: ./helm.md

View File

@@ -0,0 +1,10 @@
# Upgrade
We recommend that you upgrade Trivy Operator often to stay up to date with the latest fixes and enhancements.
However, at this stage we do not provide automated upgrades. Therefore, uninstall the previous version of the operator
before you install the latest release.
!!! warning
Consult release notes and changelog to revisit and migrate configuration settings which may not be compatible
between different versions.

View File

@@ -0,0 +1,106 @@
# Troubleshooting the Trivy Operator
The Trivy Operator installs several Kubernetes resources into your Kubernetes cluster.
Here are the common steps to check whether the operator is running correctly and to troubleshoot common issues.
So in addition to this section, you might want to check [issues](https://github.com/aquasecurity/trivy/issues), [discussion forum](https://github.com/aquasecurity/trivy/discussions), or [Slack](https://slack.aquasec.com) to see if someone from the community had similar problems before.
Also note that Trivy Operator is based on existing Aqua OSS project - [Starboard], and shares some of the design, principles and code with it. Existing content that relates to Starboard Operator might also be relevant for Trivy Operator, and Starboard's [issues](https://github.com/aquasecurity/starboard/issues), [discussion forum](https://github.com/aquasecurity/starboard/discussions), or [Slack](https://slack.aquasec.com) might also be interesting to check.
In some cases you might want to refer to [Starboard's Design documents](https://aquasecurity.github.io/starboard/latest/design/)
## Installation
Make sure that the latest version of the Trivy Operator is installed. For this, have a look at the installation [options.](./installation/helm.md)
For instance, if your are using the Helm deployment, you need to check the Helm Chart version deployed to your cluster. You can check the Helm Chart version with the following command:
```
helm list -n trivy-operator
```
## Operator Pod Not Running
The Trivy Operator will run a pod inside your cluster. If you have followed the installation guide, you will have installed the Operator to the `trivy-system`.
Make sure that the pod is in the `Running` status:
```
kubectl get pods -n trivy-system
```
This is how it will look if it is running okay:
```
NAMESPACE NAME READY STATUS RESTARTS AGE
trivy-operator trivy-operator-6c9bd97d58-hsz4g 1/1 Running 5 (19m ago) 30h
```
If the pod is in `Failed`, `Pending`, or `Unknown` check the events and the logs of the pod.
First, check the events, since they might be more descriptive of the problem. However, if the events do not give a clear reason why the pod cannot spin up, then you want to check the logs, which provide more detail.
```
kubectl describe pod <POD-NAME> -n trivy-system
```
To check the logs, use the following command:
```
kubectl logs deployment/trivy-operator -n trivy-system
```
If your pod is not running, try to look for errors as they can give an indication on the problem.
If there are too many logs messages, try deleting the Trivy pod and observe its behavior upon restarting. A new pod should spin up automatically after deleting the failed pod.
## ImagePullBackOff or ErrImagePull
Check the status of the Trivy Operator pod running inside of your Kubernetes cluster. If the Status is ImagePullBackOff or ErrImagePull, it means that the Operator either
* tries to access the wrong image
* cannot pull the image from the registry
Make sure that you are providing the right resources upon installing the Trivy Operator.
## CrashLoopBackOff
If your pod is in `CrashLoopBackOff`, it is likely the case that the pod cannot be scheduled on the Kubernetes node that it is trying to schedule on.
In this case, you want to investigate further whether there is an issue with the node. It could for instance be the case that the node does not have sufficient resources.
## Reconciliation Error
It could happen that the pod appears to be running normally but does not reconcile the resources inside of your Kubernetes cluster.
Check the logs for reconciliation errors:
```
kubectl logs deployment/trivy-operator -n trivy-system
```
If this is the case, the Trivy Operator likely does not have the right configurations to access your resource.
## Operator does not Create VulnerabilityReports
VulnerabilityReports are owned and controlled by the immediate Kubernetes workload. Every VulnerabilityReport of a pod is thus, linked to a [ReplicaSet.](./index.md) In case the Trivy Operator does not create a VulnerabilityReport for your workloads, it could be that it is not monitoring the namespace that your workloads are running on.
An easy way to check this is by looking for the `ClusterRoleBinding` for the Trivy Operator:
```
kubectl get ClusterRoleBinding | grep "trivy-operator"
```
Alternatively, you could use the `kubectl-who-can` [plugin by Aqua](https://github.com/aquasecurity/kubectl-who-can):
```console
$ kubectl who-can list vulnerabilityreports
No subjects found with permissions to list vulnerabilityreports assigned through RoleBindings
CLUSTERROLEBINDING SUBJECT TYPE SA-NAMESPACE
cluster-admin system:masters Group
trivy-operator trivy-operator ServiceAccount trivy-system
system:controller:generic-garbage-collector generic-garbage-collector ServiceAccount kube-system
system:controller:namespace-controller namespace-controller ServiceAccount kube-system
system:controller:resourcequota-controller resourcequota-controller ServiceAccount kube-system
system:kube-controller-manager system:kube-controller-manager User
```
If the `ClusterRoleBinding` does not exist, Trivy currently cannot monitor any namespace outside of the `trivy-system` namespace.
For instance, if you are using the [Helm Chart](./installation/helm.md), you want to make sure to set the `targetNamespace` to the namespace that you want the Operator to monitor.

View File

@@ -0,0 +1,109 @@
# Vulnerability Scanning Configuration
## Standalone
The default configuration settings enable Trivy `vulnerabilityReports.scanner` in [`Standalone`][trivy-standalone]
`trivy.mode`. Even though it doesn't require any additional setup, it's the least efficient method. Each Pod created
by a scan Job has the init container that downloads the Trivy vulnerabilities database from the GitHub releases page
and stores it in the local file system of the [emptyDir volume]. This volume is then shared with containers that perform
the actual scanning. Finally, the Pod is deleted along with the emptyDir volume.
![](./../images/design/trivy-standalone.png)
The number of containers defined by a scan Job equals the number of containers defined by the scanned Kubernetes
workload, so the cache in this mode is useful only if the workload defines multiple containers.
Beyond that, frequent downloads from GitHub might lead to a [rate limiting] problem. The limits are imposed by GitHub on
all anonymous requests originating from a given IP. To mitigate such problems you can add the `trivy.githubToken` key to
the `trivy-operator` secret.
```bash
kubectl patch secret trivy-operator-trivy-config -n trivy-operator \
--type merge \
-p "$(cat <<EOF
{
"data": {
"trivy.githubToken": "$(echo -n <GITHUB_TOKEN> | base64)"
}
}
EOF
)"
```
## ClientServer
You can connect Trivy to an external Trivy server by changing the default `trivy.mode` from
[`Standalone`][trivy-standalone] to [`ClientServer`][trivy-clientserver] and specifying `trivy.serverURL`.
```bash
kubectl patch cm trivy-operator-trivy-config -n trivy-operator \
--type merge \
-p "$(cat <<EOF
{
"data": {
"trivy.mode": "ClientServer",
"trivy.serverURL": "<TRIVY_SERVER_URL>"
}
}
EOF
)"
```
The Trivy server could be your own deployment, or it could be an external service. See [Trivy server][trivy-clientserver] documentation for more information.
If the server requires access token and/or custom HTTP authentication headers, you may add `trivy.serverToken` and `trivy.serverCustomHeaders` properties to the Trivy Operator secret.
```bash
kubectl patch secret trivy-operator-trivy-config -n trivy-operator \
--type merge \
-p "$(cat <<EOF
{
"data": {
"trivy.serverToken": "$(echo -n <SERVER_TOKEN> | base64)",
"trivy.serverCustomHeaders": "$(echo -n x-api-token:<X_API_TOKEN> | base64)"
}
}
EOF
)"
```
![](./../images/design/trivy-clientserver.png)
## Settings
| CONFIGMAP KEY| DEFAULT| DESCRIPTION|
|---|---|---|
| `trivy.imageRef`| `docker.io/aquasec/trivy:0.25.2`| Trivy image reference|
| `trivy.dbRepository`| `ghcr.io/aquasecurity/trivy-db`| External OCI Registry to download the vulnerability database|
| `trivy.mode`| `Standalone`| Trivy client mode. Either `Standalone` or `ClientServer`. Depending on the active mode other settings might be applicable or required. |
| `trivy.severity`| `UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL` | A comma separated list of severity levels reported by Trivy|
| `trivy.ignoreUnfixed`| N/A| Whether to show only fixed vulnerabilities in vulnerabilities reported by Trivy. Set to `"true"` to enable it.|
| `trivy.skipFiles`| N/A| A comma separated list of file paths for Trivy to skip traversal.|
| `trivy.skipDirs`| N/A| A comma separated list of directories for Trivy to skip traversal.|
| `trivy.ignoreFile`| N/A| It specifies the `.trivyignore` file which contains a list of vulnerability IDs to be ignored from vulnerabilities reported by Trivy.|
| `trivy.timeout`| `5m0s`| The duration to wait for scan completion|
| `trivy.serverURL`| N/A| The endpoint URL of the Trivy server. Required in `ClientServer` mode.|
| `trivy.serverTokenHeader`| `Trivy-Token`| The name of the HTTP header to send the authentication token to Trivy server. Only application in `ClientServer` mode when `trivy.serverToken` is specified.|
| `trivy.serverInsecure`| N/A| The Flag to enable insecure connection to the Trivy server.|
| `trivy.insecureRegistry.<id>`| N/A| The registry to which insecure connections are allowed. There can be multiple registries with different registry `<id>`.|
| `trivy.nonSslRegistry.<id>`| N/A| A registry without SSL. There can be multiple registries with different registry `<id>`.|
| `trivy.registry.mirror.<registry>` | N/A| Mirror for the registry `<registry>`, e.g. `trivy.registry.mirror.index.docker.io: mirror.io` would use `mirror.io` to get images originated from `index.docker.io` |
| `trivy.httpProxy`| N/A| The HTTP proxy used by Trivy to download the vulnerabilities database from GitHub.|
| `trivy.httpsProxy`| N/A| The HTTPS proxy used by Trivy to download the vulnerabilities database from GitHub.|
| `trivy.noProxy`| N/A| A comma separated list of IPs and domain names that are not subject to proxy settings.|
| `trivy.resources.requests.cpu`| `100m`| The minimum amount of CPU required to run Trivy scanner pod.|
| `trivy.resources.requests.memory`| `100M`| The minimum amount of memory required to run Trivy scanner pod.|
| `trivy.resources.limits.cpu`| `500m`| The maximum amount of CPU allowed to run Trivy scanner pod.|
| `trivy.resources.limits.memory`| `500M`| The maximum amount of memory allowed to run Trivy scanner pod.|
| SECRET KEY| DESCRIPTION|
|---|---|
| `trivy.githubToken`| The GitHub access token used by Trivy to download the vulnerabilities database from GitHub. Only applicable in `Standalone` mode. |
| `trivy.serverToken`| The token to authenticate Trivy client with Trivy server. Only applicable in `ClientServer` mode.|
| `trivy.serverCustomHeaders`| A comma separated list of custom HTTP headers sent by Trivy client to Trivy server. Only applicable in `ClientServer` mode.|
[trivy-standalone]: https://aquasecurity.github.io/trivy/latest/modes/standalone/
[emptyDir volume]: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
[rate limiting]: https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#rate-limiting
[trivy-clientserver]: https://aquasecurity.github.io/trivy/latest/advanced/modes/client-server/

View File

@@ -0,0 +1,29 @@
# Frequently Asked Questions
## Why do you duplicate instances of VulnerabilityReports for the same image digest?
Docker image reference is not a first class citizen in Kubernetes. It's a
property of the container definition. Trivy-operator relies on label selectors to
associate VulnerabilityReports with corresponding Kubernetes workloads, not
particular image references. For example, we can get all reports for the
wordpress Deployment with the following command:
```text
kubectl get vulnerabilityreports \
-l trivy-operator.resource.kind=Deployment \
-l trivy-operator.resource.name=wordpress
```
Beyond that, for each instance of the VulnerabilityReports we set the owner
reference pointing to the corresponding pods controller. By doing that we can
manage orphaned VulnerabilityReports and leverage Kubernetes garbage collection.
For example, if the `wordpress` Deployment is deleted, all related
VulnerabilityReports are automatically garbage collected.
## Why do you create an instance of the VulnerabilityReport for each container?
The idea is to partition VulnerabilityReports generated for a particular
Kubernetes workload by containers is to mitigate the risk of exceeding the etcd
request payload limit. By default, the payload of each Kubernetes object stored
etcd is subject to 1.5 MiB.

View File

@@ -0,0 +1,20 @@
# Vulnerability Scanners
Vulnerability scanning is an important way to identify and remediate security gaps in Kubernetes workloads. The
process involves scanning container images to check all software on them and report any vulnerabilities found.
Trivy Operator automatically discovers and scans all images that are being used in a Kubernetes cluster, including
images of application pods and system pods. Scan reports are saved as [VulnerabilityReport] resources, which are owned
by a Kubernetes controller.
For example, when Trivy scans a Deployment, the corresponding VulnerabilityReport instance is attached to its
current revision. In other words, the VulnerabilityReport inherits the life cycle of the Kubernetes controller. This
also implies that when a Deployment is rolling updated, it will get scanned automatically, and a new instance of the
VulnerabilityReport will be created and attached to the new revision. On the other hand, if the previous revision is
deleted, the corresponding VulnerabilityReport will be deleted automatically by the Kubernetes garbage collector.
Trivy may scan Kubernetes workloads that run images from [Private Registries] and certain [Managed Registries].
[Trivy]: ./trivy.md
[Private Registries]: ./managed-registries.md
[Managed Registries]: ./managed-registries.md

View File

@@ -0,0 +1,77 @@
## Amazon Elastic Container Registry (ECR)
You must create an IAM OIDC identity provider for your cluster:
```
eksctl utils associate-iam-oidc-provider \
--cluster <cluster_name> \
--approve
```
Override the existing `trivy-operator` service account and
attach the IAM policy to grant it permission to pull images from the ECR:
```
eksctl create iamserviceaccount \
--name trivy-operator \
--namespace trivy-operator \
--cluster <cluster_name> \
--attach-policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly \
--approve \
--override-existing-serviceaccounts
```
## Azure Container Registry (ACR)
Before you can start, you need to install `aad-pod-identity` inside your cluster, see installation instructions:
https://azure.github.io/aad-pod-identity/docs/getting-started/installation/
Create a managed identity and assign the permission to the ACR.
```sh
export IDENTITY_NAME=trivy-operator-identity
export AZURE_RESOURCE_GROUP=<my_resource_group>
export AZURE_LOCATION=westeurope
export ACR_NAME=<my_azure_container_registry>
az identity create --name ${IDENTITY_NAME} --resource-group ${AZURE_RESOURCE_GROUP} --location ${AZURE_LOCATION}
export IDENTITY_ID=(az identity show --name ${IDENTITY_NAME} --resource-group ${AZURE_RESOURCE_GROUP} --query id -o tsv)
export IDENTITY_CLIENT_ID=$(az identity show --name ${IDENTITY_NAME} --resource-group ${AZURE_RESOURCE_GROUP} --query clientId -o tsv)
export ACR_ID=$(az acr show --name ${ACR_NAME} --query id -o tsv)
az role assignment create --assignee ${IDENTITY_CLIENT_ID} --role 'AcrPull' --scope ${ACR_ID}
```
create an `AzureIdentity` and `AzureIdentityBinding` resource inside your kubernetes cluster:
```yaml
apiVersion: aadpodidentity.k8s.io/v1
kind: AzureIdentity
metadata:
name: trivy-identity
namespace: trivy-operator
spec:
clientID: ${IDENTITY_ID}
resourceID: ${IDENTITY_CLIENT_ID}
type: 0
```
```yaml
apiVersion: aadpodidentity.k8s.io/v1
kind: AzureIdentityBinding
metadata:
name: trivy-id-binding
namespace: trivy-operator
spec:
azureIdentity: trivy-operator-identity
selector: trivy-operator-label
```
add `scanJob.podTemplateLabels` to the Trivy Operator config map, the value must match the `AzureIdentityBinding` selector.
```sh
kubectl -n trivy-operator edit cm trivy-operator
# Insert scanJob.podTemplateLabels: aadpodidbinding=trivy-operator-label in data block
# validate
trivy-operator config --get scanJob.podTemplateLabels
```

View File

@@ -0,0 +1,24 @@
# vs cfsec
[cfsec][cfsec] uses static analysis of your CloudFormation templates to spot potential security issues.
Trivy uses cfsec internally to scan both JSON and YAML configuration files, but Trivy doesn't support some features provided by cfsec.
This section describes the differences between Trivy and cfsec.
| Feature | Trivy | cfsec |
|-----------------------|--------------------------------------------------------|------------------------------|
| Built-in Policies | :material-check: | :material-check: |
| Custom Policies | :material-check: | :material-close: |
| Policy Metadata[^1] | :material-check: | :material-check: |
| Show Successes | :material-check: | :material-check: |
| Disable Policies | :material-check: | :material-check: |
| Show Issue Lines | :material-check: | :material-check: |
| View Statistics | :material-close: | :material-check: |
| Filtering by Severity | :material-check: | :material-close: |
| Supported Formats | Dockerfile, JSON, YAML, Terraform, CloudFormation etc. | CloudFormation JSON and YAML |
[^1]: To enrich the results such as ID, Title, Description, Severity, etc.
cfsec is designed for CloudFormation.
People who use only want to scan their CloudFormation templates should use cfsec.
People who want to scan a wide range of configuration files should use Trivy.
[cfsec]: https://github.com/aquasecurity/cfsec

View File

@@ -0,0 +1,43 @@
# vs Conftest
[Conftest][conftest] is a really nice tool to help you write tests against structured configuration data.
Misconfiguration detection in Trivy is heavily inspired by Conftest and provides similar features Conftest has.
This section describes the differences between Trivy and Conftest.
| Feature | Trivy | Conftest |
| --------------------------- | -------------------- | -------------------- |
| Support Rego Language | :material-check: | :material-check: |
| Built-in Policies | :material-check: | :material-close: |
| Custom Policies | :material-check: | :material-check: |
| Custom Data | :material-check: | :material-check: |
| Combine | :material-check: | :material-check: |
| Combine per Policy | :material-check: | :material-close: |
| Policy Input Selector[^1] | :material-check: | :material-close: |
| Policy Metadata[^2] | :material-check: | :material-close:[^3] |
| Filtering by Severity | :material-check: | :material-close: |
| Rule-based Exceptions | :material-check: | :material-check: |
| Namespace-based Exceptions | :material-check: | :material-close: |
| Sharing Policies | :material-close: | :material-check: |
| Show Successes | :material-check: | :material-close: |
| Flexible Exit Code | :material-check: | :material-close: |
| Rego Unit Tests | :material-close:[^4] | :material-check: |
| Go Testing | :material-check: | :material-close: |
| Verbose Trace | :material-check: | :material-check: |
| Supported Formats | 6 formats[^5] | 14 formats[^6] |
Trivy offers built-in policies and a variety of options, while Conftest only supports custom policies.
In other words, Conftest is simpler and lighter.
Conftest is a general testing tool for configuration files, and Trivy is more security-focused.
People who need an out-of-the-box misconfiguration scanner should use Trivy.
People who don't need built-in policies and write your policies should use Conftest.
[^1]: Pass only the types of configuration file as input, specified in selector
[^2]: To enrich the results such as ID, Title, Description, etc.
[^3]: Conftest supports [structured errors in rules][conftest-structured], but they are free format and not natively supported by Conftest.
[^4]: Trivy is not able to run `*_test.rego` like `conftest verify`.
[^5]: Dockerfile, HCL, HCL2, JSON, TOML, and YAML
[^6]: CUE, Dockerfile, EDN, HCL, HCL2, HOCON, Ignore files, INI, JSON, Jsonnet, TOML, VCL, XML, and YAML
[conftest-structured]: https://github.com/open-policy-agent/conftest/pull/243
[conftest]: https://github.com/open-policy-agent/conftest

View File

@@ -0,0 +1,25 @@
# vs tfsec
[tfsec][tfsec] uses static analysis of your Terraform templates to spot potential security issues.
Trivy uses tfsec internally to scan Terraform HCL files, but Trivy doesn't support some features provided by tfsec.
This section describes the differences between Trivy and tfsec.
| Feature | Trivy | tfsec |
|-----------------------|--------------------------------------------------------|----------------------|
| Built-in Policies | :material-check: | :material-check: |
| Custom Policies | Rego | Rego, JSON, and YAML |
| Policy Metadata[^1] | :material-check: | :material-check: |
| Show Successes | :material-check: | :material-check: |
| Disable Policies | :material-check: | :material-check: |
| Show Issue Lines | :material-check: | :material-check: |
| Support .tfvars | :material-close: | :material-check: |
| View Statistics | :material-close: | :material-check: |
| Filtering by Severity | :material-check: | :material-check: |
| Supported Formats | Dockerfile, JSON, YAML, Terraform, CloudFormation etc. | Terraform |
[^1]: To enrich the results such as ID, Title, Description, Severity, etc.
tfsec is designed for Terraform.
People who use only Terraform should use tfsec.
People who want to scan a wide range of configuration files should use Trivy.
[tfsec]: https://github.com/aquasecurity/tfsec

Some files were not shown because too many files have changed in this diff Show More