2023-02-27 21:25:47 +02:00
|
|
|
name: 'Security web scan for zot'
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
zap_scan:
|
2024-09-30 11:24:24 -07:00
|
|
|
runs-on: ubuntu-latest
|
2023-02-27 21:25:47 +02:00
|
|
|
name: Scan ZOT using ZAP
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
flavor: [zot-linux-amd64-minimal, zot-linux-amd64]
|
|
|
|
steps:
|
|
|
|
- name: Install go
|
2023-12-12 02:44:28 -08:00
|
|
|
uses: actions/setup-go@v5
|
2023-02-27 21:25:47 +02:00
|
|
|
with:
|
2023-03-22 12:33:21 -07:00
|
|
|
cache: false
|
2024-11-08 08:58:55 -08:00
|
|
|
go-version: 1.23.x
|
2023-02-27 21:25:47 +02:00
|
|
|
- name: Checkout
|
2023-09-05 12:30:49 -07:00
|
|
|
uses: actions/checkout@v4
|
2023-02-27 21:25:47 +02:00
|
|
|
- name: Build zot
|
|
|
|
run: |
|
|
|
|
echo "Building $FLAVOR"
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
if [[ $FLAVOR == "zot-linux-amd64-minimal" ]]; then
|
|
|
|
make binary-minimal
|
|
|
|
else
|
|
|
|
make binary
|
|
|
|
fi
|
|
|
|
ls -l bin/
|
|
|
|
env:
|
|
|
|
FLAVOR: ${{ matrix.flavor }}
|
|
|
|
- name: Bringup zot server
|
|
|
|
run: |
|
|
|
|
# upload images, zot can serve OCI image layouts directly like so
|
|
|
|
mkdir /tmp/zot
|
|
|
|
skopeo copy --format=oci docker://busybox:latest oci:/tmp/zot/busybox:latest
|
|
|
|
# start zot
|
|
|
|
if [[ $FLAVOR == "zot-linux-amd64-minimal" ]]; then
|
|
|
|
./bin/${{ matrix.flavor }} serve examples/config-conformance.json &
|
|
|
|
else
|
|
|
|
./bin/${{ matrix.flavor }} serve examples/config-ui.json &
|
|
|
|
fi
|
|
|
|
# wait until service is up
|
|
|
|
while true; do x=0; curl -f http://localhost:8080/v2/ || x=1; if [ $x -eq 0 ]; then break; fi; sleep 1; done
|
|
|
|
env:
|
|
|
|
FLAVOR: ${{ matrix.flavor }}
|
|
|
|
- name: ZAP Scan Rest API
|
2024-12-06 09:04:46 -08:00
|
|
|
uses: zaproxy/action-baseline@v0.14.0
|
2023-02-27 21:25:47 +02:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2024-04-15 23:22:03 -07:00
|
|
|
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'
|
2023-02-27 21:25:47 +02:00
|
|
|
target: 'http://localhost:8080/v2/'
|
|
|
|
rules_file_name: '.zap/rules.tsv'
|
|
|
|
cmd_options: '-a -j'
|
|
|
|
allow_issue_writing: false
|
|
|
|
fail_action: true
|
2024-12-26 02:17:34 -08:00
|
|
|
artifact_name: zap_scan_${{ matrix.flavor }}
|