Files
Heimdall/scripts/ci/security.sh
T
Arnaud Dartois ad2a582b63
Heimdall Gitea / Build and tests (push) Failing after 1m12s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and tests (pull_request) Failing after 40s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
build(gitea): reconstruct tests packaging images and release lanes (Refs #1)
2026-10-20 02:29:19 +02:00

26 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
mkdir -p artifacts/security
dotnet list Heimdall.slnx package --vulnerable --include-transitive --format json > artifacts/security/nuget.json
status=0
python3 scripts/ci/check-advisories.py artifacts/security/nuget.json || status=1
sha=$(git rev-parse HEAD)
scanner=aquasec/trivy:0.69.3@sha256:bcc376de8d77cfe086a917230e818dc9f8528e3c852f7b1aff648949b6258d1c
for component in server agent; do
# Export to a temporary tar: no Docker socket is exposed to the scanner.
if ! docker image inspect "heimdall-$component:ci-$sha" >/dev/null 2>&1; then
echo "Missing image for security scan: $component" >&2
status=1
continue
fi
archive=$(mktemp)
docker save "heimdall-$component:ci-$sha" -o "$archive"
chmod a+r "$archive"
# Docker daemon paths differ from job-container paths; stdin avoids bind mounts.
docker run --rm -i "$scanner" image --input /dev/stdin --scanners vuln \
--severity HIGH,CRITICAL --exit-code 1 --format json < "$archive" \
> "artifacts/security/$component.json" || status=1
rm -f "$archive"
done
exit "$status"