-
-
Notifications
You must be signed in to change notification settings - Fork 8
73 lines (64 loc) · 2.55 KB
/
security-audit.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
name: "Security Audit"
on:
push:
schedule:
- cron: '0 6 * * *'
jobs:
grype:
name: Grype
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
# Develop
- dswbot/wizard-server:develop
- dswbot/wizard-client:develop
- dswbot/document-worker:develop
- dswbot/mailer:develop
# Maintained
- datastewardshipwizard/wizard-server:4.12
- datastewardshipwizard/wizard-client:4.12
- datastewardshipwizard/document-worker:4.12
- datastewardshipwizard/mailer:4.12
# Latest
- datastewardshipwizard/wizard-server:4.13
- datastewardshipwizard/wizard-client:4.13
- datastewardshipwizard/document-worker:4.13
- datastewardshipwizard/mailer:4.13
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Grype
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sudo sh -s -- -b /usr/local/bin
- name: Check Grype
run: |
grype version
- name: Run Grype
run: |
grype ${{ matrix.image }} | tee result.txt
- name: Check critical vulnerabilities
run: |
CRITICALS=$(cat result.txt | grep "Critical" | wc -l | tr -s " ")
if [ "$CRITICALS" -gt "0" ]; then
echo "There are critical vulnerabilities: $CRITICALS (image: $IMAGE)"
echo "--------------------------------------------------------------------------------"
cat result.txt | grep "Critical"
echo "--------------------------------------------------------------------------------"
echo "Sending notification..."
./.github/scripts/discord-notify-error.sh "$DISCORD_ERROR_WEBHOOK_URL" "$IMAGE" "$CRITICALS" "$REPO" "$RUN"
./.github/scripts/discord-notify-error.sh "$DISCORD_INFO_WEBHOOK_URL" "$IMAGE" "$CRITICALS" "$REPO" "$RUN"
exit 1
else
echo "There are no critical vulnerabilities for image: $IMAGE"
echo "Sending notification..."
./.github/scripts/discord-notify-info.sh "$DISCORD_INFO_WEBHOOK_URL" "$IMAGE" "$REPO" "$RUN"
echo "Well done!"
fi
env:
IMAGE: ${{ matrix.image }}
DISCORD_ERROR_WEBHOOK_URL: ${{ secrets.DISCORD_ERROR_WEBHOOK_URL }}
DISCORD_INFO_WEBHOOK_URL: ${{ secrets.DISCORD_INFO_WEBHOOK_URL }}
REPO: ${{ github.repository }}
RUN: ${{ github.run_id }}