Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 8cc7b21

Browse files
committed
Add basic ZAP integration test
1 parent 6ac36be commit 8cc7b21

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ jobs:
403403
run: |
404404
# Install dummy-ssh app
405405
helm -n demo-apps install dummy-ssh ./demo-apps/dummy-ssh/ --wait
406+
# Install plain nginx server
407+
kubectl create deployment --image nginx:alpine nginx --namespace demo-apps
408+
kubectl expose deployment nginx --port 80 --namespace demo-apps
406409
- name: "nmap Integration Tests"
407410
run: |
408411
helm -n integration-tests install nmap ./scanners/nmap/ --set="parserImage.tag=sha-$(git rev-parse --short HEAD)"
@@ -423,6 +426,11 @@ jobs:
423426
helm -n integration-tests install ssh-scan ./scanners/ssh_scan/ --set="parserImage.tag=sha-$(git rev-parse --short HEAD)"
424427
cd tests/integration/
425428
npx jest --ci --color ssh-scan
429+
- name: "ssh-scan Integration Tests"
430+
run: |
431+
helm -n integration-tests install zap ./scanners/zap/ --set="parserImage.tag=sha-$(git rev-parse --short HEAD)"
432+
cd tests/integration/
433+
npx jest --ci --color zap
426434
- name: Inspect Post Failure
427435
if: failure()
428436
run: |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { scan } = require("../helpers");
2+
3+
test(
4+
"zap baseline scan against a plain nginx container should only find couple findings",
5+
async () => {
6+
const { categories, severities } = await scan(
7+
"zap-nginx-baseline",
8+
"zap-baseline",
9+
["-t", "http://nginx.demo-apps.svc"],
10+
60 * 4
11+
);
12+
13+
expect(categories).toMatchObject({
14+
"Content Security Policy (CSP) Header Not Set": 1,
15+
'Server Leaks Version Information via "Server" HTTP Response Header Field': 1,
16+
"X-Content-Type-Options Header Missing": 1,
17+
"X-Frame-Options Header Not Set": 1,
18+
});
19+
expect(severities).toMatchObject({
20+
low: 3,
21+
medium: 1,
22+
});
23+
},
24+
5 * 60 * 1000
25+
);

0 commit comments

Comments
 (0)