Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ci): bind the VirusTotal verdict to the bytes, not to the analysis id

Martin Vogel094929fddcb8
diff --git a/scripts/ci/check-virustotal.sh b/scripts/ci/check-virustotal.sh
index 412835552..dd3a48b97 100755
--- a/scripts/ci/check-virustotal.sh
+++ b/scripts/ci/check-virustotal.sh
@@ -426,11 +426,25 @@ def parse_completed(document: object, submission: Submission) -> Tuple[str, Opti
response_id = data.get("id")
if not isinstance(response_id, str) or ANALYSIS_ID_RE.fullmatch(response_id) is None:
raise GateError(f"VirusTotal response has an invalid analysis id: {submission.expected.scan_path}")
- if response_id != submission.analysis_id:
- raise GateError(
- f"VirusTotal response analysis id does not match the submitted analysis: "
- f"{submission.expected.scan_path}"
- )
+ # The id is recorded as evidence, NOT required to equal the submitted one.
+ #
+ # VirusTotal is content-addressed: for bytes it already holds it may answer
+ # with its own canonical analysis rather than the one this upload created,
+ # and the id then differs legitimately. Requiring equality blocked a real
+ # release dry-run on the 282 MB linux-arm64 candidate — precisely the kind
+ # of large, previously-seen artifact where this happens, so it would have
+ # recurred on most releases.
+ #
+ # What must hold is that the verdict describes THESE bytes, and the
+ # completed branch below enforces exactly that against file_info.sha256 and
+ # size. That is also what keeps a tuple's two candidates apart: stripped and
+ # unstripped have different hashes by construction, so neither can be read
+ # as the other regardless of what ids VirusTotal hands out (the wrong-hash
+ # and wrong-size contract cases pin this).
+ #
+ # The property given up is freshness: an older cached analysis of identical
+ # bytes is accepted. For identical bytes that is the same content risk, and
+ # it is the trade this gate deliberately takes to stay deterministic.
attributes = data.get("attributes")
if not isinstance(attributes, dict):
raise GateError("VirusTotal response has no analysis attributes")
diff --git a/tests/test_vt_gate_policy_contract.sh b/tests/test_vt_gate_policy_contract.sh
index 8390dda75..f04b61982 100644
--- a/tests/test_vt_gate_policy_contract.sh
+++ b/tests/test_vt_gate_policy_contract.sh
@@ -290,10 +290,13 @@ grep -Fq 'upload-alias' "$RESULTS" || \
fail "results must retain the action's submitted analysis ID"
grep -q $'undetected\t\tclean\t' "$RESULTS" || \
fail "clean result must carry an explicit clean policy classification"
-[ "$(run_gate "binaries/objects/probe=$(url_for mismatched-response-id)")" != "0" ] || \
- fail "a response for a different analysis ID must block even when hash/size match"
-grep -q 'response analysis id does not match' "$FIX/last.log" || \
- fail "analysis-ID mismatch failure is not explicit"
+# A differing analysis ID is NOT a failure: VirusTotal is content-addressed and
+# may answer for already-known bytes with its own canonical analysis. The
+# verdict is bound to the object by hash and size (wrong-hash / wrong-size
+# below), which is what actually keeps a tuple's stripped and unstripped
+# candidates apart — they differ in hash by construction.
+[ "$(run_gate "binaries/objects/probe=$(url_for mismatched-response-id)")" = "0" ] || \
+ fail "a content-bound response must pass even when VirusTotal returns its own analysis ID: $(cat "$FIX/last.log")"
for id in one-malicious one-suspicious; do
[ "$(run_gate "binaries/objects/probe=$(url_for "$id")")" != "0" ] || \