Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

Verify the Quality image tar hash instead of Docker image IDs.

Christian33b30a28f60f
diff --git a/.github/workflows/heavy-validation.yaml b/.github/workflows/heavy-validation.yaml
index f961368..76d25c2 100644
--- a/.github/workflows/heavy-validation.yaml
+++ b/.github/workflows/heavy-validation.yaml
@@ -146,10 +146,12 @@ jobs:
test -f "$security_file"
docker rmi "$BRAINAPI_IMAGE" || true
gzip -dc "$image_archive" | docker load
- expected=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["image_digest"])' "$security_file")
- actual=$(docker image inspect "$BRAINAPI_IMAGE" --format '{{.Id}}')
- echo "expected=$expected"
- echo "actual=$actual"
+ expected=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["archive_sha256"])' "$security_file")
+ actual=$(sha256sum "$image_archive" | awk '{print $1}')
+ echo "expected_tar=$expected"
+ echo "actual_tar=$actual"
+ echo "loaded_id=$(docker image inspect "$BRAINAPI_IMAGE" --format '{{.Id}}')"
+ test -n "$expected"
test "$actual" = "$expected"
- name: Require runner capacity
run: |
diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml
index 345bb02..a2f113b 100644
--- a/.github/workflows/quality.yaml
+++ b/.github/workflows/quality.yaml
@@ -133,7 +133,7 @@ jobs:
- name: Record exact-image security evidence
run: |
cp brainapi.spdx.json "$RELEASE_ARTIFACT_DIR/brainapi.spdx.json"
- python scripts/write_security_artifact.py --trivy trivy.json --sbom "$RELEASE_ARTIFACT_DIR/brainapi.spdx.json" --image "$BRAINAPI_IMAGE" --output "$RELEASE_ARTIFACT_DIR/security.json"
+ python scripts/write_security_artifact.py --trivy trivy.json --sbom "$RELEASE_ARTIFACT_DIR/brainapi.spdx.json" --image "$BRAINAPI_IMAGE" --archive "$RELEASE_ARTIFACT_DIR/brainapi-image.tar.gz" --output "$RELEASE_ARTIFACT_DIR/security.json"
- name: Logs on failure
if: failure()
run: docker compose --project-name brainapi-ci -f deploy/docker-compose.light.yaml -f deploy/docker-compose.ci.yaml logs --no-color
diff --git a/scripts/check_release_readiness.py b/scripts/check_release_readiness.py
index 9d23b52..a6ef8dc 100644
--- a/scripts/check_release_readiness.py
+++ b/scripts/check_release_readiness.py
@@ -101,6 +101,9 @@ def _check_security(data: dict, artifact_dir: Path) -> None:
digest = str(data.get("image_digest", ""))
if not digest.startswith("sha256:"):
raise RuntimeError("The exact image digest was not recorded")
+ archive_sha256 = str(data.get("archive_sha256", ""))
+ if len(archive_sha256) != 64:
+ raise RuntimeError("The exact image archive hash was not recorded")
sbom = artifact_dir / str(data.get("sbom", ""))
if not sbom.is_file():
raise RuntimeError("The exact image SBOM is missing")
diff --git a/scripts/write_security_artifact.py b/scripts/write_security_artifact.py
index 993b506..9230feb 100644
--- a/scripts/write_security_artifact.py
+++ b/scripts/write_security_artifact.py
@@ -4,6 +4,7 @@
from __future__ import annotations
import argparse
+import hashlib
import json
import subprocess
from pathlib import Path
@@ -14,6 +15,7 @@ def main() -> int:
parser.add_argument("--trivy", type=Path, required=True)
parser.add_argument("--sbom", type=Path, required=True)
parser.add_argument("--image", required=True)
+ parser.add_argument("--archive", type=Path)
parser.add_argument("--output", type=Path, required=True)
args = parser.parse_args()
@@ -30,10 +32,18 @@ def main() -> int:
capture_output=True,
text=True,
).stdout.strip()
+ archive_sha256 = ""
+ if args.archive:
+ hasher = hashlib.sha256()
+ with args.archive.open("rb") as handle:
+ for chunk in iter(lambda: handle.read(1024 * 1024), b""):
+ hasher.update(chunk)
+ archive_sha256 = hasher.hexdigest()
result = {
"high": counts["HIGH"],
"critical": counts["CRITICAL"],
"image_digest": digest,
+ "archive_sha256": archive_sha256,
"sbom": args.sbom.name,
}
args.output.parent.mkdir(parents=True, exist_ok=True)