Skip to content

Commit d0e3e03

Browse files
authored
Merge pull request #647 from secureCodeBox/feature/add-typo3-integration-test
Add integration tests to Typo3Scan
2 parents c0cd9ab + 7ed25be commit d0e3e03

3 files changed

Lines changed: 61 additions & 5 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,10 @@ jobs:
564564
- kubeaudit
565565
- ncrack
566566
- nmap
567-
- whatweb
568567
- nikto
568+
- typo3scan
569+
- whatweb
570+
569571
steps:
570572
- name: Checkout
571573
uses: actions/checkout@v2
@@ -678,7 +680,7 @@ jobs:
678680
password: ${{ secrets.DOCKERHUB_PASSWORD }}
679681
repository: ${{ env.DOCKER_NAMESPACE }}/scanner-${{ matrix.scanner }}
680682
readme-filepath: ./scanners/${{ matrix.scanner }}/docs/README.DockerHub-Scanner.md
681-
683+
682684
# ---- Integration Tests ----
683685

684686
Integration-tests:
@@ -827,6 +829,8 @@ jobs:
827829
helm -n demo-targets install petstore ./demo-targets/swagger-petstore/ --set="fullnameOverride=petstore" --wait
828830
# Install old-wordpress app
829831
helm -n demo-targets install old-wordpress ./demo-targets/old-wordpress/ --set="fullnameOverride=old-wordpress" --wait
832+
# Install old-typo3 app
833+
helm -n demo-targets install old-typo3 ./demo-targets/old-typo3/ --set="fullnameOverride=old-typo3" --wait
830834
# Install juiceshop app
831835
helm -n demo-targets install juiceshop ./demo-targets/juice-shop/ --set="fullnameOverride=juiceshop" --wait
832836
# Install plain nginx server
@@ -972,6 +976,19 @@ jobs:
972976
cd tests/integration/
973977
npx jest --ci --color scanner/sslyze.test.js
974978
979+
# ---- Typo3scan Integration Tests ----
980+
981+
- name: "typo3scan Integration Tests"
982+
run: |
983+
kubectl -n integration-tests delete scans --all
984+
helm -n integration-tests install typo3scan ./scanners/typo3scan/ \
985+
--set="parser.image.tag=sha-$(git rev-parse --short HEAD)" \
986+
--set="parser.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/parser-typo3scan" \
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/typo3scan.test.js
991+
975992
# ---- Whatweb Integration Tests ----
976993

977994
- name: "Whatweb Integration Tests"

demo-targets/old-typo3/container/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ COPY ./typo3conf /var/www/html/typo3conf
1010

1111
RUN chown -R www-data.www-data /var/www/html/typo3conf \
1212
&& chmod +rxw /var/www/html/typo3conf/cms-016d0ef9.sqlite
13-
# Change to low-privilege user 'www-data'
14-
USER 33
15-
1613
# Login details
1714
# Username: root
1815
# Password: supersecret
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+
"typo3scan scans old-typo3 for vulnerable extensions and core only",
11+
async () => {
12+
const { categories, severities, count } = await scan(
13+
"typo3scan-old-typo3",
14+
"typo3scan",
15+
["-d", "http://old-typo3.demo-targets.svc", "--vuln"],
16+
90
17+
);
18+
19+
expect(count).toBe(53);
20+
expect(categories).toMatchInlineSnapshot(`
21+
Object {
22+
"Vulnerability": 53,
23+
}
24+
`);
25+
expect(severities).toMatchInlineSnapshot(`
26+
Object {
27+
"high": 53,
28+
}
29+
`);
30+
},
31+
3 * 60 * 1000
32+
);
33+
34+
test(
35+
"Invalid argument should be marked as errored",
36+
async () => {
37+
await expect(
38+
scan("typo3scan-invalidArg", "typo3scan", ["--invalidArg", "example.com"], 90)
39+
).rejects.toThrow("HTTP request failed");
40+
},
41+
3 * 60 * 1000
42+
);

0 commit comments

Comments
 (0)