Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (ci): verify agent binary download and harden health smoke check

Rostislav Dugin248d9b10aa1f
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml
index 9a07126f..68bf916a 100644
--- a/.github/workflows/ci-release.yml
+++ b/.github/workflows/ci-release.yml
@@ -482,13 +482,16 @@ jobs:
databasus-dev:smoke-${{ github.sha }}
for i in $(seq 1 60); do
- code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:4005/system/health || true)
- if [ "$code" = "200" ]; then
+ health_body=$(mktemp)
+ code=$(curl -s -o "$health_body" -w '%{http_code}' http://localhost:4005/api/v1/system/health || true)
+ if [ "$code" = "200" ] && grep -q '"status"' "$health_body"; then
echo "healthcheck OK after ${i} attempt(s)"
+ rm -f "$health_body"
break
fi
+ rm -f "$health_body"
if [ "$i" -eq 60 ]; then
- echo "healthcheck never returned 200 (last code: ${code})"
+ echo "healthcheck never returned valid JSON (last code: ${code})"
docker logs databasus-dev-smoke
exit 1
fi
@@ -503,6 +506,30 @@ jobs:
fi
echo "index.html OK"
+ for arch in amd64 arm64; do
+ echo "Checking agent download for $arch..."
+ out=$(mktemp)
+ http=$(curl -sS -o "$out" -w '%{http_code}' "http://localhost:4005/api/v1/system/agent?arch=$arch")
+ if [ "$http" != "200" ]; then
+ echo "agent ($arch) download failed: HTTP $http"
+ head -c 200 "$out" || true
+ docker logs databasus-dev-smoke
+ rm -f "$out"
+ exit 1
+ fi
+ magic=$(head -c 4 "$out" | od -An -t x1 | tr -d ' ')
+ if [ "$magic" != "7f454c46" ]; then
+ echo "agent ($arch) is not an ELF binary (first 4 bytes: $magic)"
+ head -c 200 "$out" || true
+ docker logs databasus-dev-smoke
+ rm -f "$out"
+ exit 1
+ fi
+ size=$(stat -c%s "$out")
+ echo "agent ($arch) OK (${size} bytes)"
+ rm -f "$out"
+ done
+
- name: Install Trivy
run: |
sudo apt-get update
@@ -606,13 +633,16 @@ jobs:
databasus:smoke-${{ github.sha }}
for i in $(seq 1 60); do
- code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:4005/system/health || true)
- if [ "$code" = "200" ]; then
+ health_body=$(mktemp)
+ code=$(curl -s -o "$health_body" -w '%{http_code}' http://localhost:4005/api/v1/system/health || true)
+ if [ "$code" = "200" ] && grep -q '"status"' "$health_body"; then
echo "healthcheck OK after ${i} attempt(s)"
+ rm -f "$health_body"
break
fi
+ rm -f "$health_body"
if [ "$i" -eq 60 ]; then
- echo "healthcheck never returned 200 (last code: ${code})"
+ echo "healthcheck never returned valid JSON (last code: ${code})"
docker logs databasus-smoke
exit 1
fi
@@ -627,6 +657,30 @@ jobs:
fi
echo "index.html OK"
+ for arch in amd64 arm64; do
+ echo "Checking agent download for $arch..."
+ out=$(mktemp)
+ http=$(curl -sS -o "$out" -w '%{http_code}' "http://localhost:4005/api/v1/system/agent?arch=$arch")
+ if [ "$http" != "200" ]; then
+ echo "agent ($arch) download failed: HTTP $http"
+ head -c 200 "$out" || true
+ docker logs databasus-smoke
+ rm -f "$out"
+ exit 1
+ fi
+ magic=$(head -c 4 "$out" | od -An -t x1 | tr -d ' ')
+ if [ "$magic" != "7f454c46" ]; then
+ echo "agent ($arch) is not an ELF binary (first 4 bytes: $magic)"
+ head -c 200 "$out" || true
+ docker logs databasus-smoke
+ rm -f "$out"
+ exit 1
+ fi
+ size=$(stat -c%s "$out")
+ echo "agent ($arch) OK (${size} bytes)"
+ rm -f "$out"
+ done
+
- name: Install Trivy
run: |
sudo apt-get update
diff --git a/README.md b/README.md
index fea62aad..74a67503 100644
--- a/README.md
+++ b/README.md
@@ -251,7 +251,7 @@ After installation, it is also recommended to <a href="https://databasus.com/faq
## 🛡️ Security & reliability engineering
-Databasus works with sensitive data, so preventing vulnerabilities, unauthorised access and data leaks is a primary concern. We invest in this on both sides of the system: in the code itself (permission checks, encryption, careful handling of secrets) and in the infrastructure around it (dependency analysis, CVE response, DevSecOps best practices). The pipeline below runs automatically on every commit and PR - no single layer is enough on its own, but together they catch most things before a release goes out.
+Databasus works with sensitive data, so preventing vulnerabilities, unauthorised access and data leaks is a primary concern. We invest in this on both sides of the system: in the code itself (permission checks, encryption, careful handling of secrets) and in the infrastructure around it (dependency analysis, CVE response, DevSecOps best practices). The pipeline below runs automatically on every commit and PR. No single layer is enough on its own, but together they reduce the chance of vulnerable code, unsafe dependencies, broken images, or non-restorable backups reaching a release.
For static analysis we combine several independent passes. CodeQL scans the full codebase for security issues. CodeRabbit reviews every PR and runs gitleaks for secret scanning and semgrep for security rules inline. Dockerfiles and CI workflows get extra rules of their own (pinned action references, least-privilege permissions, suspicious base images), so insecure patterns are flagged before they ever merge. On top of these per-PR checks, Codex Security from OpenAI runs regular, deeper audits of the whole codebase. It's a separate program that catches architectural and cross-cutting issues narrow PR-time scans can miss.