mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-06 04:41:18 -08:00
Compare commits
838 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
917f388852 | ||
|
|
aef02aa174 | ||
|
|
ed1fa89117 | ||
|
|
a5d4f7fbd9 | ||
|
|
ddffb1b451 | ||
|
|
bc85441f7d | ||
|
|
b259b25ce4 | ||
|
|
f8edda8479 | ||
|
|
687941390e | ||
|
|
babfb17465 | ||
|
|
517d2e0109 | ||
|
|
01123854b4 | ||
|
|
317a026616 | ||
|
|
390c256c38 | ||
|
|
63c33bfa43 | ||
|
|
de365c8e92 | ||
|
|
50db7da947 | ||
|
|
e848e6d009 | ||
|
|
df0b5e40db | ||
|
|
006b8a5c29 | ||
|
|
8d10de8b4f | ||
|
|
169c55c688 | ||
|
|
9b21831440 | ||
|
|
94db37e541 | ||
|
|
d9838053df | ||
|
|
d8a9572930 | ||
|
|
3ab3050992 | ||
|
|
75984f347b | ||
|
|
525c2530d5 | ||
|
|
5e327e41a6 | ||
|
|
469d771a59 | ||
|
|
6bc8c87bc1 | ||
|
|
6ab832d099 | ||
|
|
3a10497a6f | ||
|
|
55825d760b | ||
|
|
6bb0e4b036 | ||
|
|
44d53bed48 | ||
|
|
f396c677a2 | ||
|
|
3cd88abec5 | ||
|
|
ea91fb91b0 | ||
|
|
d0ca610a96 | ||
|
|
d0ba59a44d | ||
|
|
d7742b6c17 | ||
|
|
27027cf40d | ||
|
|
c2a7ad5c01 | ||
|
|
dfb86f41f8 | ||
|
|
946ce1672d | ||
|
|
f9c17bd2d8 | ||
|
|
cccfade374 | ||
|
|
5a65548662 | ||
|
|
fa8a8ba7dc | ||
|
|
769ed554b0 | ||
|
|
5f9a963ef6 | ||
|
|
d93a997800 | ||
|
|
f9be138aab | ||
|
|
c7f0bc92ae | ||
|
|
c2f3731873 | ||
|
|
7b4f2dc72f | ||
|
|
84677903a6 | ||
|
|
e1e02d785f | ||
|
|
80c7b91637 | ||
|
|
07c3ac4de1 | ||
|
|
9da45f7bbd | ||
|
|
6138f57bf9 | ||
|
|
2cbe8dfebd | ||
|
|
e393ce1477 | ||
|
|
ae5a2d06b4 | ||
|
|
f8dd616545 | ||
|
|
63cbbd071a | ||
|
|
6d015d32aa | ||
|
|
30c9f90bf8 | ||
|
|
783e7cfe0c | ||
|
|
45dae7c2cf | ||
|
|
469028dca5 | ||
|
|
ae9ba340af | ||
|
|
783cf6fe74 | ||
|
|
603825a4f9 | ||
|
|
a3a66df007 | ||
|
|
bb06f6f8cf | ||
|
|
6b501219de | ||
|
|
57192bd5ae | ||
|
|
9f8685c14e | ||
|
|
ed322ac666 | ||
|
|
8d4dba02c9 | ||
|
|
a6685b1bad | ||
|
|
56265a9b98 | ||
|
|
c6f68e361d | ||
|
|
6ae4b360fd | ||
|
|
6def863470 | ||
|
|
e98bde3396 | ||
|
|
736e3f11f7 | ||
|
|
5b7e0a858d | ||
|
|
7699153c66 | ||
|
|
a70fd758ec | ||
|
|
e99bf302b6 | ||
|
|
64854fc850 | ||
|
|
e77cfd6487 | ||
|
|
e778ac3e21 | ||
|
|
aedcf5b58c | ||
|
|
5b821d3b13 | ||
|
|
f0720f3ce5 | ||
|
|
581fe1ed55 | ||
|
|
7a4e0687fc | ||
|
|
422b0fc0f1 | ||
|
|
260756d5b9 | ||
|
|
9b22035967 | ||
|
|
c96090ca2c | ||
|
|
14be70aa51 | ||
|
|
71980feca1 | ||
|
|
d94df3d9be | ||
|
|
d213223044 | ||
|
|
8e0c537392 | ||
|
|
005d0243df | ||
|
|
7de7a1f8f3 | ||
|
|
f64534651a | ||
|
|
164094968f | ||
|
|
6be6f74d5c | ||
|
|
ac2fdc87ae | ||
|
|
fe2ae8edc8 | ||
|
|
0ed39fc805 | ||
|
|
7111301fa4 | ||
|
|
c36a373def | ||
|
|
e060026ec8 | ||
|
|
8d03e5af9f | ||
|
|
938c0d1866 | ||
|
|
6e8b50ede9 | ||
|
|
4a197efcb2 | ||
|
|
e2c3bc4124 | ||
|
|
57ed577459 | ||
|
|
4656850c04 | ||
|
|
c537c91d75 | ||
|
|
ee58d53fc8 | ||
|
|
776ef1a31e | ||
|
|
6ed789e88b | ||
|
|
bc27198d3e | ||
|
|
4c35084f27 | ||
|
|
394c948130 | ||
|
|
6b515bc736 | ||
|
|
25416ae6d8 | ||
|
|
85cca55930 | ||
|
|
b944ac6286 | ||
|
|
9809a07bf1 | ||
|
|
e9831cec2f | ||
|
|
04c01f6297 | ||
|
|
86e19bb677 | ||
|
|
484ddd897d | ||
|
|
9e7404e76d | ||
|
|
6ce9404c16 | ||
|
|
85c6529cb5 | ||
|
|
6c983cbf45 | ||
|
|
1ac4fd8a61 | ||
|
|
094db23a03 | ||
|
|
b6f615b535 | ||
|
|
d6d0a60d16 | ||
|
|
6f1035269d | ||
|
|
396e404eeb | ||
|
|
79e941df0d | ||
|
|
cb76acbd9f | ||
|
|
3d2fc78852 | ||
|
|
3e3c119555 | ||
|
|
685a92e09a | ||
|
|
1e0b03d47f | ||
|
|
6765c77c38 | ||
|
|
644ada1279 | ||
|
|
c9f9a9c917 | ||
|
|
bcc231d3ba | ||
|
|
7cecade3a1 | ||
|
|
a9ddb39d5f | ||
|
|
a02c06bafd | ||
|
|
e85881231f | ||
|
|
8d13f3da95 | ||
|
|
276daae672 | ||
|
|
546e7bd6b1 | ||
|
|
b69c4de757 | ||
|
|
33b8521aee | ||
|
|
c0ad4f705e | ||
|
|
a6f4ab3735 | ||
|
|
8ae754a7d2 | ||
|
|
313ade3386 | ||
|
|
b331e771aa | ||
|
|
bfe5c6f14f | ||
|
|
363a3e40ea | ||
|
|
b213956cea | ||
|
|
efbc968ca8 | ||
|
|
9a601d49ef | ||
|
|
a589353bb3 | ||
|
|
f38f8d66fb | ||
|
|
decad9b429 | ||
|
|
9c531904ad | ||
|
|
2b1de93249 | ||
|
|
5423196f4c | ||
|
|
6fb477097c | ||
|
|
df669592ed | ||
|
|
74fcd3f881 | ||
|
|
d523424fda | ||
|
|
42267f94c5 | ||
|
|
4d382a0302 | ||
|
|
1343996fec | ||
|
|
8a877c5b29 | ||
|
|
59f1a04ba5 | ||
|
|
d5a62c9a5c | ||
|
|
f1c6af3121 | ||
|
|
0977dfcde8 | ||
|
|
6b2cd7e8da | ||
|
|
96ce2db949 | ||
|
|
6c25b8326e | ||
|
|
3912768470 | ||
|
|
a17c3eec2a | ||
|
|
d8b59efea9 | ||
|
|
60a81fcb95 | ||
|
|
c73650d967 | ||
|
|
6cfdffda18 | ||
|
|
510ce1a782 | ||
|
|
92c0452b74 | ||
|
|
1eb73f3fea | ||
|
|
270dc7346f | ||
|
|
a6ff0d12bb | ||
|
|
43997f33c8 | ||
|
|
64c91249ef | ||
|
|
7baccf2088 | ||
|
|
7dd7e2ba00 | ||
|
|
67d94774ba | ||
|
|
3e6dc37728 | ||
|
|
2dc5c9152e | ||
|
|
6daf62ebeb | ||
|
|
f9ee4943b1 | ||
|
|
c3e227b625 | ||
|
|
ca390411f3 | ||
|
|
c676361681 | ||
|
|
126fe0abba | ||
|
|
f7d02538f6 | ||
|
|
f982167c0a | ||
|
|
d3a73e4db7 | ||
|
|
5d5b93ed69 | ||
|
|
36498501bf | ||
|
|
3c0e354743 | ||
|
|
f5e655e22a | ||
|
|
af5882bc3e | ||
|
|
3d2921343b | ||
|
|
df47d1be15 | ||
|
|
ef8d77351f | ||
|
|
e18f38af3c | ||
|
|
0e937b5367 | ||
|
|
911c5e971a | ||
|
|
6fd1887e64 | ||
|
|
4059e94aba | ||
|
|
24005c3ed0 | ||
|
|
84af32a7fe | ||
|
|
193680b1ed | ||
|
|
22db37e9da | ||
|
|
4ab696eaa2 | ||
|
|
b7ec642572 | ||
|
|
1e1ccbec52 | ||
|
|
4ceae2a052 | ||
|
|
4e7e842682 | ||
|
|
089d34e866 | ||
|
|
bfb0f2a193 | ||
|
|
f19243127a | ||
|
|
4c6a866cce | ||
|
|
3ecc65d626 | ||
|
|
6b95d3857f | ||
|
|
894fa25106 | ||
|
|
f6cfcaf193 | ||
|
|
94f999ec07 | ||
|
|
4b4a0c95ba | ||
|
|
6d79fcacfc | ||
|
|
7a84438925 | ||
|
|
f8951f3847 | ||
|
|
afe3292843 | ||
|
|
3d23ad846c | ||
|
|
9822b40862 | ||
|
|
898aaaa11c | ||
|
|
c8682b55e2 | ||
|
|
bb6ff8511b | ||
|
|
f776a91d18 | ||
|
|
3bed96f0cf | ||
|
|
4a7544caea | ||
|
|
267adde71b | ||
|
|
b7fc3dfc98 | ||
|
|
95285015df | ||
|
|
89893a7303 | ||
|
|
dbba0bf152 | ||
|
|
3ef450d9a4 | ||
|
|
f4ec4e7483 | ||
|
|
96a5cb106a | ||
|
|
023e09e3f3 | ||
|
|
b3759f54fa | ||
|
|
dbf4b2dec5 | ||
|
|
2ae8faa7a8 | ||
|
|
5f004f03d9 | ||
|
|
3679bc358c | ||
|
|
0911eea9c0 | ||
|
|
029dd76c30 | ||
|
|
cc5d76b4ee | ||
|
|
be3993b60a | ||
|
|
a39133a13c | ||
|
|
995024f148 | ||
|
|
3487accd99 | ||
|
|
c8e07a4bf8 | ||
|
|
4249a1cadb | ||
|
|
c9f9a346cc | ||
|
|
52934d2340 | ||
|
|
5a58e41476 | ||
|
|
329f071b30 | ||
|
|
154ccc6e35 | ||
|
|
49cfa08d25 | ||
|
|
bcc0218200 | ||
|
|
fbb83c42d9 | ||
|
|
8a4b49ca70 | ||
|
|
7ba773f2bb | ||
|
|
bd94618b34 | ||
|
|
5feabc10ee | ||
|
|
fa03e9e983 | ||
|
|
fa5dcaf8f2 | ||
|
|
6d8ae1959c | ||
|
|
d137df24f7 | ||
|
|
2c57716359 | ||
|
|
d08f3dfd6d | ||
|
|
346496f943 | ||
|
|
6601d2957a | ||
|
|
2e870836dd | ||
|
|
4066b57a84 | ||
|
|
6e2453c2d6 | ||
|
|
7c94df539c | ||
|
|
8c33bae5a8 | ||
|
|
2cdacc1517 | ||
|
|
9acb240fdc | ||
|
|
4b193b4712 | ||
|
|
1f5b26254b | ||
|
|
79d1a0163f | ||
|
|
c1b4b5be16 | ||
|
|
bbe490b162 | ||
|
|
eb0da23d53 | ||
|
|
78286aaff1 | ||
|
|
4f9e46c8d3 | ||
|
|
55f29b8fb2 | ||
|
|
b6baa65ff2 | ||
|
|
4b8e0ec2ea | ||
|
|
1a6d9cb1b0 | ||
|
|
cf78a436d2 | ||
|
|
f8c2ced302 | ||
|
|
84c199428f | ||
|
|
bdf55e16db | ||
|
|
9fd86da367 | ||
|
|
acaa8dd0be | ||
|
|
fbc9030db6 | ||
|
|
db6eb9a15b | ||
|
|
e2a31abd19 | ||
|
|
1d1f8f91c0 | ||
|
|
708a7a7175 | ||
|
|
04040b95f8 | ||
|
|
e000329ec4 | ||
|
|
142d67f296 | ||
|
|
e127334664 | ||
|
|
3870515a81 | ||
|
|
4e6389af27 | ||
|
|
5f047f97db | ||
|
|
0700586483 | ||
|
|
34de675d87 | ||
|
|
1f393c12d5 | ||
|
|
4dd5732125 | ||
|
|
1e788040c5 | ||
|
|
ca57d318da | ||
|
|
03b16ea0ba | ||
|
|
bec2e29c59 | ||
|
|
b4ddc80c99 | ||
|
|
2061873f22 | ||
|
|
254a96e1d3 | ||
|
|
110c534015 | ||
|
|
dff5dcea70 | ||
|
|
c7e8d201dc | ||
|
|
525e2685ce | ||
|
|
471e7cd5a4 | ||
|
|
9898ac9251 | ||
|
|
453a1edfd2 | ||
|
|
8cd973739a | ||
|
|
407f3b668b | ||
|
|
a0047a7983 | ||
|
|
d786655a18 | ||
|
|
a02cf65196 | ||
|
|
613e38ccf6 | ||
|
|
3b6d65beb8 | ||
|
|
22f5b938f9 | ||
|
|
67004a2b12 | ||
|
|
485637c28a | ||
|
|
6fdb554a0d | ||
|
|
d9bddb90fe | ||
|
|
528d07ef37 | ||
|
|
1cf1873f21 | ||
|
|
d77dbe8a55 | ||
|
|
065b301414 | ||
|
|
32bd1e484a | ||
|
|
0e28f7ccb6 | ||
|
|
910b8e6017 | ||
|
|
94a5a1808f | ||
|
|
72d94b21cf | ||
|
|
b4a7d6a861 | ||
|
|
0127c1d39e | ||
|
|
a92da72263 | ||
|
|
b0f3864e46 | ||
|
|
0b1d32c182 | ||
|
|
5f69847698 | ||
|
|
3637c00b51 | ||
|
|
d4e3df81e8 | ||
|
|
7e48cc1f4d | ||
|
|
8bdd3feb3f | ||
|
|
c9efa8c479 | ||
|
|
52b715421e | ||
|
|
21f7a41b27 | ||
|
|
ff2b3d176d | ||
|
|
85351adfa8 | ||
|
|
fbf50203cc | ||
|
|
9c19298f5f | ||
|
|
18fde60392 | ||
|
|
c2f38ee378 | ||
|
|
a545e3af04 | ||
|
|
c039177958 | ||
|
|
86e72c0a43 | ||
|
|
aa3d696625 | ||
|
|
177826a458 | ||
|
|
133c838902 | ||
|
|
da3d588276 | ||
|
|
31e76699da | ||
|
|
4ca35b26a7 | ||
|
|
9766c47042 | ||
|
|
db66572127 | ||
|
|
8da4548073 | ||
|
|
c3e132ade5 | ||
|
|
76e9d7eb27 | ||
|
|
2b217a3b2a | ||
|
|
902aa8ceb9 | ||
|
|
60b19e5e60 | ||
|
|
58aab67928 | ||
|
|
209b9cc25a | ||
|
|
bfb931d454 | ||
|
|
b194140c52 | ||
|
|
ae86a5b171 | ||
|
|
1a23039e31 | ||
|
|
56498ca1df | ||
|
|
02105678ed | ||
|
|
d048791355 | ||
|
|
4470a181e2 | ||
|
|
cb171ead72 | ||
|
|
36e24b1858 | ||
|
|
005fe25c75 | ||
|
|
aac7cf576e | ||
|
|
88311745ba | ||
|
|
9154b819ac | ||
|
|
fe1f9c916f | ||
|
|
9e3709fb09 | ||
|
|
f36d9b6f90 | ||
|
|
ee54733e7b | ||
|
|
7a148089ec | ||
|
|
df80fd31a0 | ||
|
|
88ebc07504 | ||
|
|
d6418cf0de | ||
|
|
12d0317a67 | ||
|
|
c3aca1524c | ||
|
|
b2b68951f2 | ||
|
|
06659f1509 | ||
|
|
e913433934 | ||
|
|
a91cc50df7 | ||
|
|
4b8bf874d8 | ||
|
|
5040caefc8 | ||
|
|
28cd5a5537 | ||
|
|
b2f554eb2a | ||
|
|
483697b416 | ||
|
|
7a44a7a344 | ||
|
|
18842fbe04 | ||
|
|
12ca3ca6da | ||
|
|
dcadfa883d | ||
|
|
728a3db6c6 | ||
|
|
4e7b5ca365 | ||
|
|
0fca2cda91 | ||
|
|
e50839bb40 | ||
|
|
f95a0f0d52 | ||
|
|
bfd6eef94c | ||
|
|
69be985153 | ||
|
|
e5bf3d1e30 | ||
|
|
2193fb3c44 | ||
|
|
4d625c21e6 | ||
|
|
bbccb5a69d | ||
|
|
a625455f1c | ||
|
|
7e69f4820e | ||
|
|
f6c986b6c0 | ||
|
|
7663c9f902 | ||
|
|
aab6f0bf20 | ||
|
|
c3279fd9b2 | ||
|
|
7443cba9b5 | ||
|
|
49301ccf6d | ||
|
|
6e222bd809 | ||
|
|
8c522a76af | ||
|
|
7fe75d50a0 | ||
|
|
0e84c4dcbf | ||
|
|
82d9d4b77f | ||
|
|
525aadf14c | ||
|
|
b72fa66c77 | ||
|
|
f2e05d55d0 | ||
|
|
1e9376bea4 | ||
|
|
0805e8667e | ||
|
|
f8eb21d63a | ||
|
|
ed00632796 | ||
|
|
1277e211ca | ||
|
|
5c663d389d | ||
|
|
411e5b8c97 | ||
|
|
327688504c | ||
|
|
b9a7fd1547 | ||
|
|
9825529600 | ||
|
|
4310d51b7e | ||
|
|
c04a638d1a | ||
|
|
ffb5c8520f | ||
|
|
533498f4f0 | ||
|
|
2768c280c9 | ||
|
|
4e8832de4f | ||
|
|
4b6109746e | ||
|
|
c6daf1a896 | ||
|
|
d2a4db8887 | ||
|
|
abf0055634 | ||
|
|
9806fa6f92 | ||
|
|
c4fdc40f82 | ||
|
|
1bb7e4894e | ||
|
|
d081855849 | ||
|
|
ab0cb4f73b | ||
|
|
49a72f216f | ||
|
|
0c8521a856 | ||
|
|
89fa4a27ab | ||
|
|
0d2edbfa36 | ||
|
|
996961a33f | ||
|
|
e9251fe0a8 | ||
|
|
965400a481 | ||
|
|
310dd3f5c0 | ||
|
|
91d4d9e385 | ||
|
|
88094b1142 | ||
|
|
c287239236 | ||
|
|
0a17306666 | ||
|
|
c506f43613 | ||
|
|
7e09a9f84a | ||
|
|
f733307991 | ||
|
|
bb5abd4cc7 | ||
|
|
18d683af15 | ||
|
|
6793d65417 | ||
|
|
776f0ec16d | ||
|
|
0523fbc6be | ||
|
|
95afbb1a11 | ||
|
|
7d550ea025 | ||
|
|
1ac6e8aef6 | ||
|
|
b640ef099c | ||
|
|
a688cdf7af | ||
|
|
0abfcf53e4 | ||
|
|
e0dfc37ef5 | ||
|
|
3f52e32786 | ||
|
|
0dbcb834ef | ||
|
|
6ad9b2558a | ||
|
|
6726d12587 | ||
|
|
41c0dbb767 | ||
|
|
0d03242cfc | ||
|
|
8a6775ad14 | ||
|
|
2674ce89ea | ||
|
|
802cc6fb26 | ||
|
|
b0de7fc645 | ||
|
|
223b1fd118 | ||
|
|
0ad38f33bc | ||
|
|
894d65898d | ||
|
|
7c72035b87 | ||
|
|
1829e36541 | ||
|
|
d974076fe1 | ||
|
|
5eb94f785b | ||
|
|
173b3eb654 | ||
|
|
c80126ab41 | ||
|
|
7e9fd6719c | ||
|
|
b76899c318 | ||
|
|
a2b995a671 | ||
|
|
12463ce1b0 | ||
|
|
9b78112814 | ||
|
|
ad721cf154 | ||
|
|
96f7cc774a | ||
|
|
843813c0f3 | ||
|
|
94460305f3 | ||
|
|
f7329d0d9f | ||
|
|
b04be6834a | ||
|
|
791cf73bcb | ||
|
|
92d1b61b5d | ||
|
|
7f5b5a6aa8 | ||
|
|
dd49885a45 | ||
|
|
eec42da179 | ||
|
|
074587e22a | ||
|
|
9a4e3b1ffa | ||
|
|
f76c806687 | ||
|
|
f21e5919a1 | ||
|
|
1dce67f41b | ||
|
|
8020b0fcfb | ||
|
|
fa57fce6c9 | ||
|
|
08e9240efd | ||
|
|
41c38375b5 | ||
|
|
34c3c46056 | ||
|
|
bb20d89469 | ||
|
|
62ccd79436 | ||
|
|
1c877da6fd | ||
|
|
ff9631b94f | ||
|
|
255bbe1477 | ||
|
|
6c11c0c5a6 | ||
|
|
1ac15af66b | ||
|
|
473fe3a487 | ||
|
|
b01a7b7207 | ||
|
|
beaf89351c | ||
|
|
57eafb5545 | ||
|
|
6434945ee2 | ||
|
|
fd1fbf9c54 | ||
|
|
1352f0e964 | ||
|
|
9a5940cede | ||
|
|
493a383497 | ||
|
|
9763688eca | ||
|
|
d4855d203c | ||
|
|
620831145c | ||
|
|
02c4a51493 | ||
|
|
fbce2901f9 | ||
|
|
ba0aeedfe8 | ||
|
|
3ec380e500 | ||
|
|
0058bafdee | ||
|
|
940367cf2c | ||
|
|
78845b4767 | ||
|
|
d55c687c2e | ||
|
|
e749817ebb | ||
|
|
8eb30c2f02 | ||
|
|
0f8ac99dfc | ||
|
|
380c05baee | ||
|
|
4ca24d9a6f | ||
|
|
e73d250a1d | ||
|
|
adc7ecc159 | ||
|
|
81e4ab54dd | ||
|
|
13823326ed | ||
|
|
c8cfd72cd5 | ||
|
|
0e8ab4f811 | ||
|
|
c0e4e47aba | ||
|
|
9bad4c6cc8 | ||
|
|
8e8274eca7 | ||
|
|
797fd0884f | ||
|
|
5d54332bb0 | ||
|
|
a922042d2a | ||
|
|
c3d5832300 | ||
|
|
959c07688e | ||
|
|
8172518a05 | ||
|
|
07a11744d5 | ||
|
|
3120d6c3e1 | ||
|
|
67b7257660 | ||
|
|
cb66108f4d | ||
|
|
ac56d1c24d | ||
|
|
867eee8499 | ||
|
|
1ab6552f73 | ||
|
|
60c5a04ad1 | ||
|
|
2bb882fdec | ||
|
|
a0f5bdc861 | ||
|
|
4a2b1c09d1 | ||
|
|
6fd4c8951f | ||
|
|
b2dd367f8e | ||
|
|
7141f20e88 | ||
|
|
f6a678c60a | ||
|
|
3cf1f4c972 | ||
|
|
271879331e | ||
|
|
493a70b45c | ||
|
|
b64a526223 | ||
|
|
1a53cbe31a | ||
|
|
34f865d6e5 | ||
|
|
30fc5b97da | ||
|
|
059deda653 | ||
|
|
c813a60b6f | ||
|
|
907e6be7fd | ||
|
|
4f9e51897e | ||
|
|
4a10108d11 | ||
|
|
3f358815c9 | ||
|
|
bac65cb793 | ||
|
|
a20d4811d2 | ||
|
|
7da3f7e57d | ||
|
|
42520f3edf | ||
|
|
b75c6c4158 | ||
|
|
da40228e28 | ||
|
|
91dc954116 | ||
|
|
e17931c273 | ||
|
|
8006d76f5d | ||
|
|
fde2487249 | ||
|
|
b62ebec01e | ||
|
|
66b9842ac9 | ||
|
|
fa1f12776b | ||
|
|
3f64bd6b32 | ||
|
|
c875ba5942 | ||
|
|
0bd417531d | ||
|
|
80595dc426 | ||
|
|
ceb4e47ef1 | ||
|
|
4025117c23 | ||
|
|
d56c477e5f | ||
|
|
717f36c819 | ||
|
|
e8d06ba336 | ||
|
|
81390970cd | ||
|
|
4c77b76406 | ||
|
|
a1e818ac5e | ||
|
|
81526ed0d9 | ||
|
|
83ff3fda25 | ||
|
|
aa4339ca41 | ||
|
|
b22aebf826 | ||
|
|
364cc862f7 | ||
|
|
05ea7f4201 | ||
|
|
8b3289c880 | ||
|
|
fc2f5ddbb2 | ||
|
|
21e1ebf92c | ||
|
|
bf63cc7f34 | ||
|
|
5d7149d6cf | ||
|
|
c63e3aa5d5 | ||
|
|
3ac504288d | ||
|
|
016f45e8d3 | ||
|
|
45ada28e38 | ||
|
|
b0937b624b | ||
|
|
bfa6e76141 | ||
|
|
f0dc9fa748 | ||
|
|
412209b0d1 | ||
|
|
3d55fc5ea6 | ||
|
|
495332ccd1 | ||
|
|
285e1f1bbf | ||
|
|
d3979a0d1f | ||
|
|
c87f30c25e | ||
|
|
d328815939 | ||
|
|
ca5843cec2 | ||
|
|
1d57f7be5c | ||
|
|
68eb4c6c8d | ||
|
|
eaf9fa5e3f | ||
|
|
60a7565870 | ||
|
|
78df35b570 | ||
|
|
162fb42d62 | ||
|
|
7d0165c767 | ||
|
|
7ef1e5f970 | ||
|
|
94f9cf49fb | ||
|
|
bed0a0ebd1 | ||
|
|
0c254184d6 | ||
|
|
306c551fdf | ||
|
|
9c6b9a69c3 | ||
|
|
2cb920d5d9 | ||
|
|
9bf16ae1ba | ||
|
|
3867fc71ee | ||
|
|
3348a0669e | ||
|
|
030687c989 | ||
|
|
a273649227 | ||
|
|
e6a79f7bc7 | ||
|
|
2c08d9d3dc | ||
|
|
673fc374ed | ||
|
|
511e061c0c | ||
|
|
55e97e97ce | ||
|
|
aac55275bb | ||
|
|
9aea551d86 | ||
|
|
72334df0c5 | ||
|
|
72e5ec702d | ||
|
|
971269bac8 | ||
|
|
98341f1e9e | ||
|
|
1e66346f29 | ||
|
|
e41cf57454 | ||
|
|
3813f90496 | ||
|
|
24c612e166 | ||
|
|
d993110d96 | ||
|
|
e4b1b64788 | ||
|
|
a1ea9aeeeb | ||
|
|
3aca6b2d6a | ||
|
|
a183360e76 | ||
|
|
7eb94404a3 | ||
|
|
985442dc1c | ||
|
|
95e89a424e | ||
|
|
728ba00be5 | ||
|
|
177a2b0ad9 | ||
|
|
f9907823b8 | ||
|
|
cf9d00dfc2 | ||
|
|
9e8f0bb4f0 | ||
|
|
83f0e2b08b | ||
|
|
b318dec1e0 | ||
|
|
3841cf6d94 | ||
|
|
cdeb41a58c | ||
|
|
4a9f3d9aa9 | ||
|
|
d5d2729237 | ||
|
|
a5ed21ec13 | ||
|
|
afcb70977c | ||
|
|
c9f8a8546e | ||
|
|
f9a8f80485 | ||
|
|
a8380ab5e5 | ||
|
|
430740f537 | ||
|
|
cef12efc04 | ||
|
|
3a38594cd1 | ||
|
|
6c02a38295 | ||
|
|
4e0c7fc226 | ||
|
|
dd938fd693 | ||
|
|
e41f180236 | ||
|
|
b7debf7f0a | ||
|
|
ce1f557cf7 | ||
|
|
9fa86c550a | ||
|
|
89f6348b9c | ||
|
|
faed25bfec | ||
|
|
856dd3a464 | ||
|
|
cb5b791d13 | ||
|
|
1211b105dc | ||
|
|
e9e2777c32 | ||
|
|
123ee18257 | ||
|
|
224069af28 | ||
|
|
5e96fa6a55 | ||
|
|
d773f56aae | ||
|
|
48a3ac53fb | ||
|
|
1d2fe13f28 | ||
|
|
c8127c458f | ||
|
|
2c3bf38c73 | ||
|
|
1778abe4e3 | ||
|
|
c0563f81bc | ||
|
|
028073bd02 | ||
|
|
8394568aa0 | ||
|
|
1b5c33658f | ||
|
|
808a6459b4 | ||
|
|
05821edb41 | ||
|
|
e55ec73aba | ||
|
|
fefe879691 | ||
|
|
bd57e64268 | ||
|
|
66aac5d640 | ||
|
|
f071cecd5c | ||
|
|
6a2ca8f74f | ||
|
|
5529c83920 | ||
|
|
022b948545 | ||
|
|
f99701585f | ||
|
|
76333a382c | ||
|
|
ed8de8b1aa | ||
|
|
e72e8693ef | ||
|
|
f06501ea2b | ||
|
|
e996e0112a | ||
|
|
f6fe06fd12 | ||
|
|
984ce9bd38 | ||
|
|
c7cf493ebd | ||
|
|
9916efbf5e | ||
|
|
0954e0f44b | ||
|
|
c7208b3efa | ||
|
|
262fee4195 | ||
|
|
9f32fd0525 | ||
|
|
8065c4bf53 | ||
|
|
64d449ee57 | ||
|
|
68cb8ceba4 | ||
|
|
ec2b20dcd8 | ||
|
|
552c4de1a0 | ||
|
|
7b3bf986e8 |
18
.github/CODEOWNERS
vendored
Normal file
18
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Global
|
||||
* @knqyf263
|
||||
|
||||
# Helm chart
|
||||
helm/trivy/ @krol3
|
||||
|
||||
# Misconfiguration scanning
|
||||
examples/misconf/ @owenrumney @liamg @knqyf263
|
||||
docs/docs/misconfiguration @owenrumney @liamg @knqyf263
|
||||
docs/docs/cloud @owenrumney @liamg @knqyf263
|
||||
pkg/fanal/analyzer/config @owenrumney @liamg @knqyf263
|
||||
pkg/fanal/handler/misconf @owenrumney @liamg @knqyf263
|
||||
pkg/cloud @owenrumney @liamg @knqyf263
|
||||
pkg/flag @owenrumney @liamg @knqyf263
|
||||
|
||||
# Kubernetes scanning
|
||||
pkg/k8s/ @josedonizetti @chen-keinan @knqyf263
|
||||
docs/docs/kubernetes/ @josedonizetti @chen-keinan @knqyf263
|
||||
33
.github/ISSUE_TEMPLATE/WRONG_DETECTION.md
vendored
Normal file
33
.github/ISSUE_TEMPLATE/WRONG_DETECTION.md
vendored
Normal 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...):
|
||||
|
||||
|
||||
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@@ -10,8 +10,8 @@
|
||||
Remove this section if you don't have related PRs.
|
||||
|
||||
## Checklist
|
||||
- [ ] I've read the [guidelines for contributing](https://github.com/aquasecurity/trivy/blob/main/CONTRIBUTING.md) to this repository.
|
||||
- [ ] I've followed the [conventions](https://github.com/aquasecurity/trivy/blob/main/CONTRIBUTING.md#title) in the PR title.
|
||||
- [ ] 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)
|
||||
|
||||
59
.github/workflows/canary.yaml
vendored
Normal file
59
.github/workflows/canary.yaml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: Canary build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
- '**.go'
|
||||
- 'Dockerfile.canary'
|
||||
- '.github/workflows/canary.yaml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-binaries:
|
||||
name: Build binaries
|
||||
uses: ./.github/workflows/reusable-release.yaml
|
||||
with:
|
||||
goreleaser_config: goreleaser-canary.yml
|
||||
goreleaser_options: '--snapshot --rm-dist --timeout 60m' # will not release
|
||||
secrets: inherit
|
||||
|
||||
upload-binaries:
|
||||
name: Upload binaries
|
||||
needs: build-binaries # run this job after 'build-binaries' job completes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Restore Trivy binaries from cache
|
||||
uses: actions/cache@v3.0.5
|
||||
with:
|
||||
path: dist/
|
||||
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
||||
|
||||
# Upload artifacts
|
||||
- name: Upload artifacts (trivy_Linux-64bit)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: trivy_Linux-64bit
|
||||
path: dist/trivy_*_Linux-64bit.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload artifacts (trivy_Linux-ARM64)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: trivy_Linux-ARM64
|
||||
path: dist/trivy_*_Linux-ARM64.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload artifacts (trivy_macOS-64bit)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: trivy_macOS-64bit
|
||||
path: dist/trivy_*_macOS-64bit.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload artifacts (trivy_macOS-ARM64)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: trivy_macOS-ARM64
|
||||
path: dist/trivy_*_macOS-ARM64.tar.gz
|
||||
if-no-files-found: error
|
||||
7
.github/workflows/mkdocs-dev.yaml
vendored
7
.github/workflows/mkdocs-dev.yaml
vendored
@@ -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@v3
|
||||
- uses: actions/setup-python@v4
|
||||
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
|
||||
|
||||
7
.github/workflows/mkdocs-latest.yaml
vendored
7
.github/workflows/mkdocs-latest.yaml
vendored
@@ -14,18 +14,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@v3
|
||||
- uses: actions/setup-python@v4
|
||||
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
|
||||
|
||||
19
.github/workflows/publish-chart.yaml
vendored
19
.github/workflows/publish-chart.yaml
vendored
@@ -9,9 +9,8 @@ on:
|
||||
paths:
|
||||
- 'helm/trivy/**'
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'helm/trivy/**'
|
||||
tags:
|
||||
- "v*"
|
||||
env:
|
||||
HELM_REP: helm-charts
|
||||
GH_OWNER: aquasecurity
|
||||
@@ -23,22 +22,22 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #v2.4.0
|
||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab #v1.1
|
||||
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab
|
||||
with:
|
||||
version: v3.5.0
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v3
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Setup Chart Linting
|
||||
id: lint
|
||||
uses: helm/chart-testing-action@6b64532d456fa490a3da177fbd181ac4c8192b58 #v2.1.0
|
||||
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a
|
||||
- name: Setup Kubernetes cluster (KIND)
|
||||
uses: helm/kind-action@94729529f85113b88f4f819c17ce61382e6d8478 #v1.2.0
|
||||
uses: helm/kind-action@d08cf6ff1575077dee99962540d77ce91c62387d
|
||||
with:
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
image: ${{ env.KIND_IMAGE }}
|
||||
@@ -50,13 +49,13 @@ jobs:
|
||||
ct lint-and-install --validate-maintainers=false --charts helm/trivy
|
||||
|
||||
publish-chart:
|
||||
if: github.event_name == 'push'
|
||||
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 #v2.4.0
|
||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install chart-releaser
|
||||
|
||||
86
.github/workflows/release.yaml
vendored
86
.github/workflows/release.yaml
vendored
@@ -3,85 +3,55 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
env:
|
||||
GO_VERSION: "1.17"
|
||||
GH_USER: "aqua-bot"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
uses: ./.github/workflows/reusable-release.yaml
|
||||
with:
|
||||
goreleaser_config: goreleaser.yml
|
||||
goreleaser_options: '--rm-dist --timeout 60m'
|
||||
secrets: inherit
|
||||
|
||||
deploy-packages:
|
||||
name: Deploy rpm/dep packages
|
||||
needs: release # run this job after 'release' job completes
|
||||
runs-on: ubuntu-18.04 # 20.04 doesn't provide createrepo for now
|
||||
env:
|
||||
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Restore Trivy binaries from cache
|
||||
uses: actions/cache@v3.0.5
|
||||
with:
|
||||
path: dist/
|
||||
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install rpm reprepro createrepo distro-info
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Show available Docker Buildx platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v2
|
||||
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
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Login to ghcr.io registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ env.GH_USER }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to ECR
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: public.ecr.aws
|
||||
username: ${{ secrets.ECR_ACCESS_KEY_ID }}
|
||||
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
|
||||
- name: Generate SBOM
|
||||
uses: CycloneDX/gh-gomod-generate-sbom@v1
|
||||
with:
|
||||
args: mod -licenses -json -output bom.json
|
||||
version: ^v1
|
||||
- name: Release
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: v0.183.0
|
||||
args: release --rm-dist
|
||||
env:
|
||||
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_REPO_TOKEN }}
|
||||
|
||||
- name: Setup git settings
|
||||
run: |
|
||||
git config --global user.email "knqyf263@gmail.com"
|
||||
git config --global user.name "Teppei Fukuda"
|
||||
|
||||
- name: Create rpm repository
|
||||
run: ci/deploy-rpm.sh
|
||||
|
||||
- name: Import GPG key
|
||||
run: echo -e "${{ secrets.GPG_KEY }}" | gpg --import
|
||||
|
||||
- name: Create deb repository
|
||||
run: ci/deploy-deb.sh
|
||||
run: ci/deploy-deb.sh
|
||||
109
.github/workflows/reusable-release.yaml
vendored
Normal file
109
.github/workflows/reusable-release.yaml
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
name: Reusable release
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
goreleaser_config:
|
||||
description: 'file path to GoReleaser config'
|
||||
required: true
|
||||
type: string
|
||||
goreleaser_options:
|
||||
description: 'GoReleaser options separated by spaces'
|
||||
default: ''
|
||||
required: false
|
||||
type: string
|
||||
|
||||
env:
|
||||
GO_VERSION: "1.18"
|
||||
GH_USER: "aqua-bot"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
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: Cosign install
|
||||
uses: sigstore/cosign-installer@09a077b27eb1310dcfb21981bee195b30ce09de0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Show available Docker Buildx platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
|
||||
- name: Login to docker.io registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to ghcr.io registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ env.GH_USER }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to ECR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: public.ecr.aws
|
||||
username: ${{ secrets.ECR_ACCESS_KEY_ID }}
|
||||
password: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate SBOM
|
||||
uses: CycloneDX/gh-gomod-generate-sbom@v1
|
||||
with:
|
||||
args: mod -licenses -json -output bom.json
|
||||
version: ^v1
|
||||
|
||||
- name: GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
version: v1.4.1
|
||||
args: release -f=${{ inputs.goreleaser_config}} ${{ inputs.goreleaser_options}}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
|
||||
|
||||
## push images to registries
|
||||
## only for canary build
|
||||
- name: Build and push
|
||||
if: ${{ inputs.goreleaser_config == 'goreleaser-canary.yml' }}
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
platforms: linux/amd64, linux/arm64
|
||||
file: ./Dockerfile.canary # path to Dockerfile
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
aquasec/trivy:canary
|
||||
ghcr.io/aquasecurity/trivy:canary
|
||||
public.ecr.aws/aquasecurity/trivy:canary
|
||||
|
||||
- name: Cache Trivy binaries
|
||||
uses: actions/cache@v3.0.5
|
||||
with:
|
||||
path: dist/
|
||||
# use 'github.sha' to create a unique cache folder for each run.
|
||||
# use 'github.workflow' to create a unique cache folder if some runs have same commit sha.
|
||||
# e.g. build and release runs
|
||||
key: ${{ runner.os }}-bins-${{github.workflow}}-${{github.sha}}
|
||||
32
.github/workflows/scan.yaml
vendored
32
.github/workflows/scan.yaml
vendored
@@ -1,25 +1,23 @@
|
||||
name: Scan
|
||||
on: [push, pull_request]
|
||||
name: Scan vulnerabilities
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Scan Go vulnerabilities
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run Trivy vulnerability scanner to scan for Critical Vulnerabilities
|
||||
uses: aquasecurity/trivy-action@master
|
||||
- name: Run Trivy vulnerability scanner and create GitHub issues
|
||||
uses: knqyf263/trivy-issue-action@v0.0.4
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
exit-code: '1'
|
||||
severity: 'CRITICAL'
|
||||
skip-dirs: integration,examples
|
||||
|
||||
- name: Run Trivy vulnerability scanner to scan for Medium and High Vulnerabilities
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
exit-code: '0'
|
||||
severity: 'HIGH,MEDIUM'
|
||||
assignee: knqyf263
|
||||
severity: CRITICAL
|
||||
skip-dirs: integration,examples
|
||||
label: kind/security
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
90
.github/workflows/semantic-pr.yaml
vendored
Normal file
90
.github/workflows/semantic-pr.yaml
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
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
|
||||
license
|
||||
|
||||
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
|
||||
|
||||
cyclonedx
|
||||
spdx
|
||||
|
||||
helm
|
||||
report
|
||||
db
|
||||
deps
|
||||
2
.github/workflows/stale-issues.yaml
vendored
2
.github/workflows/stale-issues.yaml
vendored
@@ -7,7 +7,7 @@ jobs:
|
||||
timeout-minutes: 1
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v4
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been labeled with inactivity.'
|
||||
|
||||
73
.github/workflows/test.yaml
vendored
73
.github/workflows/test.yaml
vendored
@@ -10,24 +10,39 @@ on:
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
env:
|
||||
GO_VERSION: "1.17"
|
||||
GO_VERSION: "1.18"
|
||||
TINYGO_VERSION: "0.24.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
|
||||
echo "Run 'go mod tidy' and push it"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v3.1.0
|
||||
uses: golangci/golangci-lint-action@v3.2.0
|
||||
with:
|
||||
version: v1.41
|
||||
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
|
||||
@@ -37,17 +52,39 @@ jobs:
|
||||
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
|
||||
@@ -55,46 +92,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.183.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@v3
|
||||
- uses: actions/setup-python@v4
|
||||
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"
|
||||
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -4,7 +4,7 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
trivy
|
||||
/trivy
|
||||
|
||||
## chart release
|
||||
.cr-release-packages
|
||||
@@ -16,6 +16,7 @@ trivy
|
||||
*.out
|
||||
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
# Directory Cache Files
|
||||
.DS_Store
|
||||
@@ -30,3 +31,6 @@ integration/testdata/fixtures/images
|
||||
|
||||
# goreleaser output
|
||||
dist
|
||||
|
||||
# WebAssembly
|
||||
*.wasm
|
||||
|
||||
@@ -31,7 +31,6 @@ linters:
|
||||
- ineffassign
|
||||
- typecheck
|
||||
- govet
|
||||
- errcheck
|
||||
- varcheck
|
||||
- deadcode
|
||||
- revive
|
||||
@@ -44,10 +43,12 @@ linters:
|
||||
- misspell
|
||||
|
||||
run:
|
||||
go: 1.18
|
||||
skip-files:
|
||||
- ".*._mock.go$"
|
||||
- ".*._test.go$"
|
||||
- "integration/*"
|
||||
- "examples/*"
|
||||
|
||||
issues:
|
||||
exclude-rules:
|
||||
|
||||
105
CONTRIBUTING.md
105
CONTRIBUTING.md
@@ -1,104 +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 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.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
1. Every Pull Request should have an associated bug or feature issue unless you are fixing a trivial documentation issue.
|
||||
4. Please add the associated Issue link in the PR description.
|
||||
2. Your PR is more likely to be accepted if it focuses on just one change.
|
||||
5. There's no need to add or tag reviewers.
|
||||
6. 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).
|
||||
7. Please include a comment with the results before and after your change.
|
||||
8. 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!).
|
||||
9. 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.
|
||||
|
||||
**Example `<scope>` values:**
|
||||
- alpine
|
||||
- redhat
|
||||
- ruby
|
||||
- python
|
||||
- terraform
|
||||
- report
|
||||
- etc.
|
||||
|
||||
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 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. 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.
|
||||
See [Issues](https://aquasecurity.github.io/trivy/latest/community/contribute/issue/) and [Pull Requests](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/)
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.15.0
|
||||
FROM alpine:3.16.1
|
||||
RUN apk --no-cache add ca-certificates git
|
||||
COPY trivy /usr/local/bin/trivy
|
||||
COPY contrib/*.tpl contrib/
|
||||
|
||||
10
Dockerfile.canary
Normal file
10
Dockerfile.canary
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM alpine:3.16.1
|
||||
RUN apk --no-cache add ca-certificates git
|
||||
|
||||
# binaries were created with GoReleaser
|
||||
# need to copy binaries from folder with correct architecture
|
||||
# example architecture folder: dist/trivy_canary_build_linux_arm64/trivy
|
||||
ARG TARGETARCH
|
||||
COPY "dist/trivy_canary_build_linux_${TARGETARCH}/trivy" /usr/local/bin/trivy
|
||||
COPY contrib/*.tpl contrib/
|
||||
ENTRYPOINT ["trivy"]
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.17
|
||||
FROM golang:1.18.4
|
||||
|
||||
# Install protoc (cf. http://google.github.io/proto-lens/installing-protoc.html)
|
||||
ENV PROTOC_ZIP=protoc-3.19.4-linux-x86_64.zip
|
||||
|
||||
78
Makefile
78
Makefile
@@ -1,21 +1,42 @@
|
||||
VERSION := $(shell git describe --tags)
|
||||
LDFLAGS=-ldflags "-s -w -X=main.version=$(VERSION)"
|
||||
VERSION := $(patsubst v%,%,$(shell git describe --tags --always)) #Strips the v prefix from the tag
|
||||
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/...
|
||||
wire gen ./pkg/commands/... ./pkg/rpc/...
|
||||
|
||||
.PHONY: mock
|
||||
mock: $(GOBIN)/mockery
|
||||
@@ -26,19 +47,35 @@ 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.41.1
|
||||
.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/images/*.tar.gz:
|
||||
git clone https://github.com/aquasecurity/trivy-test-images.git integration/testdata/fixtures/images
|
||||
integration/testdata/fixtures/images/*.tar.gz: $(GOBIN)/crane
|
||||
mkdir -p integration/testdata/fixtures/images/
|
||||
integration/scripts/download-images.sh
|
||||
|
||||
# Run integration tests
|
||||
.PHONY: test-integration
|
||||
test-integration: integration/testdata/fixtures/images/*.tar.gz
|
||||
go test -v -tags=integration ./integration/...
|
||||
go test -v -tags=integration ./integration/... ./pkg/fanal/test/integration/...
|
||||
|
||||
# Run WASM integration tests
|
||||
.PHONY: test-module-integration
|
||||
test-module-integration: integration/testdata/fixtures/images/*.tar.gz $(EXAMPLE_MODULES)
|
||||
go test -v -tags=module_integration ./integration/...
|
||||
|
||||
.PHONY: lint
|
||||
lint: $(GOBIN)/golangci-lint
|
||||
@@ -58,7 +95,9 @@ protoc:
|
||||
docker run --rm -it -v ${PWD}:/app -w /app trivy-protoc make _$@
|
||||
|
||||
_protoc:
|
||||
find ./rpc/ -name "*.proto" -type f -exec protoc --twirp_out=. --twirp_opt=paths=source_relative --go_out=. --go_opt=paths=source_relative {} \;
|
||||
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:
|
||||
@@ -68,15 +107,18 @@ install:
|
||||
clean:
|
||||
rm -rf integration/testdata/fixtures/images
|
||||
|
||||
$(GOBIN)/labeler:
|
||||
go install github.com/knqyf263/labeler@latest
|
||||
|
||||
# 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
|
||||
|
||||
223
README.md
223
README.md
@@ -1,14 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="docs/imgs/logo.png" width="200">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://aquasecurity.github.io/trivy/">Documentation</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Scanner for vulnerabilities in container images, file systems, and Git repositories, as well as for configuration issues
|
||||
</p>
|
||||
<div align="center">
|
||||
<img src="docs/imgs/logo.png" width="200">
|
||||
|
||||
[![GitHub Release][release-img]][release]
|
||||
[![Test][test-img]][test]
|
||||
@@ -17,183 +8,113 @@ Scanner for vulnerabilities in container images, file systems, and Git repositor
|
||||
[![GitHub All Releases][github-all-releases-img]][release]
|
||||
![Docker Pulls][docker-pulls]
|
||||
|
||||
[📖 Documentation][docs]
|
||||
</div>
|
||||
|
||||
# Abstract
|
||||
`Trivy` (`tri` pronounced like **tri**gger, `vy` pronounced like en**vy**) is a simple and comprehensive scanner for vulnerabilities in container images, file systems, and Git repositories, as well as for configuration issues.
|
||||
`Trivy` detects vulnerabilities of OS packages (Alpine, RHEL, CentOS, etc.) and language-specific packages (Bundler, Composer, npm, yarn, etc.).
|
||||
In addition, `Trivy` scans Infrastructure as Code (IaC) files such as Terraform, Dockerfile and Kubernetes, to detect potential configuration issues that expose your deployments to the risk of attack.
|
||||
`Trivy` is easy to use. Just install the binary and you're ready to scan.
|
||||
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.
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/imgs/overview.png" width="800" alt="Trivy Overview">
|
||||
</p>
|
||||
Trivy has different *scanners* that look for different security issues, and different *targets* where it can find those issues.
|
||||
|
||||
### Demo: Vulnerability Detection (Container Image)
|
||||
<p align="center">
|
||||
<img src="docs/imgs/vuln-demo.gif" width="1000" alt="Vulnerability Detection">
|
||||
</p>
|
||||
Targets:
|
||||
- Container Image
|
||||
- Filesystem
|
||||
- Git repository (remote)
|
||||
- Kubernetes cluster or resource
|
||||
|
||||
### Demo: Misconfiguration Detection (IaC Files)
|
||||
<p align="center">
|
||||
<img src="docs/imgs/misconf-demo.gif" width="1000" alt="Misconfiguration Detection">
|
||||
</p>
|
||||
Scanners:
|
||||
- OS packages and software dependencies in use (SBOM)
|
||||
- Known vulnerabilities (CVEs)
|
||||
- IaC misconfigurations
|
||||
- Sensitive information and secrets
|
||||
|
||||
# Quick Start
|
||||
## Scan Image for Vulnerabilities
|
||||
Simply specify an image name (and a tag).
|
||||
Much more scanners and targets are coming up. Missing something? Let us know!
|
||||
|
||||
```
|
||||
$ trivy image [YOUR_IMAGE_NAME]
|
||||
Read more in the [Trivy Documentation][docs]
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Get Trivy
|
||||
|
||||
Get Trivy by your favorite installation method. See [installation] section in the documentation for details. For example:
|
||||
|
||||
- `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/
|
||||
|
||||
### General usage
|
||||
|
||||
```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...
|
||||
https://user-images.githubusercontent.com/1161307/171013513-95f18734-233d-45d3-aaf5-d6aec687db0e.mov
|
||||
|
||||
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 |
|
||||
+---------+------------------+----------+-------------------+---------------+--------------------------------+
|
||||
```
|
||||
</details>
|
||||
|
||||
## Scan Filesystem for Vulnerabilities and Misconfigurations
|
||||
Simply specify a directory to scan.
|
||||
|
||||
```bash
|
||||
$ trivy fs --security-checks vuln,config [YOUR_PROJECT_DIR]
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
$ trivy fs --security-checks vuln,config myproject/
|
||||
$ trivy fs --security-checks vuln,secret,config myproject/
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```bash
|
||||
2021-07-09T12:03:27.564+0300 INFO Number of language-specific files: 1
|
||||
2021-07-09T12:03:27.564+0300 INFO Detecting pipenv vulnerabilities...
|
||||
2021-07-09T12:03:27.566+0300 INFO Detected config files: 1
|
||||
https://user-images.githubusercontent.com/1161307/171013917-b1f37810-f434-465c-b01a-22de036bd9b3.mov
|
||||
|
||||
Pipfile.lock (pipenv)
|
||||
=====================
|
||||
Total: 1 (HIGH: 1, CRITICAL: 0)
|
||||
|
||||
+----------+------------------+----------+-------------------+---------------+---------------------------------------+
|
||||
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
|
||||
+----------+------------------+----------+-------------------+---------------+---------------------------------------+
|
||||
| httplib2 | CVE-2021-21240 | HIGH | 0.12.1 | 0.19.0 | python-httplib2: Regular |
|
||||
| | | | | | expression denial of |
|
||||
| | | | | | service via malicious header |
|
||||
| | | | | | -->avd.aquasec.com/nvd/cve-2021-21240 |
|
||||
+----------+------------------+----------+-------------------+---------------+---------------------------------------+
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 23 (SUCCESSES: 22, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (HIGH: 1, CRITICAL: 0)
|
||||
|
||||
+---------------------------+------------+----------------------+----------+------------------------------------------+
|
||||
| TYPE | MISCONF ID | CHECK | SEVERITY | MESSAGE |
|
||||
+---------------------------+------------+----------------------+----------+------------------------------------------+
|
||||
| Dockerfile Security Check | DS002 | Image user is 'root' | HIGH | Last USER command in |
|
||||
| | | | | Dockerfile should not be 'root' |
|
||||
| | | | | -->avd.aquasec.com/appshield/ds002 |
|
||||
+---------------------------+------------+----------------------+----------+------------------------------------------+
|
||||
```
|
||||
</details>
|
||||
|
||||
## Scan Directory for Misconfigurations
|
||||
|
||||
Simply specify a directory containing IaC files such as Terraform and Dockerfile.
|
||||
|
||||
```
|
||||
$ trivy config [YOUR_IAC_DIR]
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
$ ls build/
|
||||
Dockerfile
|
||||
$ trivy config ./build
|
||||
```bash
|
||||
$ trivy k8s --report summary cluster
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```
|
||||
2021-07-09T10:06:29.188+0300 INFO Need to update the built-in policies
|
||||
2021-07-09T10:06:29.188+0300 INFO Downloading the built-in policies...
|
||||
2021-07-09T10:06:30.520+0300 INFO Detected config files: 1
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 23 (SUCCESSES: 22, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)
|
||||
|
||||
+---------------------------+------------+----------------------+----------+------------------------------------------+
|
||||
| TYPE | MISCONF ID | CHECK | SEVERITY | MESSAGE |
|
||||
+---------------------------+------------+----------------------+----------+------------------------------------------+
|
||||
| Dockerfile Security Check | DS002 | Image user is 'root' | HIGH | Last USER command in |
|
||||
| | | | | Dockerfile should not be 'root' |
|
||||
| | | | | -->avd.aquasec.com/appshield/ds002 |
|
||||
+---------------------------+------------+----------------------+----------+------------------------------------------+
|
||||
```
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
Note that you can also receive a detailed scan, scan only a specific namespace, resource and more.
|
||||
|
||||
# Features
|
||||
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)
|
||||
- Misconfiguration detection (IaC scanning)
|
||||
- A wide variety of built-in policies are provided **out of the box**
|
||||
- Kubernetes, Docker, Terraform, and more coming soon
|
||||
- Support custom policies
|
||||
- Simple
|
||||
- Specify only an image name, a path to config files, or an artifact name
|
||||
- Fast
|
||||
- The first scan will finish within 10 seconds (depending on your network). Consequent scans will finish in single seconds.
|
||||
- Easy installation
|
||||
- `apt-get install`, `yum install` and `brew install` are possible.
|
||||
- **No pre-requisites** such as installation of DB, libraries, etc.
|
||||
- High accuracy
|
||||
- **Especially [Alpine Linux][alpine] and RHEL/CentOS**
|
||||
- Other OSes are also high
|
||||
- DevSecOps
|
||||
- **Suitable for CI** such as GitHub Actions, Jenkins, GitLab CI, etc.
|
||||
- Support multiple targets
|
||||
- container image, local filesystem and remote git repository
|
||||
- High accuracy, especially [Alpine Linux][alpine] and RHEL/CentOS
|
||||
- Supply chain security (SBOM support)
|
||||
- Support CycloneDX
|
||||
|
||||
# Integrations
|
||||
- [GitHub Actions][action]
|
||||
- [Visual Studio Code][vscode]
|
||||
|
||||
# Documentation
|
||||
The official documentation, which provides detailed installation, configuration, and quick start guides, is available at https://aquasecurity.github.io/trivy/.
|
||||
- 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.
|
||||
|
||||
---
|
||||
|
||||
@@ -212,10 +133,14 @@ Contact us about any matter by opening a GitHub Discussion [here][discussions]
|
||||
[license]: https://github.com/aquasecurity/trivy/blob/main/LICENSE
|
||||
[license-img]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
|
||||
|
||||
[alpine]: https://ariadne.space/2021/06/08/the-vulnerability-remediation-lifecycle-of-alpine-containers/
|
||||
[action]: https://github.com/aquasecurity/trivy-action
|
||||
[vscode]: https://github.com/aquasecurity/trivy-vscode-extension
|
||||
|
||||
[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
|
||||
|
||||
@@ -15,7 +15,7 @@ function create_rpm_repo () {
|
||||
|
||||
cd trivy-repo
|
||||
|
||||
VERSIONS=(5 6 7 8)
|
||||
VERSIONS=(5 6 7 8 9)
|
||||
for version in ${VERSIONS[@]}; do
|
||||
echo "Processing RHEL/CentOS $version..."
|
||||
create_rpm_repo $version
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/trivy/pkg/commands"
|
||||
"github.com/aquasecurity/trivy/pkg/log"
|
||||
"github.com/aquasecurity/trivy/pkg/plugin"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -12,9 +16,26 @@ var (
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := commands.NewApp(version)
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
if err := run(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func run() error {
|
||||
// Trivy behaves as the specified plugin.
|
||||
if runAsPlugin := os.Getenv("TRIVY_RUN_AS_PLUGIN"); runAsPlugin != "" {
|
||||
if !plugin.IsPredefined(runAsPlugin) {
|
||||
return xerrors.Errorf("unknown plugin: %s", runAsPlugin)
|
||||
}
|
||||
if err := plugin.RunWithArgs(context.Background(), runAsPlugin, os.Args[1:]); err != nil {
|
||||
return xerrors.Errorf("plugin error: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
app := commands.NewApp(version)
|
||||
if err := app.Execute(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
186
contrib/asff.tpl
186
contrib/asff.tpl
@@ -1,66 +1,124 @@
|
||||
[
|
||||
{{- $t_first := true -}}
|
||||
{{- range . -}}
|
||||
{{- $target := .Target -}}
|
||||
{{- 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 ) 1021 -}}
|
||||
{{- $description = (substr 0 1021 $description) | printf "%v .." -}}
|
||||
{{- end}}
|
||||
{
|
||||
"SchemaVersion": "2018-10-08",
|
||||
"Id": "{{ $target }}/{{ .VulnerabilityID }}",
|
||||
"ProductArn": "arn:aws:securityhub:{{ env "AWS_REGION" }}::product/aquasecurity/aquasecurity",
|
||||
"GeneratorId": "Trivy",
|
||||
"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" }},
|
||||
"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": "{{ env "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 (sourceID "nvd")).V3Score }}",
|
||||
"NvdCvssVectorV3": "{{ (index .CVSS (sourceID "nvd")).V3Vector }}",
|
||||
"NvdCvssScoreV2": "{{ (index .CVSS (sourceID "nvd")).V2Score }}",
|
||||
"NvdCvssVectorV2": "{{ (index .CVSS (sourceID "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 }}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
"type": "issue",
|
||||
"check_name": "container_scanning",
|
||||
"categories": [ "Security" ],
|
||||
"description": {{ list .VulnerabilityID .Title | join ": " | printf "%q" }},
|
||||
"fingerprint": "{{ .VulnerabilityID | sha1sum }}",
|
||||
"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"
|
||||
@@ -28,9 +28,73 @@
|
||||
"info"
|
||||
{{- end }},
|
||||
"location": {
|
||||
"path": "{{ .PkgName }}-{{ .InstalledVersion }}",
|
||||
"path": "{{ $target }}",
|
||||
"lines": {
|
||||
"begin": 1
|
||||
"begin": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
{{- end -}}
|
||||
{{- range .Misconfigurations -}}
|
||||
{{- if $t_first -}}
|
||||
{{- $t_first = false -}}
|
||||
{{ else -}}
|
||||
,
|
||||
{{- end }}
|
||||
{
|
||||
"type": "issue",
|
||||
"check_name": "container_scanning",
|
||||
"categories": [ "Security" ],
|
||||
"description": {{ list "Misconfig" .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 -}}
|
||||
{{- range .Secrets -}}
|
||||
{{- if $t_first -}}
|
||||
{{- $t_first = false -}}
|
||||
{{ else -}}
|
||||
,
|
||||
{{- end }}
|
||||
{
|
||||
"type": "issue",
|
||||
"check_name": "container_scanning",
|
||||
"categories": [ "Security" ],
|
||||
"description": {{ list "Secret" .RuleID .Title | join " - " | printf "%q" }},
|
||||
"fingerprint": "{{ list .RuleID .Title $target | join "" | sha1sum }}",
|
||||
"content": {{ .Title | 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": {{ .StartLine }}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{{- /* Template based on https://docs.gitlab.com/ee/user/application_security/container_scanning/#reports-json-format */ -}}
|
||||
{
|
||||
"version": "2.3",
|
||||
"version": "14.0.6",
|
||||
"vulnerabilities": [
|
||||
{{- $t_first := true }}
|
||||
{{- range . }}
|
||||
{{- $target := .Target }}
|
||||
{{- $image := $target | regexFind "[^\\s]+" }}
|
||||
{{- range .Vulnerabilities -}}
|
||||
{{- if $t_first -}}
|
||||
{{- $t_first = false -}}
|
||||
@@ -31,8 +32,6 @@
|
||||
{{- else -}}
|
||||
"{{ .Severity }}"
|
||||
{{- end }},
|
||||
{{- /* TODO: Define confidence */}}
|
||||
"confidence": "Unknown",
|
||||
"solution": {{ if .FixedVersion -}}
|
||||
"Upgrade {{ .PkgName }} to {{ .FixedVersion }}"
|
||||
{{- else -}}
|
||||
@@ -51,7 +50,7 @@
|
||||
},
|
||||
{{- /* TODO: No mapping available - https://github.com/aquasecurity/trivy/issues/332 */}}
|
||||
"operating_system": "Unknown",
|
||||
"image": "{{ $target }}"
|
||||
"image": "{{ $image }}"
|
||||
},
|
||||
"identifiers": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" ?>
|
||||
<testsuites>
|
||||
<testsuites name="trivy">
|
||||
{{- range . -}}
|
||||
{{- $failures := len .Vulnerabilities }}
|
||||
<testsuite tests="{{ $failures }}" failures="{{ $failures }}" name="{{ .Target }}" errors="0" skipped="0" time="">
|
||||
@@ -28,4 +28,4 @@
|
||||
{{- end }}
|
||||
</testsuite>
|
||||
{{- end }}
|
||||
</testsuites>
|
||||
</testsuites>
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
# 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
|
||||
|
||||
### Download misconfiguration policies
|
||||
At first, you need to download misconfiguration policies for use in air-gapped environments.
|
||||
Please follow [oras installation instruction][oras].
|
||||
|
||||
Download `bundle.tar.gz`:
|
||||
|
||||
```
|
||||
$ oras pull ghcr.io/aquasecurity/appshield:latest -a
|
||||
```
|
||||
|
||||
### Transfer misconfiguration policies into the air-gapped environment
|
||||
The way of transfer depends on the environment.
|
||||
|
||||
```
|
||||
$ rsync -av -e ssh /path/to/bundle.tar.gz [user]@[host]:dst
|
||||
```
|
||||
|
||||
### Put the misconfiguration policies in Trivy's cache directory
|
||||
You have to know where to put the misconfiguration policies 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 misconfiguration policies file in the cache directory + `/policy/content`.
|
||||
|
||||
```
|
||||
$ mkdir -p /home/myuser/.cache/trivy/policy/content
|
||||
$ cd /home/myuser/.cache/trivy/policy/content
|
||||
$ mv /path/to/bundle.tar.gz .
|
||||
```
|
||||
|
||||
Then, decompress it.
|
||||
`bundle.tar.gz ` file includes two folders: `docker`, `kubernetes` and file: `.manifest`.
|
||||
|
||||
```
|
||||
$ tar xvf bundle.tar.gz
|
||||
x ./docker/
|
||||
...
|
||||
x ./kubernetes/
|
||||
...
|
||||
x ./.manifest
|
||||
$ rm bundle.tar.gz
|
||||
```
|
||||
|
||||
In an air-gapped environment it is your responsibility to update policies on a regular basis, so that the scanner can detect recently-identified misconfigurations.
|
||||
|
||||
### 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]: ../getting-started/troubleshooting.md
|
||||
[oras]: https://oras.land/cli/
|
||||
@@ -1,19 +0,0 @@
|
||||
# External References
|
||||
There are external blogs and evaluations.
|
||||
|
||||
## Blogs
|
||||
- [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]
|
||||
|
||||
[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
|
||||
@@ -1,2 +0,0 @@
|
||||
# Advanced
|
||||
This section describes advanced features, integrations, etc.
|
||||
@@ -1,59 +0,0 @@
|
||||
# Client/Server
|
||||
|
||||
Trivy has client/server mode. Trivy server has vulnerability database and Trivy client doesn't have to download vulnerability database. It is useful if you want to scan images at multiple locations and do not want to download the database at every location.
|
||||
|
||||
## Server
|
||||
At first, you need to launch Trivy server. It downloads vulnerability database automatically and continue to fetch the latest DB in the background.
|
||||
```
|
||||
$ trivy server --listen localhost:8080
|
||||
2019-12-12T15:17:06.551+0200 INFO Need to update DB
|
||||
2019-12-12T15:17:56.706+0200 INFO Reopening DB...
|
||||
2019-12-12T15:17:56.707+0200 INFO Listening localhost:8080...
|
||||
```
|
||||
|
||||
If you want to accept a connection from outside, you have to specify `0.0.0.0` or your ip address, not `localhost`.
|
||||
|
||||
```
|
||||
$ trivy server --listen 0.0.0.0:8080
|
||||
```
|
||||
|
||||
## Client
|
||||
Then, specify the remote address.
|
||||
```
|
||||
$ trivy client --remote http://localhost:8080 alpine:3.10
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```
|
||||
alpine:3.10 (alpine 3.10.2)
|
||||
===========================
|
||||
Total: 3 (UNKNOWN: 0, LOW: 1, MEDIUM: 2, HIGH: 0, CRITICAL: 0)
|
||||
|
||||
+---------+------------------+----------+-------------------+---------------+
|
||||
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION |
|
||||
+---------+------------------+----------+-------------------+---------------+
|
||||
| openssl | CVE-2019-1549 | MEDIUM | 1.1.1c-r0 | 1.1.1d-r0 |
|
||||
+ +------------------+ + + +
|
||||
| | CVE-2019-1563 | | | |
|
||||
+ +------------------+----------+ + +
|
||||
| | CVE-2019-1547 | LOW | | |
|
||||
+---------+------------------+----------+-------------------+---------------+
|
||||
```
|
||||
</details>
|
||||
|
||||
## Authentication
|
||||
|
||||
```
|
||||
$ trivy server --listen localhost:8080 --token dummy
|
||||
```
|
||||
|
||||
```
|
||||
$ trivy client --remote http://localhost:8080 --token dummy alpine:3.10
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||

|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
# CycloneDX
|
||||
Trivy generates JSON reports in the [CycloneDX][cyclonedx] format.
|
||||
Note that XML format is not supported at the moment.
|
||||
|
||||
|
||||
You can specify `cyclonedx` with the `--format` option.
|
||||
|
||||
```
|
||||
$ trivy image --format cyclonedx --output result.json alpine:3.15
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```
|
||||
$ cat result.json | jq .
|
||||
{
|
||||
"bomFormat": "CycloneDX",
|
||||
"specVersion": "1.3",
|
||||
"serialNumber": "urn:uuid:2be5773d-7cd3-4b4b-90a5-e165474ddace",
|
||||
"version": 1,
|
||||
"metadata": {
|
||||
"timestamp": "2022-02-22T15:11:40.270597Z",
|
||||
"tools": [
|
||||
{
|
||||
"vendor": "aquasecurity",
|
||||
"name": "trivy",
|
||||
"version": "dev"
|
||||
}
|
||||
],
|
||||
"component": {
|
||||
"bom-ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||
"type": "container",
|
||||
"name": "alpine:3.15",
|
||||
"version": "",
|
||||
"purl": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||
"properties": [
|
||||
{
|
||||
"name": "aquasecurity:trivy:SchemaVersion",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:ImageID",
|
||||
"value": "sha256:c059bfaa849c4d8e4aecaeb3a10c2d9b3d85f5165c66ad3a4d937758128c4d18"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:RepoDigest",
|
||||
"value": "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:DiffID",
|
||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:RepoTag",
|
||||
"value": "alpine:3.15"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"components": [
|
||||
{
|
||||
"bom-ref": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||
"type": "library",
|
||||
"name": "alpine-baselayout",
|
||||
"version": "3.2.0-r18",
|
||||
"licenses": [
|
||||
{
|
||||
"expression": "GPL-2.0-only"
|
||||
}
|
||||
],
|
||||
"purl": "pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||
"properties": [
|
||||
{
|
||||
"name": "aquasecurity:trivy:SrcName",
|
||||
"value": "alpine-baselayout"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:SrcVersion",
|
||||
"value": "3.2.0-r18"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:LayerDigest",
|
||||
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:LayerDiffID",
|
||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||
}
|
||||
]
|
||||
},
|
||||
...(snip)...
|
||||
{
|
||||
"bom-ref": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
||||
"type": "library",
|
||||
"name": "zlib",
|
||||
"version": "1.2.11-r3",
|
||||
"licenses": [
|
||||
{
|
||||
"expression": "Zlib"
|
||||
}
|
||||
],
|
||||
"purl": "pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0",
|
||||
"properties": [
|
||||
{
|
||||
"name": "aquasecurity:trivy:SrcName",
|
||||
"value": "zlib"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:SrcVersion",
|
||||
"value": "1.2.11-r3"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:LayerDigest",
|
||||
"value": "sha256:59bf1c3509f33515622619af21ed55bbe26d24913cedbca106468a5fb37a50c3"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:LayerDiffID",
|
||||
"value": "sha256:8d3ac3489996423f53d6087c81180006263b79f206d3fdec9e66f0e27ceb8759"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"bom-ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
||||
"type": "operating-system",
|
||||
"name": "alpine",
|
||||
"version": "3.15.0",
|
||||
"properties": [
|
||||
{
|
||||
"name": "aquasecurity:trivy:Type",
|
||||
"value": "alpine"
|
||||
},
|
||||
{
|
||||
"name": "aquasecurity:trivy:Class",
|
||||
"value": "os-pkgs"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"ref": "3da6a469-964d-4b4e-b67d-e94ec7c88d37",
|
||||
"dependsOn": [
|
||||
"pkg:apk/alpine/alpine-baselayout@3.2.0-r18?distro=3.15.0",
|
||||
"pkg:apk/alpine/alpine-keys@2.4-r1?distro=3.15.0",
|
||||
"pkg:apk/alpine/apk-tools@2.12.7-r3?distro=3.15.0",
|
||||
"pkg:apk/alpine/busybox@1.34.1-r3?distro=3.15.0",
|
||||
"pkg:apk/alpine/ca-certificates-bundle@20191127-r7?distro=3.15.0",
|
||||
"pkg:apk/alpine/libc-utils@0.7.2-r3?distro=3.15.0",
|
||||
"pkg:apk/alpine/libcrypto1.1@1.1.1l-r7?distro=3.15.0",
|
||||
"pkg:apk/alpine/libretls@3.3.4-r2?distro=3.15.0",
|
||||
"pkg:apk/alpine/libssl1.1@1.1.1l-r7?distro=3.15.0",
|
||||
"pkg:apk/alpine/musl@1.2.2-r7?distro=3.15.0",
|
||||
"pkg:apk/alpine/musl-utils@1.2.2-r7?distro=3.15.0",
|
||||
"pkg:apk/alpine/scanelf@1.3.3-r0?distro=3.15.0",
|
||||
"pkg:apk/alpine/ssl_client@1.34.1-r3?distro=3.15.0",
|
||||
"pkg:apk/alpine/zlib@1.2.11-r3?distro=3.15.0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ref": "pkg:oci/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300?repository_url=index.docker.io%2Flibrary%2Falpine&arch=amd64",
|
||||
"dependsOn": [
|
||||
"3da6a469-964d-4b4e-b67d-e94ec7c88d37"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
</details>
|
||||
|
||||
!!! caution
|
||||
It doesn't support vulnerabilities yet, but installed packages.
|
||||
|
||||
[cyclonedx]: https://cyclonedx.org/
|
||||
5
docs/build/Dockerfile
vendored
5
docs/build/Dockerfile
vendored
@@ -1,4 +1,4 @@
|
||||
FROM squidfunk/mkdocs-material:7.0.6
|
||||
FROM squidfunk/mkdocs-material:8.3.9
|
||||
|
||||
## 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:7.0.6
|
||||
# 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
30
docs/build/requirements.txt
vendored
Normal 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.3.9
|
||||
mkdocs-material-extensions==1.0.3
|
||||
mkdocs-minify-plugin==0.5.0
|
||||
mkdocs-redirects==1.0.4
|
||||
packaging==21.3
|
||||
Pygments==2.12.0
|
||||
pymdown-extensions==9.5
|
||||
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
21
docs/community/cks.md
Normal 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
|
||||
31
docs/community/contribute/issue.md
Normal file
31
docs/community/contribute/issue.md
Normal 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.
|
||||
|
||||
164
docs/community/contribute/pr.md
Normal file
164
docs/community/contribute/pr.md
Normal 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
|
||||
- license
|
||||
|
||||
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.
|
||||
- [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.
|
||||
@@ -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/advanced/contribd/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
|
||||
48
docs/community/references.md
Normal file
48
docs/community/references.md
Normal 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
|
||||
86
docs/docs/advanced/air-gap.md
Normal file
86
docs/docs/advanced/air-gap.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# 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
|
||||
=== "Trivy"
|
||||
|
||||
```
|
||||
TRIVY_TEMP_DIR=$(mktemp -d)
|
||||
trivy --cache-dir $TRIVY_TEMP_DIR image --download-db-only
|
||||
tar -cf ./db.tar.gz -C $TRIVY_TEMP_DIR/db metadata.json trivy.db
|
||||
rm -rf $TRIVY_TEMP_DIR
|
||||
```
|
||||
|
||||
=== "oras >= v0.13.0"
|
||||
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
|
||||
```
|
||||
|
||||
=== "oras < v0.13.0"
|
||||
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 -a ghcr.io/aquasecurity/trivy-db:2
|
||||
```
|
||||
|
||||
### 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/
|
||||
22
docs/docs/advanced/container/containerd.md
Normal file
22
docs/docs/advanced/container/containerd.md
Normal 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/
|
||||
358
docs/docs/advanced/modules.md
Normal file
358
docs/docs/advanced/modules.md
Normal 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/
|
||||
84
docs/docs/attestation/sbom.md
Normal file
84
docs/docs/attestation/sbom.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# SBOM attestation
|
||||
|
||||
[Cosign](https://github.com/sigstore/cosign) supports generating and verifying [in-toto attestations](https://github.com/in-toto/attestation). This tool enables you to sign and verify SBOM attestation.
|
||||
And, Trivy can take an SBOM attestation as input and scan for vulnerabilities
|
||||
|
||||
!!! note
|
||||
In the following examples, the `cosign` command will write an attestation to a target OCI registry, so you must have permission to write.
|
||||
If you want to avoid writing an OCI registry and only want to see an attestation, add the `--no-upload` option to the `cosign` command.
|
||||
|
||||
## Sign with a local key pair
|
||||
|
||||
Cosign can generate key pairs and use them for signing and verification. After you run the following command, you will get a public and private key pair. Read more about [how to generate key pairs](https://docs.sigstore.dev/cosign/key-generation).
|
||||
|
||||
```bash
|
||||
$ cosign generate-key-pair
|
||||
```
|
||||
|
||||
In the following example, Trivy generates an SBOM in the CycloneDX format, and then Cosign attaches an attestation of the SBOM to a container image with a local key pair.
|
||||
|
||||
```bash
|
||||
# The cyclonedx type is supported in Cosign v1.10.0 or later.
|
||||
$ trivy image --format cyclonedx -o sbom.cdx.json <IMAGE>
|
||||
$ cosign attest --key /path/to/cosign.key --type cyclonedx --predicate sbom.cdx.json <IMAGE>
|
||||
```
|
||||
|
||||
Then, you can verify attestations on the image.
|
||||
|
||||
```bash
|
||||
$ cosign verify-attestation --key /path/to/cosign.pub --type cyclonedx <IMAGE>
|
||||
```
|
||||
|
||||
You can also create attestations of other formatted SBOM.
|
||||
|
||||
```bash
|
||||
# spdx
|
||||
$ trivy image --format spdx -o sbom.spdx <IMAGE>
|
||||
$ cosign attest --key /path/to/cosign.key --type spdx --predicate sbom.spdx <IMAGE>
|
||||
|
||||
# spdx-json
|
||||
$ trivy image --format spdx-json -o sbom.spdx.json <IMAGE>
|
||||
$ cosign attest --key /path/to/cosign.key --type spdx --predicate sbom.spdx.json <IMAGE>
|
||||
```
|
||||
|
||||
## Keyless signing
|
||||
|
||||
You can use Cosign to sign without keys by authenticating with an OpenID Connect protocol supported by sigstore (Google, GitHub, or Microsoft).
|
||||
|
||||
```bash
|
||||
# The cyclonedx type is supported in Cosign v1.10.0 or later.
|
||||
$ trivy image --format cyclonedx -o sbom.cdx.json <IMAGE>
|
||||
$ COSIGN_EXPERIMENTAL=1 cosign attest --type cyclonedx --predicate sbom.cdx.json <IMAGE>
|
||||
```
|
||||
|
||||
You can verify attestations.
|
||||
```bash
|
||||
$ COSIGN_EXPERIMENTAL=1 cosign verify-attestation --type cyclonedx <IMAGE>
|
||||
```
|
||||
|
||||
## Scanning
|
||||
|
||||
Trivy can take an SBOM attestation as input and scan for vulnerabilities. Currently, Trivy supports CycloneDX-type attestation.
|
||||
|
||||
In the following example, Cosign can get an CycloneDX-type attestation and trivy scan it. You must create CycloneDX-type attestation before trying the example. To learn more about how to create an CycloneDX-Type attestation and attach it to an image, see the [Sign with a local key pair](#sign-with-a-local-key-pair) section.
|
||||
|
||||
```bash
|
||||
$ cosign verify-attestation --key /path/to/cosign.pub --type cyclonedx <IMAGE> > sbom.cdx.intoto.jsonl
|
||||
$ trivy sbom ./sbom.cdx.intoto.jsonl
|
||||
|
||||
sbom.cdx.intoto.jsonl (alpine 3.7.3)
|
||||
=========================
|
||||
Total: 2 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 2)
|
||||
|
||||
┌────────────┬────────────────┬──────────┬───────────────────┬───────────────┬──────────────────────────────────────────────────────────┐
|
||||
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
||||
├────────────┼────────────────┼──────────┼───────────────────┼───────────────┼──────────────────────────────────────────────────────────┤
|
||||
│ musl │ CVE-2019-14697 │ CRITICAL │ 1.1.18-r3 │ 1.1.18-r4 │ musl libc through 1.1.23 has an x87 floating-point stack │
|
||||
│ │ │ │ │ │ adjustment im ...... │
|
||||
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-14697 │
|
||||
├────────────┤ │ │ │ │ │
|
||||
│ musl-utils │ │ │ │ │ │
|
||||
│ │ │ │ │ │ │
|
||||
│ │ │ │ │ │ │
|
||||
└────────────┴────────────────┴──────────┴───────────────────┴───────────────┴──────────────────────────────────────────────────────────┘
|
||||
```
|
||||
190
docs/docs/attestation/vuln.md
Normal file
190
docs/docs/attestation/vuln.md
Normal file
@@ -0,0 +1,190 @@
|
||||
# Cosign Vulnerability Attestation
|
||||
|
||||
## Generate Cosign Vulnerability Scan Record
|
||||
|
||||
Trivy generates reports in the [Cosign vulnerability scan record format][vuln-attest-spec].
|
||||
|
||||
You can use the regular subcommands (like image, fs and rootfs) and specify `cosign-vuln` with the --format option.
|
||||
|
||||
```
|
||||
$ trivy image --format cosign-vuln --output vuln.json alpine:3.10
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"invocation": {
|
||||
"parameters": null,
|
||||
"uri": "",
|
||||
"event_id": "",
|
||||
"builder.id": ""
|
||||
},
|
||||
"scanner": {
|
||||
"uri": "pkg:github/aquasecurity/trivy@v0.30.1-8-gf9cb8a28",
|
||||
"version": "v0.30.1-8-gf9cb8a28",
|
||||
"db": {
|
||||
"uri": "",
|
||||
"version": ""
|
||||
},
|
||||
"result": {
|
||||
"SchemaVersion": 2,
|
||||
"ArtifactName": "alpine:3.10",
|
||||
"ArtifactType": "container_image",
|
||||
"Metadata": {
|
||||
"OS": {
|
||||
"Family": "alpine",
|
||||
"Name": "3.10.9",
|
||||
"EOSL": true
|
||||
},
|
||||
"ImageID": "sha256:e7b300aee9f9bf3433d32bc9305bfdd22183beb59d933b48d77ab56ba53a197a",
|
||||
"DiffIDs": [
|
||||
"sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635"
|
||||
],
|
||||
"RepoTags": [
|
||||
"alpine:3.10"
|
||||
],
|
||||
"RepoDigests": [
|
||||
"alpine@sha256:451eee8bedcb2f029756dc3e9d73bab0e7943c1ac55cff3a4861c52a0fdd3e98"
|
||||
],
|
||||
"ImageConfig": {
|
||||
"architecture": "amd64",
|
||||
"container": "fdb7e80e3339e8d0599282e606c907aa5881ee4c668a68136119e6dfac6ce3a4",
|
||||
"created": "2021-04-14T19:20:05.338397761Z",
|
||||
"docker_version": "19.03.12",
|
||||
"history": [
|
||||
{
|
||||
"created": "2021-04-14T19:20:04.987219124Z",
|
||||
"created_by": "/bin/sh -c #(nop) ADD file:c5377eaa926bf412dd8d4a08b0a1f2399cfd708743533b0aa03b53d14cb4bb4e in / "
|
||||
},
|
||||
{
|
||||
"created": "2021-04-14T19:20:05.338397761Z",
|
||||
"created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]",
|
||||
"empty_layer": true
|
||||
}
|
||||
],
|
||||
"os": "linux",
|
||||
"rootfs": {
|
||||
"type": "layers",
|
||||
"diff_ids": [
|
||||
"sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"Cmd": [
|
||||
"/bin/sh"
|
||||
],
|
||||
"Env": [
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
],
|
||||
"Image": "sha256:eb2080c455e94c22ae35b3aef9e078c492a00795412e026e4d6b41ef64bc7dd8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Results": [
|
||||
{
|
||||
"Target": "alpine:3.10 (alpine 3.10.9)",
|
||||
"Class": "os-pkgs",
|
||||
"Type": "alpine",
|
||||
"Vulnerabilities": [
|
||||
{
|
||||
"VulnerabilityID": "CVE-2021-36159",
|
||||
"PkgName": "apk-tools",
|
||||
"InstalledVersion": "2.10.6-r0",
|
||||
"FixedVersion": "2.10.7-r0",
|
||||
"Layer": {
|
||||
"Digest": "sha256:396c31837116ac290458afcb928f68b6cc1c7bdd6963fc72f52f365a2a89c1b5",
|
||||
"DiffID": "sha256:9fb3aa2f8b8023a4bebbf92aa567caf88e38e969ada9f0ac12643b2847391635"
|
||||
},
|
||||
"SeveritySource": "nvd",
|
||||
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2021-36159",
|
||||
"DataSource": {
|
||||
"ID": "alpine",
|
||||
"Name": "Alpine Secdb",
|
||||
"URL": "https://secdb.alpinelinux.org/"
|
||||
},
|
||||
"Description": "libfetch before 2021-07-26, as used in apk-tools, xbps, and other products, mishandles numeric strings for the FTP and HTTP protocols. The FTP passive mode implementation allows an out-of-bounds read because strtol is used to parse the relevant numbers into address bytes. It does not check if the line ends prematurely. If it does, the for-loop condition checks for the '\\0' terminator one byte too late.",
|
||||
"Severity": "CRITICAL",
|
||||
"CweIDs": [
|
||||
"CWE-125"
|
||||
],
|
||||
"CVSS": {
|
||||
"nvd": {
|
||||
"V2Vector": "AV:N/AC:L/Au:N/C:P/I:N/A:P",
|
||||
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H",
|
||||
"V2Score": 6.4,
|
||||
"V3Score": 9.1
|
||||
}
|
||||
},
|
||||
"References": [
|
||||
"https://github.com/freebsd/freebsd-src/commits/main/lib/libfetch",
|
||||
"https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10749",
|
||||
"https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc@%3Cdev.kafka.apache.org%3E",
|
||||
"https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc@%3Cusers.kafka.apache.org%3E",
|
||||
"https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7@%3Cdev.kafka.apache.org%3E",
|
||||
"https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7@%3Cusers.kafka.apache.org%3E"
|
||||
],
|
||||
"PublishedDate": "2021-08-03T14:15:00Z",
|
||||
"LastModifiedDate": "2021-10-18T12:19:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"scanStartedOn": "2022-07-24T17:14:04.864682+09:00",
|
||||
"scanFinishedOn": "2022-07-24T17:14:04.864682+09:00"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Create Cosign Vulnerability Attestation
|
||||
|
||||
[Cosign](https://github.com/sigstore/cosign) supports generating and verifying [in-toto attestations](https://github.com/in-toto/attestation). This tool enables you to sign and verify Cosign vulnerability attestation.
|
||||
|
||||
!!! note
|
||||
In the following examples, the `cosign` command will write an attestation to a target OCI registry, so you must have permission to write.
|
||||
If you want to avoid writing an OCI registry and only want to see an attestation, add the `--no-upload` option to the `cosign` command.
|
||||
|
||||
|
||||
### Sign with a local key pair
|
||||
|
||||
Cosign can generate key pairs and use them for signing and verification. After you run the following command, you will get a public and private key pair. Read more about [how to generate key pairs](https://docs.sigstore.dev/cosign/key-generation).
|
||||
|
||||
```bash
|
||||
$ cosign generate-key-pair
|
||||
```
|
||||
|
||||
In the following example, Trivy generates a cosign vulnerability scan record, and then Cosign attaches an attestation of it to a container image with a local key pair.
|
||||
|
||||
```
|
||||
$ trivy image --format cosign-vuln --output vuln.json <IMAGE>
|
||||
$ cosign attest --key /path/to/cosign.key --type vuln --predicate vuln.json <IMAGE>
|
||||
```
|
||||
|
||||
Then, you can verify attestations on the image.
|
||||
|
||||
```
|
||||
$ cosign verify-attestation --key /path/to/cosign.pub --type vuln <IMAGE>
|
||||
```
|
||||
|
||||
### Keyless signing
|
||||
|
||||
You can use Cosign to sign without keys by authenticating with an OpenID Connect protocol supported by sigstore (Google, GitHub, or Microsoft).
|
||||
|
||||
```
|
||||
$ trivy image --format cosign-vuln -o vuln.json <IMAGE>
|
||||
$ COSIGN_EXPERIMENTAL=1 cosign attest --type vuln --predicate vuln.json <IMAGE>
|
||||
```
|
||||
|
||||
You can verify attestations.
|
||||
|
||||
```
|
||||
$ COSIGN_EXPERIMENTAL=1 cosign verify-attestation --type vuln <IMAGE>
|
||||
```
|
||||
|
||||
[vuln-attest-spec]: https://github.com/sigstore/cosign/blob/95b74db89941e8ec85e768f639efd4d948db06cd/specs/COSIGN_VULN_ATTESTATION_SPEC.md
|
||||
55
docs/docs/cloud/aws/scanning.md
Normal file
55
docs/docs/cloud/aws/scanning.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Amazon Web Services
|
||||
|
||||
!!! warning "EXPERIMENTAL"
|
||||
This feature might change without preserving backwards compatibility.
|
||||
|
||||
The Trivy AWS CLI allows you to scan your AWS account for misconfigurations. You can either run the CLI locally or integrate it into your CI/CD pipeline.
|
||||
|
||||
Whilst you can already scan the infrastructure-as-code that defines your AWS resources with `trivy config`, you can now scan your live AWS account(s) directly too.
|
||||
|
||||
The included checks cover all of the aspects of the [AWS CIS 1.2](https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards-cis.html) automated benchmarks.
|
||||
|
||||
Trivy uses the same [authentication methods](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) as the AWS CLI to configure and authenticate your access to the AWS platform.
|
||||
|
||||
You will need permissions configured to read all AWS resources - we recommend using a group/role with the `ReadOnlyAccess` and `SecurityAudit` policies attached.
|
||||
|
||||
Once you've scanned your account, you can run additional commands to filter the results without having to run the entire scan again - results are cached locally per AWS account/region.
|
||||
|
||||
## CLI Commands
|
||||
|
||||
Scan a full AWS account (all supported services):
|
||||
|
||||
```shell
|
||||
trivy aws --region us-east-1
|
||||
```
|
||||
|
||||
You can allow Trivy to determine the AWS region etc. by using the standard AWS configuration files and environment variables. The `--region` flag overrides these.
|
||||
|
||||

|
||||
|
||||
The summary view is the default when scanning multiple services.
|
||||
|
||||
Scan a specific service:
|
||||
|
||||
```shell
|
||||
trivy aws --service s3
|
||||
```
|
||||
|
||||
Scan multiple services:
|
||||
|
||||
```shell
|
||||
# --service s3,ec2 works too
|
||||
trivy aws --service s3 --service ec2
|
||||
```
|
||||
|
||||
Show results for a specific AWS resource:
|
||||
|
||||
```shell
|
||||
trivy aws --service s3 --arn arn:aws:s3:::example-bucket
|
||||
```
|
||||
|
||||
All ARNs with detected issues will be displayed when showing results for their associated service.
|
||||
|
||||
## Cached Results
|
||||
|
||||
By default, Trivy will cache results for each service for 24 hours. This means you can filter and view results for a service without having to wait for the scan to run again. If you want to force the cache to be refreshed with the latest data, you can use `--update-cache`. Or if you'd like to use cached data for a different timeframe, you can specify `--max-cache-age` (e.g. `--max-cache-age 2h`.)
|
||||
94
docs/docs/index.md
Normal file
94
docs/docs/index.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# 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, pnpm, 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
|
||||
- GitHub Dependency Snapshots
|
||||
|
||||
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
|
||||
@@ -1,6 +1,6 @@
|
||||
# GitHub Actions
|
||||
|
||||
- Here is the [Trivy Github Action][action]
|
||||
- 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
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
# GitLab CI
|
||||
|
||||
If you're a GitLab Ultimate customer, GitLab 14.0 and above include out-of-the-box integration with Trivy. To enable it for your project, simply add the container scanning template to your `.gitlab-ci.yml` file. For more details, please refer to [GitLab's documentation](https://docs.gitlab.com/ee/user/application_security/container_scanning/).
|
||||
GitLab 15.0 includes [free](https://gitlab.com/groups/gitlab-org/-/epics/2233) integration with Trivy.
|
||||
|
||||
If you're using an earlier version of GitLab, you can still use the new integration by copying the [contents of the 14.0 template](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml) to your configuration.
|
||||
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.
|
||||
|
||||
@@ -23,6 +30,8 @@ trivy:
|
||||
# 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
|
||||
@@ -32,11 +41,11 @@ trivy:
|
||||
# Build image
|
||||
- docker build -t $IMAGE .
|
||||
# Build report
|
||||
- ./trivy --cache-dir .trivycache/ image --exit-code 0 --no-progress --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json $IMAGE
|
||||
- ./trivy image --exit-code 0 --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json $IMAGE
|
||||
# Print report
|
||||
- ./trivy --cache-dir .trivycache/ image --exit-code 0 --no-progress --severity HIGH $IMAGE
|
||||
- ./trivy image --exit-code 0 --severity HIGH $IMAGE
|
||||
# Fail on severe vulnerabilities
|
||||
- ./trivy --cache-dir .trivycache/ image --exit-code 1 --severity CRITICAL --no-progress $IMAGE
|
||||
- ./trivy image --exit-code 1 --severity CRITICAL $IMAGE
|
||||
cache:
|
||||
paths:
|
||||
- .trivycache/
|
||||
@@ -71,20 +80,22 @@ container_scanning:
|
||||
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 --cache-dir .trivycache/ image --download-db-only --no-progress
|
||||
- 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 --cache-dir .trivycache/ image --exit-code 0 --no-progress --format template --template "@/contrib/gitlab.tpl"
|
||||
- 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 --cache-dir .trivycache/ image --exit-code 0 --no-progress "$FULL_IMAGE_NAME"
|
||||
- time trivy image --exit-code 0 "$FULL_IMAGE_NAME"
|
||||
# Fail on critical vulnerabilities
|
||||
- time trivy --cache-dir .trivycache/ image --exit-code 1 --severity CRITICAL --no-progress "$FULL_IMAGE_NAME"
|
||||
- time trivy image --exit-code 1 --severity CRITICAL "$FULL_IMAGE_NAME"
|
||||
cache:
|
||||
paths:
|
||||
- .trivycache/
|
||||
@@ -100,7 +111,7 @@ container_scanning:
|
||||
[example]: https://gitlab.com/aquasecurity/trivy-ci-test/pipelines
|
||||
[repository]: https://github.com/aquasecurity/trivy-ci-test
|
||||
|
||||
### Gitlab CI alternative template
|
||||
### 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
|
||||
@@ -126,6 +137,8 @@ trivy:
|
||||
# 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
|
||||
@@ -134,8 +147,13 @@ trivy:
|
||||
script:
|
||||
# Build image
|
||||
- docker build -t $IMAGE .
|
||||
# Build report
|
||||
- ./trivy --cache-dir .trivycache/ image --exit-code 0 --no-progress --format template --template "@contrib/gitlab-codequality.tpl" -o gl-codeclimate.json $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/
|
||||
@@ -155,3 +173,9 @@ already have a code quality report in your pipeline, you can use
|
||||
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.
|
||||
|
||||

|
||||
233
docs/docs/kubernetes/cli/scanning.md
Normal file
233
docs/docs/kubernetes/cli/scanning.md
Normal file
@@ -0,0 +1,233 @@
|
||||
# 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
|
||||
```
|
||||
|
||||

|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Use a specific kubeconfig file:
|
||||
|
||||
```
|
||||
$ trivy k8s --kubeconfig ~/.kube/config2 -n kube-system --report=summary all
|
||||
```
|
||||
|
||||
Scan a specific resource and get all the output:
|
||||
|
||||
```
|
||||
$ trivy k8s deployment appname
|
||||
```
|
||||
|
||||
Scan all deploys, or deploys and configmaps:
|
||||
|
||||
```
|
||||
$ trivy k8s --report=summary deployment
|
||||
$ trivy k8s --report=summary deployment,configmaps
|
||||
```
|
||||
|
||||
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>
|
||||
|
||||
14
docs/docs/kubernetes/operator/index.md
Normal file
14
docs/docs/kubernetes/operator/index.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# 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.
|
||||
|
||||
|
||||
> Kubernetes-native security toolkit. ([Documentation][trivy-operator]).
|
||||
|
||||
<figure>
|
||||
<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/
|
||||
[trivy-operator]: https://aquasecurity.github.io/trivy-operator/latest
|
||||
320
docs/docs/licenses/scanning.md
Normal file
320
docs/docs/licenses/scanning.md
Normal file
@@ -0,0 +1,320 @@
|
||||
# License Scanning
|
||||
|
||||
Trivy scans any container image for license files and offers an opinionated view on the risk associated with the license.
|
||||
|
||||
License are classified using the [Google License Classification][google-license-classification] -
|
||||
|
||||
- Forbidden
|
||||
- Restricted
|
||||
- Reciprocal
|
||||
- Notice
|
||||
- Permissive
|
||||
- Unencumbered
|
||||
- Unknown
|
||||
|
||||
!!! tip
|
||||
Licenses that Trivy fails to recognize are classified as UNKNOWN.
|
||||
As those licenses may be in violation, it is recommended to check those unknown licenses as well.
|
||||
|
||||
By default, Trivy scans licenses for packages installed by `apk`, `apt-get`, `dnf`, `npm`, `pip`, `gem`, etc.
|
||||
To enable extended license scanning, you can use `--license-full`.
|
||||
In addition to package licenses, Trivy scans source code files, Markdown documents, text files and `LICENSE` documents to identify license usage within the image or filesystem.
|
||||
|
||||
!!! note
|
||||
The full license scanning is expensive. It takes a while.
|
||||
|
||||
Currently, the standard license scanning doesn't support filesystem and repository scanning.
|
||||
|
||||
| License scnanning | Image | Rootfs | Filesystem | Repository |
|
||||
|:---------------------:|:-----:|:---------:|:----------:|:----------:|
|
||||
| Standard | ✅ | ✅ | - | - |
|
||||
| Full (--license-full) | ✅ | ✅ | ✅ | ✅ |
|
||||
|
||||
|
||||
License checking classifies the identified licenses and map the classification to severity.
|
||||
|
||||
| Classification | Severity |
|
||||
|----------------|----------|
|
||||
| Forbidden | CRITICAL |
|
||||
| Restricted | HIGH |
|
||||
| Reciprocal | MEDIUM |
|
||||
| Notice | LOW |
|
||||
| Permissive | LOW |
|
||||
| Unencumbered | LOW |
|
||||
| Unknown | UNKNOWN |
|
||||
|
||||
## Quick start
|
||||
This section shows how to scan license in container image and filesystem.
|
||||
|
||||
### Standard scanning
|
||||
Specify an image name with `--security-cheks license`.
|
||||
|
||||
``` shell
|
||||
$ trivy image --security-checks license --severity UNKNOWN,HIGH,CRITICAL alpine:3.15
|
||||
2022-07-13T17:28:39.526+0300 INFO License scanning is enabled
|
||||
|
||||
OS Packages (license)
|
||||
=====================
|
||||
Total: 6 (UNKNOWN: 0, HIGH: 6, CRITICAL: 0)
|
||||
|
||||
┌───────────────────┬─────────┬────────────────┬──────────┐
|
||||
│ Package │ License │ Classification │ Severity │
|
||||
├───────────────────┼─────────┼────────────────┼──────────┤
|
||||
│ alpine-baselayout │ GPL-2.0 │ Restricted │ HIGH │
|
||||
├───────────────────┤ │ │ │
|
||||
│ apk-tools │ │ │ │
|
||||
├───────────────────┤ │ │ │
|
||||
│ busybox │ │ │ │
|
||||
├───────────────────┤ │ │ │
|
||||
│ musl-utils │ │ │ │
|
||||
├───────────────────┤ │ │ │
|
||||
│ scanelf │ │ │ │
|
||||
├───────────────────┤ │ │ │
|
||||
│ ssl_client │ │ │ │
|
||||
└───────────────────┴─────────┴────────────────┴──────────┘
|
||||
```
|
||||
|
||||
### Full scanning
|
||||
Specify `--license-full`
|
||||
|
||||
``` shell
|
||||
$ trivy image --security-checks license --severity UNKNOWN,HIGH,CRITICAL --license-full grafana/grafana
|
||||
2022-07-13T17:48:40.905+0300 INFO Full license scanning is enabled
|
||||
|
||||
OS Packages (license)
|
||||
=====================
|
||||
Total: 20 (UNKNOWN: 9, HIGH: 11, CRITICAL: 0)
|
||||
|
||||
┌───────────────────┬───────────────────┬────────────────┬──────────┐
|
||||
│ Package │ License │ Classification │ Severity │
|
||||
├───────────────────┼───────────────────┼────────────────┼──────────┤
|
||||
│ alpine-baselayout │ GPL-2.0 │ Restricted │ HIGH │
|
||||
├───────────────────┤ │ │ │
|
||||
│ apk-tools │ │ │ │
|
||||
├───────────────────┼───────────────────┤ │ │
|
||||
│ bash │ GPL-3.0 │ │ │
|
||||
├───────────────────┼───────────────────┼────────────────┼──────────┤
|
||||
│ keyutils-libs │ GPL-2.0 │ Restricted │ HIGH │
|
||||
│ ├───────────────────┼────────────────┼──────────┤
|
||||
│ │ LGPL-2.0-or-later │ Non Standard │ UNKNOWN │
|
||||
├───────────────────┼───────────────────┤ │ │
|
||||
│ libaio │ LGPL-2.1-or-later │ │ │
|
||||
├───────────────────┼───────────────────┼────────────────┼──────────┤
|
||||
│ libcom_err │ GPL-2.0 │ Restricted │ HIGH │
|
||||
│ ├───────────────────┼────────────────┼──────────┤
|
||||
│ │ LGPL-2.0-or-later │ Non Standard │ UNKNOWN │
|
||||
├───────────────────┼───────────────────┼────────────────┼──────────┤
|
||||
│ tzdata │ Public-Domain │ Non Standard │ UNKNOWN │
|
||||
└───────────────────┴───────────────────┴────────────────┴──────────┘
|
||||
|
||||
Loose File License(s) (license)
|
||||
===============================
|
||||
Total: 6 (UNKNOWN: 4, HIGH: 0, CRITICAL: 2)
|
||||
|
||||
┌────────────────┬──────────┬──────────────┬──────────────────────────────────────────────────────────────┐
|
||||
│ Classification │ Severity │ License │ File Location │
|
||||
├────────────────┼──────────┼──────────────┼──────────────────────────────────────────────────────────────┤
|
||||
│ Forbidden │ CRITICAL │ AGPL-3.0 │ /usr/share/grafana/LICENSE │
|
||||
│ │ │ │ │
|
||||
│ │ │ │ │
|
||||
├────────────────┼──────────┼──────────────┼──────────────────────────────────────────────────────────────┤
|
||||
│ Non Standard │ UNKNOWN │ BSD-0-Clause │ /usr/share/grafana/public/build/5069.d6aae9dd11d49c741a80.j- │
|
||||
│ │ │ │ s.LICENSE.txt │
|
||||
│ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||
│ │ │ │ /usr/share/grafana/public/build/6444.d6aae9dd11d49c741a80.j- │
|
||||
│ │ │ │ s.LICENSE.txt │
|
||||
│ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||
│ │ │ │ /usr/share/grafana/public/build/7889.d6aae9dd11d49c741a80.j- │
|
||||
│ │ │ │ s.LICENSE.txt │
|
||||
│ │ │ ├──────────────────────────────────────────────────────────────┤
|
||||
│ │ │ │ /usr/share/grafana/public/build/canvasPanel.d6aae9dd11d49c7- │
|
||||
│ │ │ │ 41a80.js.LICENSE.txt │
|
||||
└────────────────┴──────────┴──────────────┴──────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Trivy has number of configuration flags for use with license scanning;
|
||||
|
||||
### Ignored Licenses
|
||||
|
||||
Trivy license scanning can ignore licenses that are identified to explicitly remove them from the results using the `--ignored-licenses` flag;
|
||||
|
||||
```shell
|
||||
$ trivy image --security-checks license --ignored-licenses MPL-2.0,MIT --severity LOW grafana/grafana:latest
|
||||
2022-07-13T18:15:28.605Z INFO License scanning is enabled
|
||||
|
||||
OS Packages (license)
|
||||
=====================
|
||||
Total: 2 (HIGH: 2, CRITICAL: 0)
|
||||
|
||||
┌───────────────────┬─────────┬────────────────┬──────────┐
|
||||
│ Package │ License │ Classification │ Severity │
|
||||
├───────────────────┼─────────┼────────────────┼──────────┤
|
||||
│ alpine-baselayout │ GPL-2.0 │ Restricted │ HIGH │
|
||||
├───────────────────┤ │ │ │
|
||||
│ ssl_client │ │ │ │
|
||||
└───────────────────┴─────────┴────────────────┴──────────┘
|
||||
|
||||
```
|
||||
|
||||
### Custom Classification
|
||||
You can generate the default config by the `--generate-default-config` flag and customize the license classification.
|
||||
For example, if you want to forbid only AGPL-3.0, you can leave it under `forbidden` and move other licenses to another classification.
|
||||
|
||||
```shell
|
||||
$ trivy image --generate-default-config
|
||||
$ vim trivy.yaml
|
||||
license:
|
||||
forbidden:
|
||||
- AGPL-3.0
|
||||
|
||||
restricted:
|
||||
- AGPL-1.0
|
||||
- CC-BY-NC-1.0
|
||||
- CC-BY-NC-2.0
|
||||
- CC-BY-NC-2.5
|
||||
- CC-BY-NC-3.0
|
||||
- CC-BY-NC-4.0
|
||||
- CC-BY-NC-ND-1.0
|
||||
- CC-BY-NC-ND-2.0
|
||||
- CC-BY-NC-ND-2.5
|
||||
- CC-BY-NC-ND-3.0
|
||||
- CC-BY-NC-ND-4.0
|
||||
- CC-BY-NC-SA-1.0
|
||||
- CC-BY-NC-SA-2.0
|
||||
- CC-BY-NC-SA-2.5
|
||||
- CC-BY-NC-SA-3.0
|
||||
- CC-BY-NC-SA-4.0
|
||||
- Commons-Clause
|
||||
- Facebook-2-Clause
|
||||
- Facebook-3-Clause
|
||||
- Facebook-Examples
|
||||
- WTFPL
|
||||
- BCL
|
||||
- CC-BY-ND-1.0
|
||||
- CC-BY-ND-2.0
|
||||
- CC-BY-ND-2.5
|
||||
- CC-BY-ND-3.0
|
||||
- CC-BY-ND-4.0
|
||||
- CC-BY-SA-1.0
|
||||
- CC-BY-SA-2.0
|
||||
- CC-BY-SA-2.5
|
||||
- CC-BY-SA-3.0
|
||||
- CC-BY-SA-4.0
|
||||
- GPL-1.0
|
||||
- GPL-2.0
|
||||
- GPL-2.0-with-autoconf-exception
|
||||
- GPL-2.0-with-bison-exception
|
||||
- GPL-2.0-with-classpath-exception
|
||||
- GPL-2.0-with-font-exception
|
||||
- GPL-2.0-with-GCC-exception
|
||||
- GPL-3.0
|
||||
- GPL-3.0-with-autoconf-exception
|
||||
- GPL-3.0-with-GCC-exception
|
||||
- LGPL-2.0
|
||||
- LGPL-2.1
|
||||
- LGPL-3.0
|
||||
- NPL-1.0
|
||||
- NPL-1.1
|
||||
- OSL-1.0
|
||||
- OSL-1.1
|
||||
- OSL-2.0
|
||||
- OSL-2.1
|
||||
- OSL-3.0
|
||||
- QPL-1.0
|
||||
- Sleepycat
|
||||
|
||||
reciprocal:
|
||||
- APSL-1.0
|
||||
- APSL-1.1
|
||||
- APSL-1.2
|
||||
- APSL-2.0
|
||||
- CDDL-1.0
|
||||
- CDDL-1.1
|
||||
- CPL-1.0
|
||||
- EPL-1.0
|
||||
- EPL-2.0
|
||||
- FreeImage
|
||||
- IPL-1.0
|
||||
- MPL-1.0
|
||||
- MPL-1.1
|
||||
- MPL-2.0
|
||||
- Ruby
|
||||
|
||||
notice:
|
||||
- AFL-1.1
|
||||
- AFL-1.2
|
||||
- AFL-2.0
|
||||
- AFL-2.1
|
||||
- AFL-3.0
|
||||
- Apache-1.0
|
||||
- Apache-1.1
|
||||
- Apache-2.0
|
||||
- Artistic-1.0-cl8
|
||||
- Artistic-1.0-Perl
|
||||
- Artistic-1.0
|
||||
- Artistic-2.0
|
||||
- BSL-1.0
|
||||
- BSD-2-Clause-FreeBSD
|
||||
- BSD-2-Clause-NetBSD
|
||||
- BSD-2-Clause
|
||||
- BSD-3-Clause-Attribution
|
||||
- BSD-3-Clause-Clear
|
||||
- BSD-3-Clause-LBNL
|
||||
- BSD-3-Clause
|
||||
- BSD-4-Clause
|
||||
- BSD-4-Clause-UC
|
||||
- BSD-Protection
|
||||
- CC-BY-1.0
|
||||
- CC-BY-2.0
|
||||
- CC-BY-2.5
|
||||
- CC-BY-3.0
|
||||
- CC-BY-4.0
|
||||
- FTL
|
||||
- ISC
|
||||
- ImageMagick
|
||||
- Libpng
|
||||
- Lil-1.0
|
||||
- Linux-OpenIB
|
||||
- LPL-1.02
|
||||
- LPL-1.0
|
||||
- MS-PL
|
||||
- MIT
|
||||
- NCSA
|
||||
- OpenSSL
|
||||
- PHP-3.01
|
||||
- PHP-3.0
|
||||
- PIL
|
||||
- Python-2.0
|
||||
- Python-2.0-complete
|
||||
- PostgreSQL
|
||||
- SGI-B-1.0
|
||||
- SGI-B-1.1
|
||||
- SGI-B-2.0
|
||||
- Unicode-DFS-2015
|
||||
- Unicode-DFS-2016
|
||||
- Unicode-TOU
|
||||
- UPL-1.0
|
||||
- W3C-19980720
|
||||
- W3C-20150513
|
||||
- W3C
|
||||
- X11
|
||||
- Xnet
|
||||
- Zend-2.0
|
||||
- zlib-acknowledgement
|
||||
- Zlib
|
||||
- ZPL-1.1
|
||||
- ZPL-2.0
|
||||
- ZPL-2.1
|
||||
|
||||
unencumbered:
|
||||
- CC0-1.0
|
||||
- Unlicense
|
||||
- 0BSD
|
||||
|
||||
permissive: []
|
||||
```
|
||||
|
||||
|
||||
[google-license-classification]: https://opensource.google/documentation/reference/thirdparty/licenses
|
||||
24
docs/docs/misconfiguration/comparison/cfsec.md
Normal file
24
docs/docs/misconfiguration/comparison/cfsec.md
Normal 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
|
||||
25
docs/docs/misconfiguration/comparison/tfsec.md
Normal file
25
docs/docs/misconfiguration/comparison/tfsec.md
Normal 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
|
||||
304
docs/docs/misconfiguration/custom/debug.md
Normal file
304
docs/docs/misconfiguration/custom/debug.md
Normal file
@@ -0,0 +1,304 @@
|
||||
# Debugging policies
|
||||
When working on more complex queries (or when learning Rego), it's useful to see exactly how the policy is applied.
|
||||
For this purpose you can use the `--trace` flag.
|
||||
This will output a large trace from Open Policy Agent like the following:
|
||||
|
||||
!!! tip
|
||||
Only failed policies show traces. If you want to debug a passed policy, you need to make it fail on purpose.
|
||||
|
||||
```shell
|
||||
$ trivy conf --trace configs/
|
||||
2022-05-16T13:47:58.853+0100 INFO Detected config files: 1
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 23 (SUCCESSES: 21, FAILURES: 2, EXCEPTIONS: 0)
|
||||
Failures: 2 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 1, CRITICAL: 0)
|
||||
|
||||
MEDIUM: Specify a tag in the 'FROM' statement for image 'alpine'
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
When using a 'FROM' statement you should use a specific tag to avoid uncontrolled behavior when the image is updated.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ds001
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Dockerfile:1
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
1 [ FROM alpine:latest
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
HIGH: Last USER command in Dockerfile should not be 'root'
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ds002
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Dockerfile:3
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
3 [ USER root
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
ID: DS001
|
||||
File: Dockerfile
|
||||
Namespace: builtin.dockerfile.DS001
|
||||
Query: data.builtin.dockerfile.DS001.deny
|
||||
Message: Specify a tag in the 'FROM' statement for image 'alpine'
|
||||
TRACE Enter data.builtin.dockerfile.DS001.deny = _
|
||||
TRACE | Eval data.builtin.dockerfile.DS001.deny = _
|
||||
TRACE | Index data.builtin.dockerfile.DS001.deny (matched 1 rule)
|
||||
TRACE | Enter data.builtin.dockerfile.DS001.deny
|
||||
TRACE | | Eval output = data.builtin.dockerfile.DS001.fail_latest[_]
|
||||
TRACE | | Index data.builtin.dockerfile.DS001.fail_latest (matched 1 rule)
|
||||
TRACE | | Enter data.builtin.dockerfile.DS001.fail_latest
|
||||
TRACE | | | Eval output = data.builtin.dockerfile.DS001.image_tags[_]
|
||||
TRACE | | | Index data.builtin.dockerfile.DS001.image_tags (matched 2 rules)
|
||||
TRACE | | | Enter data.builtin.dockerfile.DS001.image_tags
|
||||
TRACE | | | | Eval from = data.lib.docker.from[_]
|
||||
TRACE | | | | Index data.lib.docker.from (matched 1 rule)
|
||||
TRACE | | | | Enter data.lib.docker.from
|
||||
TRACE | | | | | Eval instruction = input.stages[_][_]
|
||||
TRACE | | | | | Eval instruction.Cmd = "from"
|
||||
TRACE | | | | | Exit data.lib.docker.from
|
||||
TRACE | | | | Redo data.lib.docker.from
|
||||
TRACE | | | | | Redo instruction.Cmd = "from"
|
||||
TRACE | | | | | Redo instruction = input.stages[_][_]
|
||||
TRACE | | | | | Eval instruction.Cmd = "from"
|
||||
TRACE | | | | | Fail instruction.Cmd = "from"
|
||||
TRACE | | | | | Redo instruction = input.stages[_][_]
|
||||
TRACE | | | | | Eval instruction.Cmd = "from"
|
||||
TRACE | | | | | Fail instruction.Cmd = "from"
|
||||
TRACE | | | | | Redo instruction = input.stages[_][_]
|
||||
TRACE | | | | Eval name = from.Value[0]
|
||||
TRACE | | | | Eval not startswith(name, "$")
|
||||
TRACE | | | | Enter startswith(name, "$")
|
||||
TRACE | | | | | Eval startswith(name, "$")
|
||||
TRACE | | | | | Fail startswith(name, "$")
|
||||
TRACE | | | | Eval data.builtin.dockerfile.DS001.parse_tag(name, __local505__)
|
||||
TRACE | | | | Index data.builtin.dockerfile.DS001.parse_tag (matched 2 rules)
|
||||
TRACE | | | | Enter data.builtin.dockerfile.DS001.parse_tag
|
||||
TRACE | | | | | Eval split(name, ":", __local504__)
|
||||
TRACE | | | | | Eval [img, tag] = __local504__
|
||||
TRACE | | | | | Exit data.builtin.dockerfile.DS001.parse_tag
|
||||
TRACE | | | | Eval [img, tag] = __local505__
|
||||
TRACE | | | | Eval output = {"cmd": from, "img": img, "tag": tag}
|
||||
TRACE | | | | Exit data.builtin.dockerfile.DS001.image_tags
|
||||
TRACE | | | Redo data.builtin.dockerfile.DS001.image_tags
|
||||
TRACE | | | | Redo output = {"cmd": from, "img": img, "tag": tag}
|
||||
TRACE | | | | Redo [img, tag] = __local505__
|
||||
TRACE | | | | Redo data.builtin.dockerfile.DS001.parse_tag(name, __local505__)
|
||||
TRACE | | | | Redo data.builtin.dockerfile.DS001.parse_tag
|
||||
TRACE | | | | | Redo [img, tag] = __local504__
|
||||
TRACE | | | | | Redo split(name, ":", __local504__)
|
||||
TRACE | | | | Enter data.builtin.dockerfile.DS001.parse_tag
|
||||
TRACE | | | | | Eval tag = "latest"
|
||||
TRACE | | | | | Eval not contains(img, ":")
|
||||
TRACE | | | | | Enter contains(img, ":")
|
||||
TRACE | | | | | | Eval contains(img, ":")
|
||||
TRACE | | | | | | Exit contains(img, ":")
|
||||
TRACE | | | | | Redo contains(img, ":")
|
||||
TRACE | | | | | | Redo contains(img, ":")
|
||||
TRACE | | | | | Fail not contains(img, ":")
|
||||
TRACE | | | | | Redo tag = "latest"
|
||||
TRACE | | | | Redo name = from.Value[0]
|
||||
TRACE | | | | Redo from = data.lib.docker.from[_]
|
||||
TRACE | | | Enter data.builtin.dockerfile.DS001.image_tags
|
||||
TRACE | | | | Eval from = data.lib.docker.from[i]
|
||||
TRACE | | | | Index data.lib.docker.from (matched 1 rule)
|
||||
TRACE | | | | Eval name = from.Value[0]
|
||||
TRACE | | | | Eval cmd_obj = input.stages[j][k]
|
||||
TRACE | | | | Eval possibilities = {"arg", "env"}
|
||||
TRACE | | | | Eval cmd_obj.Cmd = possibilities[l]
|
||||
TRACE | | | | Fail cmd_obj.Cmd = possibilities[l]
|
||||
TRACE | | | | Redo possibilities = {"arg", "env"}
|
||||
TRACE | | | | Redo cmd_obj = input.stages[j][k]
|
||||
TRACE | | | | Eval possibilities = {"arg", "env"}
|
||||
TRACE | | | | Eval cmd_obj.Cmd = possibilities[l]
|
||||
TRACE | | | | Fail cmd_obj.Cmd = possibilities[l]
|
||||
TRACE | | | | Redo possibilities = {"arg", "env"}
|
||||
TRACE | | | | Redo cmd_obj = input.stages[j][k]
|
||||
TRACE | | | | Eval possibilities = {"arg", "env"}
|
||||
TRACE | | | | Eval cmd_obj.Cmd = possibilities[l]
|
||||
TRACE | | | | Fail cmd_obj.Cmd = possibilities[l]
|
||||
TRACE | | | | Redo possibilities = {"arg", "env"}
|
||||
TRACE | | | | Redo cmd_obj = input.stages[j][k]
|
||||
TRACE | | | | Redo name = from.Value[0]
|
||||
TRACE | | | | Redo from = data.lib.docker.from[i]
|
||||
TRACE | | | Eval __local752__ = output.img
|
||||
TRACE | | | Eval neq(__local752__, "scratch")
|
||||
TRACE | | | Eval __local753__ = output.img
|
||||
TRACE | | | Eval not data.builtin.dockerfile.DS001.is_alias(__local753__)
|
||||
TRACE | | | Enter data.builtin.dockerfile.DS001.is_alias(__local753__)
|
||||
TRACE | | | | Eval data.builtin.dockerfile.DS001.is_alias(__local753__)
|
||||
TRACE | | | | Index data.builtin.dockerfile.DS001.is_alias (matched 1 rule, early exit)
|
||||
TRACE | | | | Enter data.builtin.dockerfile.DS001.is_alias
|
||||
TRACE | | | | | Eval img = data.builtin.dockerfile.DS001.get_aliases[_]
|
||||
TRACE | | | | | Index data.builtin.dockerfile.DS001.get_aliases (matched 1 rule)
|
||||
TRACE | | | | | Enter data.builtin.dockerfile.DS001.get_aliases
|
||||
TRACE | | | | | | Eval from_cmd = data.lib.docker.from[_]
|
||||
TRACE | | | | | | Index data.lib.docker.from (matched 1 rule)
|
||||
TRACE | | | | | | Eval __local749__ = from_cmd.Value
|
||||
TRACE | | | | | | Eval data.builtin.dockerfile.DS001.get_alias(__local749__, __local503__)
|
||||
TRACE | | | | | | Index data.builtin.dockerfile.DS001.get_alias (matched 1 rule)
|
||||
TRACE | | | | | | Enter data.builtin.dockerfile.DS001.get_alias
|
||||
TRACE | | | | | | | Eval __local748__ = values[i]
|
||||
TRACE | | | | | | | Eval lower(__local748__, __local501__)
|
||||
TRACE | | | | | | | Eval "as" = __local501__
|
||||
TRACE | | | | | | | Fail "as" = __local501__
|
||||
TRACE | | | | | | | Redo lower(__local748__, __local501__)
|
||||
TRACE | | | | | | | Redo __local748__ = values[i]
|
||||
TRACE | | | | | | Fail data.builtin.dockerfile.DS001.get_alias(__local749__, __local503__)
|
||||
TRACE | | | | | | Redo __local749__ = from_cmd.Value
|
||||
TRACE | | | | | | Redo from_cmd = data.lib.docker.from[_]
|
||||
TRACE | | | | | Fail img = data.builtin.dockerfile.DS001.get_aliases[_]
|
||||
TRACE | | | | Fail data.builtin.dockerfile.DS001.is_alias(__local753__)
|
||||
TRACE | | | Eval output.tag = "latest"
|
||||
TRACE | | | Exit data.builtin.dockerfile.DS001.fail_latest
|
||||
TRACE | | Redo data.builtin.dockerfile.DS001.fail_latest
|
||||
TRACE | | | Redo output.tag = "latest"
|
||||
TRACE | | | Redo __local753__ = output.img
|
||||
TRACE | | | Redo neq(__local752__, "scratch")
|
||||
TRACE | | | Redo __local752__ = output.img
|
||||
TRACE | | | Redo output = data.builtin.dockerfile.DS001.image_tags[_]
|
||||
TRACE | | Eval __local754__ = output.img
|
||||
TRACE | | Eval sprintf("Specify a tag in the 'FROM' statement for image '%s'", [__local754__], __local509__)
|
||||
TRACE | | Eval msg = __local509__
|
||||
TRACE | | Eval __local755__ = output.cmd
|
||||
TRACE | | Eval data.lib.docker.result(msg, __local755__, __local510__)
|
||||
TRACE | | Index data.lib.docker.result (matched 1 rule)
|
||||
TRACE | | Enter data.lib.docker.result
|
||||
TRACE | | | Eval object.get(cmd, "EndLine", 0, __local470__)
|
||||
TRACE | | | Eval object.get(cmd, "Path", "", __local471__)
|
||||
TRACE | | | Eval object.get(cmd, "StartLine", 0, __local472__)
|
||||
TRACE | | | Eval result = {"endline": __local470__, "filepath": __local471__, "msg": msg, "startline": __local472__}
|
||||
TRACE | | | Exit data.lib.docker.result
|
||||
TRACE | | Eval res = __local510__
|
||||
TRACE | | Exit data.builtin.dockerfile.DS001.deny
|
||||
TRACE | Redo data.builtin.dockerfile.DS001.deny
|
||||
TRACE | | Redo res = __local510__
|
||||
TRACE | | Redo data.lib.docker.result(msg, __local755__, __local510__)
|
||||
TRACE | | Redo data.lib.docker.result
|
||||
TRACE | | | Redo result = {"endline": __local470__, "filepath": __local471__, "msg": msg, "startline": __local472__}
|
||||
TRACE | | | Redo object.get(cmd, "StartLine", 0, __local472__)
|
||||
TRACE | | | Redo object.get(cmd, "Path", "", __local471__)
|
||||
TRACE | | | Redo object.get(cmd, "EndLine", 0, __local470__)
|
||||
TRACE | | Redo __local755__ = output.cmd
|
||||
TRACE | | Redo msg = __local509__
|
||||
TRACE | | Redo sprintf("Specify a tag in the 'FROM' statement for image '%s'", [__local754__], __local509__)
|
||||
TRACE | | Redo __local754__ = output.img
|
||||
TRACE | | Redo output = data.builtin.dockerfile.DS001.fail_latest[_]
|
||||
TRACE | Exit data.builtin.dockerfile.DS001.deny = _
|
||||
TRACE Redo data.builtin.dockerfile.DS001.deny = _
|
||||
TRACE | Redo data.builtin.dockerfile.DS001.deny = _
|
||||
TRACE
|
||||
|
||||
|
||||
ID: DS002
|
||||
File: Dockerfile
|
||||
Namespace: builtin.dockerfile.DS002
|
||||
Query: data.builtin.dockerfile.DS002.deny
|
||||
Message: Last USER command in Dockerfile should not be 'root'
|
||||
TRACE Enter data.builtin.dockerfile.DS002.deny = _
|
||||
TRACE | Eval data.builtin.dockerfile.DS002.deny = _
|
||||
TRACE | Index data.builtin.dockerfile.DS002.deny (matched 2 rules)
|
||||
TRACE | Enter data.builtin.dockerfile.DS002.deny
|
||||
TRACE | | Eval data.builtin.dockerfile.DS002.fail_user_count
|
||||
TRACE | | Index data.builtin.dockerfile.DS002.fail_user_count (matched 1 rule, early exit)
|
||||
TRACE | | Enter data.builtin.dockerfile.DS002.fail_user_count
|
||||
TRACE | | | Eval __local771__ = data.builtin.dockerfile.DS002.get_user
|
||||
TRACE | | | Index data.builtin.dockerfile.DS002.get_user (matched 1 rule)
|
||||
TRACE | | | Enter data.builtin.dockerfile.DS002.get_user
|
||||
TRACE | | | | Eval user = data.lib.docker.user[_]
|
||||
TRACE | | | | Index data.lib.docker.user (matched 1 rule)
|
||||
TRACE | | | | Enter data.lib.docker.user
|
||||
TRACE | | | | | Eval instruction = input.stages[_][_]
|
||||
TRACE | | | | | Eval instruction.Cmd = "user"
|
||||
TRACE | | | | | Fail instruction.Cmd = "user"
|
||||
TRACE | | | | | Redo instruction = input.stages[_][_]
|
||||
TRACE | | | | | Eval instruction.Cmd = "user"
|
||||
TRACE | | | | | Exit data.lib.docker.user
|
||||
TRACE | | | | Redo data.lib.docker.user
|
||||
TRACE | | | | | Redo instruction.Cmd = "user"
|
||||
TRACE | | | | | Redo instruction = input.stages[_][_]
|
||||
TRACE | | | | | Eval instruction.Cmd = "user"
|
||||
TRACE | | | | | Fail instruction.Cmd = "user"
|
||||
TRACE | | | | | Redo instruction = input.stages[_][_]
|
||||
TRACE | | | | Eval username = user.Value[_]
|
||||
TRACE | | | | Exit data.builtin.dockerfile.DS002.get_user
|
||||
TRACE | | | Redo data.builtin.dockerfile.DS002.get_user
|
||||
TRACE | | | | Redo username = user.Value[_]
|
||||
TRACE | | | | Redo user = data.lib.docker.user[_]
|
||||
TRACE | | | Eval count(__local771__, __local536__)
|
||||
TRACE | | | Eval lt(__local536__, 1)
|
||||
TRACE | | | Fail lt(__local536__, 1)
|
||||
TRACE | | | Redo count(__local771__, __local536__)
|
||||
TRACE | | | Redo __local771__ = data.builtin.dockerfile.DS002.get_user
|
||||
TRACE | | Fail data.builtin.dockerfile.DS002.fail_user_count
|
||||
TRACE | Enter data.builtin.dockerfile.DS002.deny
|
||||
TRACE | | Eval cmd = data.builtin.dockerfile.DS002.fail_last_user_root[_]
|
||||
TRACE | | Index data.builtin.dockerfile.DS002.fail_last_user_root (matched 1 rule)
|
||||
TRACE | | Enter data.builtin.dockerfile.DS002.fail_last_user_root
|
||||
TRACE | | | Eval stage_users = data.lib.docker.stage_user[_]
|
||||
TRACE | | | Index data.lib.docker.stage_user (matched 1 rule)
|
||||
TRACE | | | Enter data.lib.docker.stage_user
|
||||
TRACE | | | | Eval stage = input.stages[stage_name]
|
||||
TRACE | | | | Eval users = [cmd | cmd = stage[_]; cmd.Cmd = "user"]
|
||||
TRACE | | | | Enter cmd = stage[_]; cmd.Cmd = "user"
|
||||
TRACE | | | | | Eval cmd = stage[_]
|
||||
TRACE | | | | | Eval cmd.Cmd = "user"
|
||||
TRACE | | | | | Fail cmd.Cmd = "user"
|
||||
TRACE | | | | | Redo cmd = stage[_]
|
||||
TRACE | | | | | Eval cmd.Cmd = "user"
|
||||
TRACE | | | | | Exit cmd = stage[_]; cmd.Cmd = "user"
|
||||
TRACE | | | | Redo cmd = stage[_]; cmd.Cmd = "user"
|
||||
TRACE | | | | | Redo cmd.Cmd = "user"
|
||||
TRACE | | | | | Redo cmd = stage[_]
|
||||
TRACE | | | | | Eval cmd.Cmd = "user"
|
||||
TRACE | | | | | Fail cmd.Cmd = "user"
|
||||
TRACE | | | | | Redo cmd = stage[_]
|
||||
TRACE | | | | Exit data.lib.docker.stage_user
|
||||
TRACE | | | Redo data.lib.docker.stage_user
|
||||
TRACE | | | | Redo users = [cmd | cmd = stage[_]; cmd.Cmd = "user"]
|
||||
TRACE | | | | Redo stage = input.stages[stage_name]
|
||||
TRACE | | | Eval count(stage_users, __local537__)
|
||||
TRACE | | | Eval len = __local537__
|
||||
TRACE | | | Eval minus(len, 1, __local538__)
|
||||
TRACE | | | Eval last = stage_users[__local538__]
|
||||
TRACE | | | Eval user = last.Value[0]
|
||||
TRACE | | | Eval user = "root"
|
||||
TRACE | | | Exit data.builtin.dockerfile.DS002.fail_last_user_root
|
||||
TRACE | | Redo data.builtin.dockerfile.DS002.fail_last_user_root
|
||||
TRACE | | | Redo user = "root"
|
||||
TRACE | | | Redo user = last.Value[0]
|
||||
TRACE | | | Redo last = stage_users[__local538__]
|
||||
TRACE | | | Redo minus(len, 1, __local538__)
|
||||
TRACE | | | Redo len = __local537__
|
||||
TRACE | | | Redo count(stage_users, __local537__)
|
||||
TRACE | | | Redo stage_users = data.lib.docker.stage_user[_]
|
||||
TRACE | | Eval msg = "Last USER command in Dockerfile should not be 'root'"
|
||||
TRACE | | Eval data.lib.docker.result(msg, cmd, __local540__)
|
||||
TRACE | | Index data.lib.docker.result (matched 1 rule)
|
||||
TRACE | | Enter data.lib.docker.result
|
||||
TRACE | | | Eval object.get(cmd, "EndLine", 0, __local470__)
|
||||
TRACE | | | Eval object.get(cmd, "Path", "", __local471__)
|
||||
TRACE | | | Eval object.get(cmd, "StartLine", 0, __local472__)
|
||||
TRACE | | | Eval result = {"endline": __local470__, "filepath": __local471__, "msg": msg, "startline": __local472__}
|
||||
TRACE | | | Exit data.lib.docker.result
|
||||
TRACE | | Eval res = __local540__
|
||||
TRACE | | Exit data.builtin.dockerfile.DS002.deny
|
||||
TRACE | Redo data.builtin.dockerfile.DS002.deny
|
||||
TRACE | | Redo res = __local540__
|
||||
TRACE | | Redo data.lib.docker.result(msg, cmd, __local540__)
|
||||
TRACE | | Redo data.lib.docker.result
|
||||
TRACE | | | Redo result = {"endline": __local470__, "filepath": __local471__, "msg": msg, "startline": __local472__}
|
||||
TRACE | | | Redo object.get(cmd, "StartLine", 0, __local472__)
|
||||
TRACE | | | Redo object.get(cmd, "Path", "", __local471__)
|
||||
TRACE | | | Redo object.get(cmd, "EndLine", 0, __local470__)
|
||||
TRACE | | Redo msg = "Last USER command in Dockerfile should not be 'root'"
|
||||
TRACE | | Redo cmd = data.builtin.dockerfile.DS002.fail_last_user_root[_]
|
||||
TRACE | Exit data.builtin.dockerfile.DS002.deny = _
|
||||
TRACE Redo data.builtin.dockerfile.DS002.deny = _
|
||||
TRACE | Redo data.builtin.dockerfile.DS002.deny = _
|
||||
TRACE
|
||||
```
|
||||
@@ -6,7 +6,7 @@ See [here][k8s].
|
||||
|
||||
The custom policy is defined in `user.kubernetes.ID001` package.
|
||||
You need to pass the package prefix you want to evaluate through `--namespaces` option.
|
||||
In this case, the package prefix should be `user`, `user.kuberntes`, or `user.kubernetes.ID001`.
|
||||
In this case, the package prefix should be `user`, `user.kubernetes`, or `user.kubernetes.ID001`.
|
||||
|
||||
### Dockerfile
|
||||
See [here][dockerfile].
|
||||
190
docs/docs/misconfiguration/custom/index.md
Normal file
190
docs/docs/misconfiguration/custom/index.md
Normal file
@@ -0,0 +1,190 @@
|
||||
# Custom Policies
|
||||
|
||||
## Overview
|
||||
You can write custom policies in [Rego][rego].
|
||||
Once you finish writing custom policies, you can pass the directory where those policies are stored with `--policy` option.
|
||||
|
||||
``` bash
|
||||
trivy conf --policy /path/to/custom_policies --namespaces user /path/to/config_dir
|
||||
```
|
||||
|
||||
As for `--namespaces` option, the detail is described as below.
|
||||
|
||||
### File formats
|
||||
If a file name matches the following file patterns, Trivy will parse the file and pass it as input to your Rego policy.
|
||||
|
||||
| File format | File pattern |
|
||||
|---------------|-----------------------------------------------------------|
|
||||
| JSON | `*.json` |
|
||||
| YAML | `*.yaml` and `*.yml` |
|
||||
| Dockerfile | `Dockerfile`, `Dockerfile.*`, and `*.Dockerfile` |
|
||||
| Containerfile | `Containerfile`, `Containerfile.*`, and `*.Containerfile` |
|
||||
| Terraform | `*.tf` and `*.tf.json` |
|
||||
|
||||
### Configuration languages
|
||||
In the above general file formats, Trivy automatically identifies the following types of configuration files:
|
||||
|
||||
- CloudFormation (JSON/YAML)
|
||||
- Kubernetes (JSON/YAML)
|
||||
- Helm (YAML)
|
||||
- Terraform Plan (JSON)
|
||||
|
||||
This is useful for filtering inputs, as described below.
|
||||
|
||||
## Rego format
|
||||
A single package must contain only one policy.
|
||||
|
||||
!!!example
|
||||
``` rego
|
||||
package user.kubernetes.ID001
|
||||
|
||||
import lib.result
|
||||
|
||||
__rego_metadata__ := {
|
||||
"id": "ID001",
|
||||
"title": "Deployment not allowed",
|
||||
"severity": "LOW",
|
||||
"description": "Deployments are not allowed because of some reasons.",
|
||||
}
|
||||
|
||||
__rego_input__ := {
|
||||
"selector": [
|
||||
{"type": "kubernetes"},
|
||||
],
|
||||
}
|
||||
|
||||
deny[res] {
|
||||
input.kind == "Deployment"
|
||||
msg := sprintf("Found deployment '%s' but deployments are not allowed", [input.metadata.name])
|
||||
res := result.new(msg, input)
|
||||
}
|
||||
```
|
||||
|
||||
In this example, ID001 "Deployment not allowed" is defined under `user.kubernetes.ID001`.
|
||||
If you add a new custom policy, it must be defined under a new package like `user.kubernetes.ID002`.
|
||||
|
||||
### Policy structure
|
||||
|
||||
`package` (required)
|
||||
: - MUST follow the Rego's [specification][package]
|
||||
- MUST be unique per policy
|
||||
- SHOULD include policy id for uniqueness
|
||||
- MAY include the group name such as `kubernetes` for clarity
|
||||
- Group name has no effect on policy evaluation
|
||||
|
||||
`import data.lib.result` (optional)
|
||||
: - MAY be defined if you would like to embellish your result(s) with line numbers and code highlighting
|
||||
|
||||
`__rego_metadata__` (optional)
|
||||
: - SHOULD be defined for clarity since these values will be displayed in the scan results
|
||||
|
||||
`__rego_input__` (optional)
|
||||
: - MAY be defined when you want to specify input format
|
||||
|
||||
`deny` (required)
|
||||
: - SHOULD be `deny` or start with `deny_`
|
||||
- Although `warn`, `warn_*`, `violation`, `violation_` also work for compatibility, `deny` is recommended as severity can be defined in `__rego_metadata__`.
|
||||
- SHOULD return ONE OF:
|
||||
- The result of a call to `result.new(msg, cause)`. The `msg` is a `string` describing the issue occurrence, and the `cause` is the property/object where the issue occurred. Providing this allows Trivy to ascertain line numbers and highlight code in the output.
|
||||
- A `string` denoting the detected issue
|
||||
- Although `object` with `msg` field is accepted, other fields are dropped and `string` is recommended if `result.new()` is not utilised.
|
||||
- e.g. `{"msg": "deny message", "details": "something"}`
|
||||
|
||||
|
||||
### Package
|
||||
A package name must be unique per policy.
|
||||
|
||||
!!!example
|
||||
``` rego
|
||||
package user.kubernetes.ID001
|
||||
```
|
||||
|
||||
By default, only `builtin.*` packages will be evaluated.
|
||||
If you define custom packages, you have to specify the package prefix via `--namespaces` option.
|
||||
|
||||
``` bash
|
||||
trivy conf --policy /path/to/custom_policies --namespaces user /path/to/config_dir
|
||||
```
|
||||
|
||||
In this case, `user.*` will be evaluated.
|
||||
Any package prefixes such as `main` and `user` are allowed.
|
||||
|
||||
### Metadata
|
||||
Metadata helps enrich Trivy's scan results with useful information.
|
||||
|
||||
!!!example
|
||||
``` rego
|
||||
__rego_metadata__ := {
|
||||
"id": "ID001",
|
||||
"title": "Deployment not allowed",
|
||||
"severity": "LOW",
|
||||
"description": "Deployments are not allowed because of some reasons.",
|
||||
"recommended_actions": "Remove Deployment",
|
||||
"url": "https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits",
|
||||
}
|
||||
```
|
||||
|
||||
All fields under `__rego_metadata__` are optional.
|
||||
|
||||
| Field name | Allowed values | Default value | In table | In JSON |
|
||||
|---------------------|-------------------------------------|:-------------:|:----------------:|:----------------:|
|
||||
| id | Any characters | N/A | :material-check: | :material-check: |
|
||||
| title | Any characters | N/A | :material-check: | :material-check: |
|
||||
| severity | `LOW`, `MEDIUM`, `HIGH`, `CRITICAL` | UNKNOWN | :material-check: | :material-check: |
|
||||
| description | Any characters | | :material-close: | :material-check: |
|
||||
| recommended_actions | Any characters | | :material-close: | :material-check: |
|
||||
| url | Any characters | | :material-close: | :material-check: |
|
||||
|
||||
Some fields are displayed in scan results.
|
||||
|
||||
``` bash
|
||||
k.yaml (kubernetes)
|
||||
───────────────────
|
||||
|
||||
Tests: 32 (SUCCESSES: 31, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (UNKNOWN: 0, LOW: 1, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
|
||||
|
||||
LOW: Found deployment 'my-deployment' but deployments are not allowed
|
||||
════════════════════════════════════════════════════════════════════════
|
||||
Deployments are not allowed because of some reasons.
|
||||
────────────────────────────────────────────────────────────────────────
|
||||
k.yaml:1-2
|
||||
────────────────────────────────────────────────────────────────────────
|
||||
1 ┌ apiVersion: v1
|
||||
2 └ kind: Deployment
|
||||
────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
### Input
|
||||
You can specify input format via `__rego_input__`.
|
||||
All fields under `__rego_input` are optional.
|
||||
|
||||
!!!example
|
||||
``` rego
|
||||
__rego_input__ := {
|
||||
"combine": false,
|
||||
"selector": [
|
||||
{"type": "kubernetes"},
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
`combine` (boolean)
|
||||
: The details are [here](combine.md).
|
||||
|
||||
`selector` (array)
|
||||
: This option filters the input by file format or configuration language.
|
||||
In the above example, Trivy passes only Kubernetes files to this policy.
|
||||
Even if a Dockerfile exists in the specified directory, it will not be passed to the policy as input.
|
||||
|
||||
When configuration languages such as Kubernetes are not identified, file formats such as JSON will be used as `type`.
|
||||
When a configuration language is identified, it will overwrite `type`.
|
||||
|
||||
!!! example
|
||||
`pod.yaml` including Kubernetes Pod will be handled as `kubernetes`, not `yaml`.
|
||||
`type` is overwritten by `kubernetes` from `yaml`.
|
||||
|
||||
`type` accepts `kubernetes`, `dockerfile`, `cloudformation`, `terraform`, `terraformplan`, `json`, or `yaml`.
|
||||
|
||||
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
||||
[package]: https://www.openpolicyagent.org/docs/latest/policy-language/#packages
|
||||
@@ -22,7 +22,7 @@ For more details, see [Policy Testing][opa-testing].
|
||||
}
|
||||
```
|
||||
|
||||
To write tests for custom policies, you can refer to existing tests under [AppShield][appshield].
|
||||
To write tests for custom policies, you can refer to existing tests under [defsec][defsec].
|
||||
|
||||
## Go testing
|
||||
[Fanal][fanal] which is a core library of Trivy can be imported as a Go library.
|
||||
@@ -85,6 +85,6 @@ The following example stores allowed and denied configuration files in a directo
|
||||
`Dockerfile.allowed` has one successful result in `Successes`, while `Dockerfile.denied` has one failure result in `Failures`.
|
||||
|
||||
[opa-testing]: https://www.openpolicyagent.org/docs/latest/policy-testing/
|
||||
[appshield]: https://github.com/aquasecurity/appshield
|
||||
[defsec]: https://github.com/aquasecurity/defsec
|
||||
[table]: https://github.com/golang/go/wiki/TableDrivenTests
|
||||
[fanal]: https://github.com/aquasecurity/fanal
|
||||
60
docs/docs/misconfiguration/options/filter.md
Normal file
60
docs/docs/misconfiguration/options/filter.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Filter Misconfigurations
|
||||
|
||||
## By Severity
|
||||
|
||||
Use `--severity` option.
|
||||
|
||||
```bash
|
||||
trivy conf --severity HIGH,CRITICAL examples/misconf/mixed
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```shell
|
||||
2022-05-16T13:50:42.718+0100 INFO Detected config files: 3
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 17 (SUCCESSES: 16, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (HIGH: 1, CRITICAL: 0)
|
||||
|
||||
HIGH: Last USER command in Dockerfile should not be 'root'
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ds002
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Dockerfile:3
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
3 [ USER root
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
deployment.yaml (kubernetes)
|
||||
============================
|
||||
Tests: 8 (SUCCESSES: 8, FAILURES: 0, EXCEPTIONS: 0)
|
||||
Failures: 0 (HIGH: 0, CRITICAL: 0)
|
||||
|
||||
|
||||
main.tf (terraform)
|
||||
===================
|
||||
Tests: 1 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (HIGH: 0, CRITICAL: 1)
|
||||
|
||||
CRITICAL: Classic resources should not be used.
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
AWS Classic resources run in a shared environment with infrastructure owned by other AWS customers. You should run
|
||||
resources in a VPC instead.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/avd-aws-0081
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
main.tf:2-4
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
2 ┌ resource "aws_db_security_group" "sg" {
|
||||
3 │
|
||||
4 └ }
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
</details>
|
||||
35
docs/docs/misconfiguration/options/policy.md
Normal file
35
docs/docs/misconfiguration/options/policy.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Policy
|
||||
|
||||
## Pass custom policies
|
||||
You can pass directories including your custom policies through `--policy` option.
|
||||
This can be repeated for specifying multiple directories.
|
||||
|
||||
```bash
|
||||
cd examplex/misconf/
|
||||
trivy conf --policy custom-policy/policy --policy combine/policy --namespaces user misconf/mixed
|
||||
```
|
||||
|
||||
For more details, see [Custom Policies](../custom/index.md).
|
||||
|
||||
!!! tip
|
||||
You also need to specify `--namespaces` option.
|
||||
|
||||
## Pass custom data
|
||||
You can pass directories including your custom data through `--data` option.
|
||||
This can be repeated for specifying multiple directories.
|
||||
|
||||
```bash
|
||||
cd examples/misconf/custom-data
|
||||
trivy conf --policy ./policy --data ./data --namespaces user ./configs
|
||||
```
|
||||
|
||||
For more details, see [Custom Data](../custom/data.md).
|
||||
|
||||
## Pass namespaces
|
||||
By default, Trivy evaluates policies defined in `builtin.*`.
|
||||
If you want to evaluate custom policies in other packages, you have to specify package prefixes through `--namespaces` option.
|
||||
This can be repeated for specifying multiple packages.
|
||||
|
||||
``` bash
|
||||
trivy conf --policy ./policy --namespaces main --namespaces user ./configs
|
||||
```
|
||||
48
docs/docs/misconfiguration/options/values.md
Normal file
48
docs/docs/misconfiguration/options/values.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Value Overrides
|
||||
|
||||
Value files can be passed for supported scannable config files.
|
||||
|
||||
## Terraform value overrides
|
||||
You can pass `tf-vars` files to Trivy to override default values found in the Terraform HCL code.
|
||||
|
||||
```bash
|
||||
trivy conf --tf-vars dev.terraform.tfvars ./infrastructure/tf
|
||||
```
|
||||
|
||||
## Helm value overrides
|
||||
There are a number of options for overriding values in Helm charts. When override values are passed to the Helm scanner, the values will be used during the Manifest rendering process and will become part of the scanned artifact.
|
||||
|
||||
### Setting inline value overrides
|
||||
Overrides can be set inline on the command line
|
||||
|
||||
```bash
|
||||
trivy conf --helm-set securityContext.runAsUser=0 ./charts/mySql
|
||||
```
|
||||
|
||||
### Setting value file overrides
|
||||
Overrides can be in a file that has the key=value set.
|
||||
|
||||
```yaml
|
||||
# Example override file (overrides.yaml)
|
||||
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
```
|
||||
|
||||
```bash
|
||||
trivy conf --helm-values overrides.yaml ./charts/mySql
|
||||
```
|
||||
|
||||
### Setting value as explicit string
|
||||
the `--helm-set-string` is the same as `--helm-set` but explicitly retains the value as a string
|
||||
|
||||
```bash
|
||||
trivy config --helm-set-string name=false ./infrastructure/tf
|
||||
```
|
||||
|
||||
### Setting sepecific values from files
|
||||
Specific override values can come from specific files
|
||||
|
||||
```bash
|
||||
trivy conf --helm-set-file environment=dev.values.yaml ./charts/mySql
|
||||
```
|
||||
27
docs/docs/misconfiguration/policy/builtin.md
Normal file
27
docs/docs/misconfiguration/policy/builtin.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Built-in Policies
|
||||
|
||||
## Policy Sources
|
||||
|
||||
Built-in policies are mainly written in [Rego][rego] and Go.
|
||||
Those policies are managed under [defsec repository][defsec].
|
||||
|
||||
| Config type | Source |
|
||||
|---------------------------|----------------------|
|
||||
| Kubernetes | [defsec][kubernetes] |
|
||||
| Dockerfile, Containerfile | [defsec][docker] |
|
||||
| Terraform | [defsec][defsec] |
|
||||
| CloudFormation | [defsec][defsec] |
|
||||
| Helm Chart | [defsec][kubernetes] |
|
||||
| RBAC | [defsec][rbac] |
|
||||
|
||||
For suggestions or issues regarding policy content, please open an issue under the [defsec][defsec] repository.
|
||||
|
||||
Helm Chart scanning will resolve the chart to Kubernetes manifests then run the [kubernetes][kubernetes] checks.
|
||||
|
||||
Ansible scanning is coming soon.
|
||||
|
||||
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
||||
[defsec]: https://github.com/aquasecurity/defsec
|
||||
[kubernetes]: https://github.com/aquasecurity/defsec/tree/master/internal/rules/kubernetes
|
||||
[kubernetes]: https://github.com/aquasecurity/defsec/tree/master/internal/rules/rbac
|
||||
[docker]: https://github.com/aquasecurity/defsec/tree/master/internal/rules/docker
|
||||
@@ -1,5 +1,5 @@
|
||||
# Exceptions
|
||||
Exceptions lets you to specify cases where you allow policy violations.
|
||||
Exceptions let you specify cases where you allow policy violations.
|
||||
Trivy supports two types of exceptions.
|
||||
|
||||
!!! info
|
||||
@@ -22,7 +22,7 @@ The `exception` rule must be defined under `namespace.exceptions`.
|
||||
|
||||
exception[ns] {
|
||||
ns := data.namespaces[_]
|
||||
startswith(ns, "appshield")
|
||||
startswith(ns, "builtin.kubernetes")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -79,7 +79,7 @@ If you want to apply rule-based exceptions to built-in policies, you have to def
|
||||
|
||||
!!! example
|
||||
``` rego
|
||||
package appshield.kubernetes.KSV012
|
||||
package builtin.kubernetes.KSV012
|
||||
|
||||
exception[rules] {
|
||||
input.metadata.name == "can-run-as-root"
|
||||
@@ -87,12 +87,12 @@ If you want to apply rule-based exceptions to built-in policies, you have to def
|
||||
}
|
||||
```
|
||||
|
||||
This exception is applied to [KSV012][ksv012] in AppShield.
|
||||
You can get the package names in [AppShield repository][appshield] or the JSON output from Trivy.
|
||||
This exception is applied to [KSV012][ksv012] in defsec.
|
||||
You can get the package names in the [defsec repository][defsec] or the JSON output from Trivy.
|
||||
|
||||
For more details, see [an example][rule-example].
|
||||
|
||||
[ns-example]: https://github.com/aquasecurity/trivy/tree/{{ git.commit }}/examples/misconf/namespace-exception
|
||||
[rule-example]: https://github.com/aquasecurity/trivy/tree/{{ git.commit }}/examples/misconf/rule-exception
|
||||
[ksv012]: https://github.com/aquasecurity/appshield/blob/57bccc1897b2500a731415bda3990b0d4fbc959e/kubernetes/policies/pss/restricted/3_runs_as_root.rego
|
||||
[appshield]: https://github.com/aquasecurity/appshield/
|
||||
[ksv012]: https://github.com/aquasecurity/defsec/blob/master/internal/rules/kubernetes/policies/pss/restricted/3_runs_as_root.rego
|
||||
[defsec]: https://github.com/aquasecurity/defsec/
|
||||
321
docs/docs/misconfiguration/scanning.md
Normal file
321
docs/docs/misconfiguration/scanning.md
Normal file
@@ -0,0 +1,321 @@
|
||||
# Misconfiguration Scanning
|
||||
Trivy provides built-in policies to detect configuration issues in Docker, Kubernetes, Terraform and CloudFormation.
|
||||
Also, you can write your own policies in [Rego][rego] to scan JSON, YAML, etc, like [Conftest][conftest].
|
||||
|
||||

|
||||
|
||||
## Quick start
|
||||
|
||||
Simply specify a directory containing IaC files such as Terraform, CloudFormation and Dockerfile.
|
||||
|
||||
``` bash
|
||||
$ trivy config [YOUR_IaC_DIRECTORY]
|
||||
```
|
||||
|
||||
|
||||
!!! example
|
||||
```
|
||||
$ ls build/
|
||||
Dockerfile
|
||||
$ trivy config ./build
|
||||
2022-05-16T13:29:29.952+0100 INFO Detected config files: 1
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 23 (SUCCESSES: 22, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 0, CRITICAL: 0)
|
||||
|
||||
MEDIUM: Specify a tag in the 'FROM' statement for image 'alpine'
|
||||
══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
When using a 'FROM' statement you should use a specific tag to avoid uncontrolled behavior when the image is updated.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ds001
|
||||
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Dockerfile:1
|
||||
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
1 [ FROM alpine:latest
|
||||
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
You can also enable misconfiguration detection in container image, filesystem and git repository scanning via `--security-checks config`.
|
||||
|
||||
```bash
|
||||
$ trivy image --security-checks config IMAGE_NAME
|
||||
```
|
||||
|
||||
```bash
|
||||
$ trivy fs --security-checks config /path/to/dir
|
||||
```
|
||||
|
||||
!!! note
|
||||
Misconfiguration detection is not enabled by default in `image`, `fs` and `repo` subcommands.
|
||||
|
||||
Unlike the `config` subcommand, `image`, `fs` and `repo` subcommands can also scan for vulnerabilities and secrets at the same time.
|
||||
You can specify `--security-checks vuln,config,secret` to enable vulnerability and secret detection as well as misconfiguration detection.
|
||||
|
||||
|
||||
!!! example
|
||||
``` bash
|
||||
$ ls myapp/
|
||||
Dockerfile Pipfile.lock
|
||||
$ trivy fs --security-checks vuln,config,secret --severity HIGH,CRITICAL myapp/
|
||||
2022-05-16T13:42:21.440+0100 INFO Number of language-specific files: 1
|
||||
2022-05-16T13:42:21.440+0100 INFO Detecting pipenv vulnerabilities...
|
||||
2022-05-16T13:42:21.440+0100 INFO Detected config files: 1
|
||||
|
||||
Pipfile.lock (pipenv)
|
||||
=====================
|
||||
Total: 1 (HIGH: 1, CRITICAL: 0)
|
||||
|
||||
┌──────────┬────────────────┬──────────┬───────────────────┬───────────────┬───────────────────────────────────────────────────────────┐
|
||||
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
||||
├──────────┼────────────────┼──────────┼───────────────────┼───────────────┼───────────────────────────────────────────────────────────┤
|
||||
│ httplib2 │ CVE-2021-21240 │ HIGH │ 0.12.1 │ 0.19.0 │ python-httplib2: Regular expression denial of service via │
|
||||
│ │ │ │ │ │ malicious header │
|
||||
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-21240 │
|
||||
└──────────┴────────────────┴──────────┴───────────────────┴───────────────┴───────────────────────────────────────────────────────────┘
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 17 (SUCCESSES: 16, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (HIGH: 1, CRITICAL: 0)
|
||||
|
||||
HIGH: Last USER command in Dockerfile should not be 'root'
|
||||
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ds002
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Dockerfile:3
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
3 [ USER root
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
In the above example, Trivy detected vulnerabilities of Python dependencies and misconfigurations in Dockerfile.
|
||||
|
||||
## Type detection
|
||||
The specified directory can contain mixed types of IaC files.
|
||||
Trivy automatically detects config types and applies relevant policies.
|
||||
|
||||
For example, the following example holds IaC files for Terraform, CloudFormation, Kubernetes, Helm Charts, and Dockerfile in the same directory.
|
||||
|
||||
``` bash
|
||||
$ ls iac/
|
||||
Dockerfile deployment.yaml main.tf mysql-8.8.26.tar
|
||||
$ trivy conf --severity HIGH,CRITICAL ./iac
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
```
|
||||
2022-06-06T11:01:21.142+0100 INFO Detected config files: 8
|
||||
|
||||
Dockerfile (dockerfile)
|
||||
|
||||
Tests: 21 (SUCCESSES: 20, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (MEDIUM: 0, HIGH: 1, CRITICAL: 0)
|
||||
|
||||
HIGH: Specify at least 1 USER command in Dockerfile with non-root user as argument
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ds002
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
deployment.yaml (kubernetes)
|
||||
|
||||
Tests: 20 (SUCCESSES: 15, FAILURES: 5, EXCEPTIONS: 0)
|
||||
Failures: 5 (MEDIUM: 4, HIGH: 1, CRITICAL: 0)
|
||||
|
||||
MEDIUM: Container 'hello-kubernetes' of Deployment 'hello-kubernetes' should set 'securityContext.allowPrivilegeEscalation' to false
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
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.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv001
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
deployment.yaml:16-19
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
16 ┌ - name: hello-kubernetes
|
||||
17 │ image: hello-kubernetes:1.5
|
||||
18 │ ports:
|
||||
19 └ - containerPort: 8080
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
HIGH: Deployment 'hello-kubernetes' should not specify '/var/run/docker.socker' in 'spec.template.volumes.hostPath.path'
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
Mounting docker.sock from the host can give the container full root access to the host.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv006
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
deployment.yaml:6-29
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
6 ┌ replicas: 3
|
||||
7 │ selector:
|
||||
8 │ matchLabels:
|
||||
9 │ app: hello-kubernetes
|
||||
10 │ template:
|
||||
11 │ metadata:
|
||||
12 │ labels:
|
||||
13 │ app: hello-kubernetes
|
||||
14 └ spec:
|
||||
..
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
MEDIUM: Container 'hello-kubernetes' of Deployment 'hello-kubernetes' should set 'securityContext.runAsNonRoot' to true
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
'runAsNonRoot' forces the running image to run as a non-root user to ensure least privileges.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv012
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
deployment.yaml:16-19
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
16 ┌ - name: hello-kubernetes
|
||||
17 │ image: hello-kubernetes:1.5
|
||||
18 │ ports:
|
||||
19 └ - containerPort: 8080
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
MEDIUM: Deployment 'hello-kubernetes' should not set 'spec.template.volumes.hostPath'
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
HostPath volumes must be forbidden.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv023
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
deployment.yaml:6-29
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
6 ┌ replicas: 3
|
||||
7 │ selector:
|
||||
8 │ matchLabels:
|
||||
9 │ app: hello-kubernetes
|
||||
10 │ template:
|
||||
11 │ metadata:
|
||||
12 │ labels:
|
||||
13 │ app: hello-kubernetes
|
||||
14 └ spec:
|
||||
..
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
MEDIUM: Deployment 'hello-kubernetes' should set 'securityContext.sysctl' to the allowed values
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
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.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv026
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
deployment.yaml:6-29
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
6 ┌ replicas: 3
|
||||
7 │ selector:
|
||||
8 │ matchLabels:
|
||||
9 │ app: hello-kubernetes
|
||||
10 │ template:
|
||||
11 │ metadata:
|
||||
12 │ labels:
|
||||
13 │ app: hello-kubernetes
|
||||
14 └ spec:
|
||||
..
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
mysql-8.8.26.tar:templates/primary/statefulset.yaml (helm)
|
||||
|
||||
Tests: 20 (SUCCESSES: 18, FAILURES: 2, EXCEPTIONS: 0)
|
||||
Failures: 2 (MEDIUM: 2, HIGH: 0, CRITICAL: 0)
|
||||
|
||||
MEDIUM: Container 'mysql' of StatefulSet 'mysql' should set 'securityContext.allowPrivilegeEscalation' to false
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
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.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv001
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
mysql-8.8.26.tar:templates/primary/statefulset.yaml:56-130
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
56 ┌ - name: mysql
|
||||
57 │ image: docker.io/bitnami/mysql:8.0.28-debian-10-r23
|
||||
58 │ imagePullPolicy: "IfNotPresent"
|
||||
59 │ securityContext:
|
||||
60 │ runAsUser: 1001
|
||||
61 │ env:
|
||||
62 │ - name: BITNAMI_DEBUG
|
||||
63 │ value: "false"
|
||||
64 └ - name: MYSQL_ROOT_PASSWORD
|
||||
..
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
MEDIUM: Container 'mysql' of StatefulSet 'mysql' should set 'securityContext.runAsNonRoot' to true
|
||||
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
||||
'runAsNonRoot' forces the running image to run as a non-root user to ensure least privileges.
|
||||
|
||||
See https://avd.aquasec.com/misconfig/ksv012
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
mysql-8.8.26.tar:templates/primary/statefulset.yaml:56-130
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
56 ┌ - name: mysql
|
||||
57 │ image: docker.io/bitnami/mysql:8.0.28-debian-10-r23
|
||||
58 │ imagePullPolicy: "IfNotPresent"
|
||||
59 │ securityContext:
|
||||
60 │ runAsUser: 1001
|
||||
61 │ env:
|
||||
62 │ - name: BITNAMI_DEBUG
|
||||
63 │ value: "false"
|
||||
64 └ - name: MYSQL_ROOT_PASSWORD
|
||||
..
|
||||
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
You can see the config type next to each file name.
|
||||
|
||||
!!! example
|
||||
``` bash
|
||||
Dockerfile (dockerfile)
|
||||
=======================
|
||||
Tests: 23 (SUCCESSES: 22, FAILURES: 1, EXCEPTIONS: 0)
|
||||
Failures: 1 (HIGH: 1, CRITICAL: 0)
|
||||
|
||||
...
|
||||
|
||||
deployment.yaml (kubernetes)
|
||||
============================
|
||||
Tests: 28 (SUCCESSES: 15, FAILURES: 13, EXCEPTIONS: 0)
|
||||
Failures: 13 (MEDIUM: 4, HIGH: 1, CRITICAL: 0)
|
||||
|
||||
...
|
||||
|
||||
main.tf (terraform)
|
||||
===================
|
||||
Tests: 23 (SUCCESSES: 14, FAILURES: 9, EXCEPTIONS: 0)
|
||||
Failures: 9 (HIGH: 6, CRITICAL: 1)
|
||||
|
||||
...
|
||||
|
||||
bucket.yaml (cloudformation)
|
||||
============================
|
||||
Tests: 9 (SUCCESSES: 3, FAILURES: 6, EXCEPTIONS: 0)
|
||||
Failures: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 2, HIGH: 4, CRITICAL: 0)
|
||||
|
||||
...
|
||||
|
||||
mysql-8.8.26.tar:templates/primary/statefulset.yaml (helm)
|
||||
==========================================================
|
||||
Tests: 20 (SUCCESSES: 18, FAILURES: 2, EXCEPTIONS: 0)
|
||||
Failures: 2 (MEDIUM: 2, HIGH: 0, CRITICAL: 0)
|
||||
```
|
||||
|
||||
## Examples
|
||||
See [here](https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/examples/misconf/mixed)
|
||||
|
||||
[rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
|
||||
[conftest]: https://github.com/open-policy-agent/conftest/
|
||||
|
||||
70
docs/docs/references/cli/client.md
Normal file
70
docs/docs/references/cli/client.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Client
|
||||
|
||||
```bash
|
||||
Usage:
|
||||
trivy client [flags] IMAGE_NAME
|
||||
|
||||
Aliases:
|
||||
client, c
|
||||
|
||||
Scan Flags
|
||||
--offline-scan do not issue API requests to identify dependencies
|
||||
--security-checks string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||
-o, --output string output file name
|
||||
--report string specify a report format for the output. (all,summary) (default "all")
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Vulnerability Flags
|
||||
--ignore-unfixed display only fixed vulnerabilities
|
||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||
|
||||
Misconfiguration Flags
|
||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||
--file-patterns strings specify config file patterns, available with '--security-checks config'
|
||||
--include-non-failures include successes and exceptions, available with '--security-checks config'
|
||||
--policy-namespaces strings Rego namespaces
|
||||
--trace enable more verbose trace output for custom queries
|
||||
|
||||
Client/Server Flags
|
||||
--custom-headers strings custom headers in client mode
|
||||
--remote string server address (default "http://localhost:4954")
|
||||
--token string for authentication in client/server mode
|
||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
49
docs/docs/references/cli/config.md
Normal file
49
docs/docs/references/cli/config.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Config
|
||||
|
||||
``` bash
|
||||
Scan config files for misconfigurations
|
||||
|
||||
Usage:
|
||||
trivy config [flags] DIR
|
||||
|
||||
Aliases:
|
||||
config, conf
|
||||
|
||||
Scan Flags
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
-o, --output string output file name
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
Misconfiguration Flags
|
||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||
--file-patterns strings specify config file patterns, available with '--security-checks config'
|
||||
--include-non-failures include successes and exceptions, available with '--security-checks config'
|
||||
--policy-namespaces strings Rego namespaces
|
||||
--trace enable more verbose trace output for custom queries
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
85
docs/docs/references/cli/fs.md
Normal file
85
docs/docs/references/cli/fs.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# Filesystem
|
||||
|
||||
```bash
|
||||
Scan local filesystem
|
||||
|
||||
Usage:
|
||||
trivy filesystem [flags] PATH
|
||||
|
||||
Aliases:
|
||||
filesystem, fs
|
||||
|
||||
Examples:
|
||||
# Scan a local project including language-specific files
|
||||
$ trivy fs /path/to/your_project
|
||||
|
||||
# Scan a single file
|
||||
$ trivy fs ./trivy-ci-test/Pipfile.lock
|
||||
|
||||
Scan Flags
|
||||
--offline-scan do not issue API requests to identify dependencies
|
||||
--security-checks string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||
-o, --output string output file name
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Vulnerability Flags
|
||||
--ignore-unfixed display only fixed vulnerabilities
|
||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||
|
||||
Misconfiguration Flags
|
||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||
--file-patterns strings specify config file patterns, available with '--security-checks config'
|
||||
--include-non-failures include successes and exceptions, available with '--security-checks config'
|
||||
--policy-namespaces strings Rego namespaces
|
||||
--trace enable more verbose trace output for custom queries
|
||||
|
||||
Secret Flags
|
||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||
|
||||
License Flags
|
||||
--ignored-licenses strings specify a list of license to ignore
|
||||
--license-full eagerly look for licenses in source code headers and license files
|
||||
|
||||
Client/Server Flags
|
||||
--custom-headers strings custom headers in client mode
|
||||
--server string server address in client mode
|
||||
--token string for authentication in client/server mode
|
||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
103
docs/docs/references/cli/image.md
Normal file
103
docs/docs/references/cli/image.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# Image
|
||||
|
||||
```bash
|
||||
Scan a container image
|
||||
|
||||
Usage:
|
||||
trivy image [flags] IMAGE_NAME
|
||||
|
||||
Aliases:
|
||||
image, i
|
||||
|
||||
Examples:
|
||||
# Scan a container image
|
||||
$ trivy image python:3.4-alpine
|
||||
|
||||
# Scan a container image from a tar archive
|
||||
$ trivy image --input ruby-3.1.tar
|
||||
|
||||
# Filter by severities
|
||||
$ trivy image --severity HIGH,CRITICAL alpine:3.15
|
||||
|
||||
# Ignore unfixed/unpatched vulnerabilities
|
||||
$ trivy image --ignore-unfixed alpine:3.15
|
||||
|
||||
# Scan a container image in client mode
|
||||
$ trivy image --server http://127.0.0.1:4954 alpine:latest
|
||||
|
||||
# Generate json result
|
||||
$ trivy image --format json --output result.json alpine:3.15
|
||||
|
||||
# Generate a report in the CycloneDX format
|
||||
$ trivy image --format cyclonedx --output result.cdx alpine:3.15
|
||||
|
||||
Scan Flags
|
||||
--offline-scan do not issue API requests to identify dependencies
|
||||
--security-checks string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||
-o, --output string output file name
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Image Flags
|
||||
--input string input file path instead of image name
|
||||
--removed-pkgs detect vulnerabilities of removed packages (only for Alpine)
|
||||
|
||||
Vulnerability Flags
|
||||
--ignore-unfixed display only fixed vulnerabilities
|
||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||
|
||||
Misconfiguration Flags
|
||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||
--file-patterns strings specify config file patterns, available with '--security-checks config'
|
||||
--include-non-failures include successes and exceptions, available with '--security-checks config'
|
||||
--policy-namespaces strings Rego namespaces
|
||||
--trace enable more verbose trace output for custom queries
|
||||
|
||||
Secret Flags
|
||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||
|
||||
License Flags
|
||||
--ignored-licenses strings specify a list of license to ignore
|
||||
--license-full eagerly look for licenses in source code headers and license files
|
||||
|
||||
Client/Server Flags
|
||||
--custom-headers strings custom headers in client mode
|
||||
--server string server address in client mode
|
||||
--token string for authentication in client/server mode
|
||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
50
docs/docs/references/cli/index.md
Normal file
50
docs/docs/references/cli/index.md
Normal file
@@ -0,0 +1,50 @@
|
||||
Trivy has several sub commands, image, fs, repo, client and server.
|
||||
|
||||
``` bash
|
||||
Scanner for vulnerabilities in container images, file systems, and Git repositories, as well as for configuration issues and hard-coded secrets
|
||||
|
||||
Usage:
|
||||
trivy [global flags] command [flags] target
|
||||
trivy [command]
|
||||
|
||||
Examples:
|
||||
# Scan a container image
|
||||
$ trivy image python:3.4-alpine
|
||||
|
||||
# Scan a container image from a tar archive
|
||||
$ trivy image --input ruby-3.1.tar
|
||||
|
||||
# Scan local filesystem
|
||||
$ trivy fs .
|
||||
|
||||
# Run in server mode
|
||||
$ trivy server
|
||||
|
||||
Available Commands:
|
||||
config Scan config files for misconfigurations
|
||||
filesystem Scan local filesystem
|
||||
help Help about any command
|
||||
image Scan a container image
|
||||
kubernetes scan kubernetes cluster
|
||||
module Manage modules
|
||||
plugin Manage plugins
|
||||
repository Scan a remote repository
|
||||
rootfs Scan rootfs
|
||||
sbom Scan SBOM for vulnerabilities
|
||||
server Server mode
|
||||
version Print the version
|
||||
|
||||
Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
-f, --format string version format (json)
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
-h, --help help for trivy
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
|
||||
Use "trivy [command] --help" for more information about a command.
|
||||
```
|
||||
30
docs/docs/references/cli/module.md
Normal file
30
docs/docs/references/cli/module.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Module
|
||||
|
||||
```bash
|
||||
Manage modules
|
||||
|
||||
Usage:
|
||||
trivy module [command]
|
||||
|
||||
Aliases:
|
||||
module, m
|
||||
|
||||
Available Commands:
|
||||
install Install a module
|
||||
uninstall Uninstall a module
|
||||
|
||||
Flags:
|
||||
-h, --help help for module
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
|
||||
Use "trivy module [command] --help" for more information about a command.
|
||||
```
|
||||
34
docs/docs/references/cli/plugin.md
Normal file
34
docs/docs/references/cli/plugin.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Plugin
|
||||
|
||||
```bash
|
||||
Manage plugins
|
||||
|
||||
Usage:
|
||||
trivy plugin [command]
|
||||
|
||||
Aliases:
|
||||
plugin, p
|
||||
|
||||
Available Commands:
|
||||
info Show information about the specified plugin
|
||||
install Install a plugin
|
||||
list List installed plugin
|
||||
run Run a plugin on the fly
|
||||
uninstall Uninstall a plugin
|
||||
update Update an existing plugin
|
||||
|
||||
Flags:
|
||||
-h, --help help for plugin
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
|
||||
Use "trivy plugin [command] --help" for more information about a command.
|
||||
```
|
||||
87
docs/docs/references/cli/repo.md
Normal file
87
docs/docs/references/cli/repo.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Repository
|
||||
|
||||
```bash
|
||||
Scan a remote repository
|
||||
|
||||
Usage:
|
||||
trivy repository [flags] REPO_URL
|
||||
|
||||
Aliases:
|
||||
repository, repo
|
||||
|
||||
Examples:
|
||||
# Scan your remote git repository
|
||||
$ trivy repo https://github.com/knqyf263/trivy-ci-test
|
||||
|
||||
Scan Flags
|
||||
--offline-scan do not issue API requests to identify dependencies
|
||||
--security-checks string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||
-o, --output string output file name
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Vulnerability Flags
|
||||
--ignore-unfixed display only fixed vulnerabilities
|
||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||
|
||||
Misconfiguration Flags
|
||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||
--file-patterns strings specify config file patterns, available with '--security-checks config'
|
||||
--include-non-failures include successes and exceptions, available with '--security-checks config'
|
||||
--policy-namespaces strings Rego namespaces
|
||||
--trace enable more verbose trace output for custom queries
|
||||
|
||||
Secret Flags
|
||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||
|
||||
License Flags
|
||||
--ignored-licenses strings specify a list of license to ignore
|
||||
--license-full eagerly look for licenses in source code headers and license files
|
||||
|
||||
Client/Server Flags
|
||||
--custom-headers strings custom headers in client mode
|
||||
--server string server address in client mode
|
||||
--token string for authentication in client/server mode
|
||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||
|
||||
Repository Flags
|
||||
--branch string pass the branch name to be scanned
|
||||
--commit string pass the commit hash to be scanned
|
||||
--tag string pass the tag name to be scanned
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
79
docs/docs/references/cli/rootfs.md
Normal file
79
docs/docs/references/cli/rootfs.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# Rootfs
|
||||
|
||||
```bash
|
||||
Scan rootfs
|
||||
|
||||
Usage:
|
||||
trivy rootfs [flags] ROOTDIR
|
||||
|
||||
Examples:
|
||||
# Scan unpacked filesystem
|
||||
$ docker export $(docker create alpine:3.10.2) | tar -C /tmp/rootfs -xvf -
|
||||
$ trivy rootfs /tmp/rootfs
|
||||
|
||||
# Scan from inside a container
|
||||
$ docker run --rm -it alpine:3.11
|
||||
/ # curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
/ # trivy rootfs /
|
||||
|
||||
Scan Flags
|
||||
--offline-scan do not issue API requests to identify dependencies
|
||||
--security-checks string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--dependency-tree show dependency origin tree (EXPERIMENTAL)
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||
-o, --output string output file name
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Vulnerability Flags
|
||||
--ignore-unfixed display only fixed vulnerabilities
|
||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||
|
||||
Misconfiguration Flags
|
||||
--config-data strings specify paths from which data for the Rego policies will be recursively loaded
|
||||
--config-policy strings specify paths to the Rego policy files directory, applying config files
|
||||
--file-patterns strings specify config file patterns, available with '--security-checks config'
|
||||
--include-non-failures include successes and exceptions, available with '--security-checks config'
|
||||
--policy-namespaces strings Rego namespaces
|
||||
--trace enable more verbose trace output for custom queries
|
||||
|
||||
Secret Flags
|
||||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml")
|
||||
|
||||
License Flags
|
||||
--ignored-licenses strings specify a list of license to ignore
|
||||
--license-full eagerly look for licenses in source code headers and license files
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
70
docs/docs/references/cli/sbom.md
Normal file
70
docs/docs/references/cli/sbom.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# SBOM
|
||||
|
||||
```bash
|
||||
Scan SBOM for vulnerabilities
|
||||
|
||||
Usage:
|
||||
trivy sbom [flags] SBOM_PATH
|
||||
|
||||
Examples:
|
||||
# Scan CycloneDX and show the result in tables
|
||||
$ trivy sbom /path/to/report.cdx
|
||||
|
||||
# Scan CycloneDX and generate a CycloneDX report
|
||||
$ trivy sbom --format cyclonedx /path/to/report.cdx
|
||||
|
||||
# Scan CycloneDX-type attestation and show the result in tables
|
||||
$ trivy sbom /path/to/report.cdx.intoto.jsonl
|
||||
|
||||
|
||||
Scan Flags
|
||||
--offline-scan do not issue API requests to identify dependencies
|
||||
--security-checks string comma-separated list of what security issues to detect (vuln,config,secret) (default "vuln,secret")
|
||||
--skip-dirs strings specify the directories where the traversal is skipped
|
||||
--skip-files strings specify the file paths to skip traversal
|
||||
|
||||
Report Flags
|
||||
--exit-code int specify exit code when any security issues are found
|
||||
-f, --format string format (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
|
||||
--ignore-policy string specify the Rego file path to evaluate each vulnerability
|
||||
--ignorefile string specify .trivyignore file (default ".trivyignore")
|
||||
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
|
||||
-o, --output string output file name
|
||||
-s, --severity string severities of security issues to be displayed (comma separated) (default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
|
||||
-t, --template string output template
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Vulnerability Flags
|
||||
--ignore-unfixed display only fixed vulnerabilities
|
||||
--vuln-type string comma-separated list of vulnerability types (os,library) (default "os,library")
|
||||
|
||||
Client/Server Flags
|
||||
--custom-headers strings custom headers in client mode
|
||||
--server string server address in client mode
|
||||
--token string for authentication in client/server mode
|
||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
49
docs/docs/references/cli/server.md
Normal file
49
docs/docs/references/cli/server.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Server
|
||||
|
||||
```bash
|
||||
Server mode
|
||||
|
||||
Usage:
|
||||
trivy server [flags]
|
||||
|
||||
Aliases:
|
||||
server, s
|
||||
|
||||
Examples:
|
||||
# Run a server
|
||||
$ trivy server
|
||||
|
||||
# Listen on 0.0.0.0:10000
|
||||
$ trivy server --listen 0.0.0.0:10000
|
||||
|
||||
|
||||
Cache Flags
|
||||
--cache-backend string cache backend (e.g. redis://localhost:6379) (default "fs")
|
||||
--cache-ttl duration cache TTL when using redis as cache backend
|
||||
--clear-cache clear image caches without scanning
|
||||
--redis-ca string redis ca file location, if using redis as cache backend
|
||||
--redis-cert string redis certificate file location, if using redis as cache backend
|
||||
--redis-key string redis key file location, if using redis as cache backend
|
||||
|
||||
DB Flags
|
||||
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
|
||||
--download-db-only download/update vulnerability database but don't run a scan
|
||||
--no-progress suppress progress bar
|
||||
--reset remove all caches and database
|
||||
--skip-db-update skip updating vulnerability database
|
||||
|
||||
Client/Server Flags
|
||||
--listen string listen address in server mode (default "localhost:4954")
|
||||
--token string for authentication in client/server mode
|
||||
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
|
||||
|
||||
Global Flags:
|
||||
--cache-dir string cache directory (default "/Users/teppei/Library/Caches/trivy")
|
||||
-c, --config string config path (default "trivy.yaml")
|
||||
-d, --debug debug mode
|
||||
--generate-default-config write the default config to trivy-default.yaml
|
||||
--insecure allow insecure server connections when using TLS
|
||||
-q, --quiet suppress progress bar and log output
|
||||
--timeout duration timeout (default 5m0s)
|
||||
-v, --version show version
|
||||
```
|
||||
340
docs/docs/references/customization/config-file.md
Normal file
340
docs/docs/references/customization/config-file.md
Normal file
@@ -0,0 +1,340 @@
|
||||
# Config file
|
||||
|
||||
Trivy can be customized by tweaking a `trivy.yaml` file. The config path can be overridden by the `--config` flag.
|
||||
|
||||
An example is [here][example].
|
||||
|
||||
## Global Options
|
||||
|
||||
```yaml
|
||||
# Same as '--quiet'
|
||||
# Default is false
|
||||
quiet: false
|
||||
|
||||
# Same as '--debug'
|
||||
# Default is false
|
||||
debug: false
|
||||
|
||||
# Same as '--insecure'
|
||||
# Default is false
|
||||
insecure: false
|
||||
|
||||
# Same as '--timeout'
|
||||
# Default is '5m'
|
||||
timeout: 10m
|
||||
|
||||
# Same as '--cache-dir'
|
||||
# Default is your system cache dir
|
||||
cache-dir: $HOME/.cache/trivy
|
||||
```
|
||||
|
||||
## Report Options
|
||||
|
||||
```yaml
|
||||
# Same as '--format'
|
||||
# Default is 'table'
|
||||
format: table
|
||||
|
||||
# Same as '--report' (available with 'trivy k8s')
|
||||
# Default is all
|
||||
report: all
|
||||
|
||||
# Same as '--template'
|
||||
# Default is empty
|
||||
template:
|
||||
|
||||
# Same as '--dependency-tree'
|
||||
# Default is false
|
||||
dependency-tree: false
|
||||
|
||||
# Same as '--list-all-pkgs'
|
||||
# Default is false
|
||||
list-all-pkgs: false
|
||||
|
||||
# Same as '--ignorefile'
|
||||
# Default is '.trivyignore'
|
||||
ignorefile: .trivyignore
|
||||
|
||||
# Same as '--ignore-policy'
|
||||
# Default is empty
|
||||
ignore-policy:
|
||||
|
||||
# Same as '--exit-code'
|
||||
# Default is 0
|
||||
exit-code: 0
|
||||
|
||||
# Same as '--output'
|
||||
# Default is empty (stdout)
|
||||
output:
|
||||
|
||||
# Same as '--severity'
|
||||
# Default is all severities
|
||||
severity:
|
||||
- UNKNOWN
|
||||
- LOW
|
||||
- MEDIUM
|
||||
- HIGH
|
||||
- CRITICAL
|
||||
```
|
||||
|
||||
## Scan Options
|
||||
Available in client/server mode
|
||||
|
||||
```yaml
|
||||
scan:
|
||||
# Same as '--skip-dirs'
|
||||
# Default is empty
|
||||
skip-dirs:
|
||||
- usr/local/
|
||||
- etc/
|
||||
|
||||
# Same as '--skip-files'
|
||||
# Default is empty
|
||||
skip-files:
|
||||
- package-dev.json
|
||||
|
||||
# Same as '--offline-scan'
|
||||
# Default is false
|
||||
offline-scan: false
|
||||
|
||||
# Same as '--security-checks'
|
||||
# Default depends on subcommand
|
||||
security-checks:
|
||||
- vuln
|
||||
- config
|
||||
- secret
|
||||
```
|
||||
|
||||
## Cache Options
|
||||
|
||||
```yaml
|
||||
cache:
|
||||
# Same as '--cache-backend'
|
||||
# Default is 'fs'
|
||||
backend: 'fs'
|
||||
|
||||
# Same as '--cache-ttl'
|
||||
# Default is 0 (no ttl)
|
||||
ttl: 0
|
||||
|
||||
# Redis options
|
||||
redis:
|
||||
# Same as '--redis-ca'
|
||||
# Default is empty
|
||||
ca:
|
||||
|
||||
# Same as '--redis-cert'
|
||||
# Default is empty
|
||||
cert:
|
||||
|
||||
# Same as '--redis-key'
|
||||
# Default is empty
|
||||
key:
|
||||
```
|
||||
|
||||
## DB Options
|
||||
|
||||
```yaml
|
||||
db:
|
||||
# Same as '--skip-db-update'
|
||||
# Default is false
|
||||
skip-update: false
|
||||
|
||||
# Same as '--no-progress'
|
||||
# Default is false
|
||||
no-progress: false
|
||||
|
||||
# Same as '--db-repository'
|
||||
# Default is 'github.com/aquasecurity-trivy-repo'
|
||||
repository: github.com/aquasecurity-trivy-repo
|
||||
```
|
||||
|
||||
## Image Options
|
||||
Available with container image scanning
|
||||
|
||||
```yaml
|
||||
image:
|
||||
# Same as '--input' (available with 'trivy image')
|
||||
# Default is empty
|
||||
input:
|
||||
|
||||
# Same as '--removed-pkgs'
|
||||
# Default is false
|
||||
removed-pkgs: false
|
||||
```
|
||||
|
||||
## Vulnerability Options
|
||||
Available with vulnerability scanning
|
||||
|
||||
```yaml
|
||||
vulnerability:
|
||||
# Same as '--vuln-type'
|
||||
# Default is 'os,library'
|
||||
type:
|
||||
- os
|
||||
- library
|
||||
|
||||
# Same as '--ignore-unfixed'
|
||||
# Default is false
|
||||
ignore-unfixed: false
|
||||
```
|
||||
|
||||
## Secret Options
|
||||
Available with secret scanning
|
||||
|
||||
```yaml
|
||||
secret:
|
||||
# Same as '--secret-config'
|
||||
# Default is 'trivy-secret.yaml'
|
||||
config: config/trivy/secret.yaml
|
||||
```
|
||||
|
||||
|
||||
## Misconfiguration Options
|
||||
Available with misconfiguration scanning
|
||||
|
||||
```yaml
|
||||
misconfiguration:
|
||||
# Same as '--file-patterns'
|
||||
# Default is empty
|
||||
file-patterns:
|
||||
-
|
||||
|
||||
# Same as '--include-non-failures'
|
||||
# Default is false
|
||||
include-non-failures: false
|
||||
|
||||
# Same as '--trace'
|
||||
# Default is false
|
||||
trace: false
|
||||
|
||||
# Same as '--config-policy'
|
||||
# Default is empty
|
||||
policy:
|
||||
- policy/repository
|
||||
- policy/custom
|
||||
|
||||
# Same as '--config-data'
|
||||
# Default is empty
|
||||
data:
|
||||
- data/
|
||||
|
||||
# Same as '--policy-namespaces'
|
||||
# Default is empty
|
||||
namespaces:
|
||||
- opa.examples
|
||||
- users
|
||||
|
||||
# helm value override configurations
|
||||
# set individual values
|
||||
helm:
|
||||
set:
|
||||
- securityContext.runAsUser=10001
|
||||
|
||||
# set values with file
|
||||
helm:
|
||||
values:
|
||||
- overrides.yaml
|
||||
|
||||
# set specific values from specific files
|
||||
helm:
|
||||
set-file:
|
||||
- image=dev-overrides.yaml
|
||||
|
||||
# set as string and preserve type
|
||||
helm:
|
||||
set-string:
|
||||
- name=true
|
||||
|
||||
# terraform tfvars overrrides
|
||||
terraform:
|
||||
vars:
|
||||
- dev-terraform.tfvars
|
||||
- common-terraform.tfvars
|
||||
```
|
||||
|
||||
## Kubernetes Options
|
||||
Available with Kubernetes scanning
|
||||
|
||||
```yaml
|
||||
kubernetes:
|
||||
# Same as '--context'
|
||||
# Default is empty
|
||||
context:
|
||||
|
||||
# Same as '--namespace'
|
||||
# Default is empty
|
||||
namespace:
|
||||
```
|
||||
|
||||
## Repository Options
|
||||
Available with git repository scanning (`trivy repo`)
|
||||
|
||||
```yaml
|
||||
repository:
|
||||
# Same as '--branch'
|
||||
# Default is empty
|
||||
branch:
|
||||
|
||||
# Same as '--commit'
|
||||
# Default is empty
|
||||
commit:
|
||||
|
||||
# Same as '--tag'
|
||||
# Default is empty
|
||||
tag:
|
||||
```
|
||||
|
||||
## Client/Server Options
|
||||
Available in client/server mode
|
||||
|
||||
```yaml
|
||||
server:
|
||||
# Same as '--server' (available in client mode)
|
||||
# Default is empty
|
||||
addr: http://localhost:4954
|
||||
|
||||
# Same as '--token'
|
||||
# Default is empty
|
||||
token: "something-secret"
|
||||
|
||||
# Same as '--token-header'
|
||||
# Default is 'Trivy-Token'
|
||||
token-header: 'My-Token-Header'
|
||||
|
||||
# Same as '--custom-headers'
|
||||
# Default is empty
|
||||
custom-headers:
|
||||
- scanner: trivy
|
||||
- x-api-token: xxx
|
||||
|
||||
# Same as '--listen' (available in server mode)
|
||||
# Default is 'localhost:4954'
|
||||
listen: 0.0.0.0:10000
|
||||
```
|
||||
|
||||
## Cloud Options
|
||||
|
||||
Available for cloud scanning (currently only `trivy aws`)
|
||||
|
||||
```yaml
|
||||
cloud:
|
||||
# whether to force a cache update for every scan
|
||||
update-cache: false
|
||||
|
||||
# how old cached results can be before being invalidated
|
||||
max-cache-age: 24h
|
||||
|
||||
# aws-specific cloud settings
|
||||
aws:
|
||||
# the aws region to use
|
||||
region: us-east-1
|
||||
|
||||
# the aws endpoint to use (not required for general use)
|
||||
endpoint: https://my.custom.aws.endpoint
|
||||
|
||||
# the aws account to use (this will be determined from your environment when not set)
|
||||
account: 123456789012
|
||||
```
|
||||
|
||||
[example]: https://github.com/aquasecurity/trivy/tree/{{ git.tag }}/examples/trivy-conf/trivy.yaml
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user