fix(release): validate SQLite archive member format

This commit is contained in:
cesnimda
2026-11-18 13:18:13 +01:00
parent 2fb10f7b4e
commit 10abd22f1a
15 changed files with 1009 additions and 16 deletions
+4 -8
View File
@@ -453,19 +453,15 @@ verify_volume_backup() {
# Prove this is the DATABASE volume, not merely a non-empty tar. This is what
# catches an archive taken from the wrong volume, or from a freshly created
# empty one.
# Listed in the same container that wrote it, not with the host's tar: GNU tar
# reads a leading "C:/" as an rsh host and fails outright when this script runs
# from Git Bash. Docker is already required to have produced the archive.
# Python is already required by deployment validation. Its tar reader handles
# Windows paths and checks regular-file/header bytes without extracting files.
local has_db=1
if docker run --rm \
-v "$(dirname "$target")":/backup:ro \
-e ARCHIVE_NAME="$(basename "$target")" \
alpine:3 sh -c 'tar tzf "/backup/$ARCHIVE_NAME" > /tmp/backup-members && grep -Eq "(^|/)jobtracker[.]db$" /tmp/backup-members' >/dev/null 2>&1; then
if python3 scripts/validate-sqlite-backup.py "$target"; then
has_db=0
fi
if [ "$has_db" -ne 0 ]; then
echo "Archive ${target} contains no jobtracker.db — it is not a SQLite data backup. Aborting deploy."
echo "Archive ${target} has no valid regular SQLite database member. Aborting deploy."
rm -f "$target"
return 1
fi