Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/ci/append-vt-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ for result in results:
fail(f"VirusTotal result is not bound to candidate bytes: {result['scan_path']}")
completed = int(result["completed_engines"])
total = int(result["total_engines"])
if completed < 50 or total < completed:
fail(f"incomplete VirusTotal result: {result['scan_path']}")
# As in the gate and the selector: `total < completed` is an incoherent
# response, but how many engines answered is VirusTotal fleet availability,
# not a verdict, so a low count is reported and never fails the release.
if total < completed:
fail(f"VirusTotal result has incoherent engine coverage: {result['scan_path']}")
classification = result["policy_classification"]
clean = (
classification == "clean"
Expand Down
24 changes: 24 additions & 0 deletions tests/test_vt_release_notes_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,30 @@ if run_notes "$FIX/current.md" "$FIX/tampered.md"; then
fi
mv "$FIX/evidence/release-selection.clean.tsv" "$FIX/evidence/release-selection.tsv"

# How many engines answered is VirusTotal fleet availability, not a verdict:
# the gate and the selector record the count and never gate on it. A shipped,
# clean binary judged by 49 engines (as on the v0.12.2-rc.1 run) must publish
# its notes, and the count must appear in the reported range.
cp "$FIX/evidence/virustotal-candidate-results.tsv" "$FIX/evidence/vt-results.clean.tsv"
python3 - "$FIX/evidence/virustotal-candidate-results.tsv" <<'PY'
import hashlib, pathlib, sys
p = pathlib.Path(sys.argv[1])
sha = hashlib.sha256(b"linux-arm64:stripped").hexdigest()
lines = p.read_text().splitlines(keepends=True)
hits = [i for i, line in enumerate(lines) if line.startswith(f"objects/{sha}\t")]
assert len(hits) == 1, "fixture row for the shipped linux-arm64 binary not found"
cells = lines[hits[0]].split("\t")
assert cells[4] == "61" and cells[11] == "clean", cells
cells[4] = "49"
lines[hits[0]] = "\t".join(cells)
p.write_text("".join(lines))
PY
run_notes "$FIX/current.md" "$FIX/low-engines.md" || \
fail "a clean shipped binary judged by 49 engines must not fail the release notes"
grep -q 'decisive engines: 49' "$FIX/low-engines.md" || \
fail "the 49-engine count must be reported, not hidden"
mv "$FIX/evidence/vt-results.clean.tsv" "$FIX/evidence/virustotal-candidate-results.tsv"

cat > "$FIX/reversed.md" <<'EOF'
<!-- cbm-security-verification:end -->
stale reversed data
Expand Down
Loading