Skip to content

Commit fda8e47

Browse files
authored
Merge pull request #650 from secureCodeBox/tests/trivy-integration
2 parents 6ca5a37 + dbe44d7 commit fda8e47

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,19 @@ jobs:
976976
cd tests/integration/
977977
npx jest --ci --color scanner/sslyze.test.js
978978
979+
# ---- Trivy Integration Tests ----
980+
981+
- name: "trivy Integration Tests"
982+
run: |
983+
kubectl -n integration-tests delete scans --all
984+
helm -n integration-tests install trivy ./scanners/trivy/ \
985+
--set="parser.image.tag=sha-$(git rev-parse --short HEAD)" \
986+
--set="parser.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/parser-trivy" \
987+
--set="parser.env[0].name=CRASH_ON_FAILED_VALIDATION" \
988+
--set-string="parser.env[0].value=true"
989+
cd tests/integration/
990+
npx jest --ci --color scanner/trivy.test.js
991+
979992
# ---- Typo3scan Integration Tests ----
980993

981994
- name: "typo3scan Integration Tests"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-FileCopyrightText: 2021 iteratec GmbH
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
const { scan } = require("../helpers");
6+
7+
jest.retryTimes(3);
8+
9+
test(
10+
"trivy scans vulnerable juiceshop demo target",
11+
async () => {
12+
const { categories, severities, count } = await scan(
13+
"trivy-juice-shop",
14+
"trivy",
15+
["bkimminich/juice-shop:v10.2.0"],
16+
90
17+
);
18+
19+
expect(count).toBeGreaterThanOrEqual(134);
20+
expect(categories["Image Vulnerability"]).toBeGreaterThanOrEqual(26);
21+
expect(categories["NPM Package Vulnerability"]).toBeGreaterThanOrEqual(108);
22+
expect(severities["high"]).toBeGreaterThanOrEqual(82);
23+
expect(severities["medium"]).toBeGreaterThanOrEqual(47);
24+
expect(severities["low"]).toBeGreaterThanOrEqual(5);
25+
},
26+
3 * 60 * 1000
27+
);
28+
29+
test(
30+
"Invalid argument should be marked as errored",
31+
async () => {
32+
await expect(
33+
scan(
34+
"trivy-invalidArg",
35+
"trivy",
36+
["--invalidArg", "not/a-valid-image:v0.0.0"],
37+
90
38+
)
39+
).rejects.toThrow("HTTP request failed");
40+
},
41+
3 * 60 * 1000
42+
);

0 commit comments

Comments
 (0)