-
Notifications
You must be signed in to change notification settings - Fork 13
97 lines (94 loc) · 4.13 KB
/
init-matrix.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
on:
push:
branches: ["*"]
paths:
- init/**
- .github/workflows/init-matrix.yml
pull_request:
branches: ["*"]
paths:
- init/**
- .github/workflows/init-matrix.yml
workflow_dispatch:
inputs:
url:
description: "Single url to scan or scan all urls"
required: false
default: ""
name: Test init matrix
jobs:
test1:
runs-on: ubuntu-latest
name: Prepare full scan
outputs:
urls: ${{ steps.init.outputs.urls }}
sites: ${{ steps.init.outputs.sites }}
config: ${{ steps.init.outputs.config }}
steps:
- uses: actions/checkout@v3
- run: |
cd init
- id: init
uses: "./init"
- id: test
run: |
EXPECTED="[{url:https://www.free.fr,title:Free,repositories:[iliad/free-ui,iliad/free-api],tools:{screenshot:true,nmap:true,zap:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true,budget_page:true,declaration-a11y:true,declaration-rgpd:true,betagouv:true},subpages:[https://www.free.fr]},{url:http://chez.com,repositories:[chez/chez-ui,chez/chez-api],pages:[/login,/profile],tools:{screenshot:false,nmap:true,zap:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:false,dependabot:true,codescan:true,stats:false,budget_page:true,declaration-a11y:true,declaration-rgpd:true,betagouv:true},subpages:[http://chez.com,http://chez.com/login,http://chez.com/profile]},{url:https://voila.fr,tools:{screenshot:true,nmap:true,zap:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true,budget_page:true,declaration-a11y:true,declaration-rgpd:true,betagouv:true},subpages:[https://voila.fr]}]"
RESULT="${{ steps.init.outputs.sites }}"
echo "RESULT=$RESULT"
[[ "$EXPECTED" == "$RESULT" ]]
scans:
runs-on: ubuntu-latest
name: Scan
needs: test1
continue-on-error: true
strategy:
fail-fast: false
max-parallel: 3
matrix:
sites: ${{ fromJson(needs.test1.outputs.sites) }}
steps:
- uses: actions/checkout@v3
- run: |
echo "${{ matrix.sites.url }}"
echo "${{ join(matrix.sites.repositories) }}"
test2:
runs-on: ubuntu-latest
name: Prepare scan with url input
outputs:
urls: ${{ steps.init.outputs.urls }}
sites: ${{ steps.init.outputs.sites }}
config: ${{ steps.init.outputs.config }}
steps:
- uses: actions/checkout@v3
- run: |
cd init
- id: init
uses: "./init"
with:
# fake manual url input
url: "https://www.free.fr,https://voila.fr"
- id: test
run: |
EXPECTED="[{url:https://www.free.fr,title:Free,repositories:[iliad/free-ui,iliad/free-api],tools:{screenshot:true,nmap:true,zap:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true,budget_page:true,declaration-a11y:true,declaration-rgpd:true,betagouv:true},subpages:[https://www.free.fr]},{url:https://voila.fr,tools:{screenshot:true,nmap:true,zap:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true,budget_page:true,declaration-a11y:true,declaration-rgpd:true,betagouv:true},subpages:[https://voila.fr]}]"
RESULT="${{ steps.init.outputs.sites }}"
echo "RESULT=$RESULT"
[[ "$EXPECTED" == "$RESULT" ]]
scans2:
runs-on: ubuntu-latest
name: Scan
needs: test2
continue-on-error: true
strategy:
fail-fast: false
max-parallel: 3
matrix:
sites: ${{ fromJson(needs.test2.outputs.sites) }}
steps:
- uses: actions/checkout@v3
- run: |
echo "${{ matrix.sites.url }}"
echo "${{ join(matrix.sites.repositories) }}"
- if: ${{ matrix.sites.repositories }}
run: |
echo "for ${{ matrix.sites.url }}"
echo "if ${{ join(matrix.sites.repositories) }}"