Skip to content

Commit b50a7dd

Browse files
Dobbyclaude
andcommitted
fix: handle raw JSON Attestation-Report from Lunal attestation-service sidecar
v1.2.5 updated the orchestrator (X-Orchestrator-Attestation-Report) decode path to support both base64+gzip and raw JSON formats, but left the Lunal upstream (Attestation-Report) path stuck on base64+gzip only. Lunal also upgraded to the new attestation-service sidecar architecture, so their Attestation-Report header now emits raw JSON {"platform":..., "evidence":{...}} instead of base64+gzip. This caused step [4/5] to report "Lunal Upstream Attestation: present but verification failed" and FAIL on any claimed CVM making real inference requests. Fix mirrors the orchestrator decode strategy for the Lunal upstream path: try base64+gzip first (backward compat), fall back to raw JSON with .evidence sub-object extraction, fall back to raw JSON directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3210f5c commit b50a7dd

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

privateclaw

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,28 @@ cmd_verify() {
388388
echo " Provider: ${INF_PROVIDER:-lunal}"
389389

390390
# --- Lunal upstream attestation (Attestation-Report, passed through untouched by our tee-proxy) ---
391+
# Support two formats Lunal may send:
392+
# 1. base64+gzip (old standalone attestation inline mode)
393+
# 2. raw JSON from attestation-service sidecar: {"platform":..., "evidence":{...}}
394+
# attestation-cli verify expects the .evidence sub-object (or the whole object
395+
# if no .evidence key is present).
391396
INF_ATTEST_OK=false
392397
if [ -n "$ATTESTATION" ]; then
393398
INF_EVIDENCE_FILE=$(mktemp /tmp/inference_attestation_XXXXXX.json)
394-
if echo "$ATTESTATION" | base64 -d 2>/dev/null | gunzip > "$INF_EVIDENCE_FILE" 2>/dev/null; then
399+
INF_DECODED=false
400+
# Try 1: base64+gzip (backward compat with old Lunal inline attestation)
401+
if echo "$ATTESTATION" | base64 -d 2>/dev/null | gunzip > "$INF_EVIDENCE_FILE" 2>/dev/null && jq -e . "$INF_EVIDENCE_FILE" &>/dev/null 2>&1; then
402+
INF_DECODED=true
403+
fi
404+
# Try 2: raw JSON (new attestation-service sidecar format)
405+
if [ "$INF_DECODED" = "false" ] && echo "$ATTESTATION" | jq -e . &>/dev/null 2>&1; then
406+
INF_EVIDENCE=$(echo "$ATTESTATION" | jq -r 'if has("evidence") then .evidence else . end' 2>/dev/null)
407+
if [ -n "$INF_EVIDENCE" ] && echo "$INF_EVIDENCE" | jq -e . &>/dev/null 2>&1; then
408+
echo "$INF_EVIDENCE" > "$INF_EVIDENCE_FILE"
409+
INF_DECODED=true
410+
fi
411+
fi
412+
if [ "$INF_DECODED" = "true" ]; then
395413
# Verify with attestation-cli if available
396414
if [ -n "$ATTESTATION_CLI" ]; then
397415
INF_VERIFY_RESULT=$($ATTESTATION_CLI verify -e "$INF_EVIDENCE_FILE" 2>/dev/null) || true
@@ -413,7 +431,7 @@ cmd_verify() {
413431
INF_ATTEST_OK=true # don't fail if CLI is missing
414432
fi
415433
else
416-
echo " Lunal Upstream Attestation: present but could not decode (base64+gzip)"
434+
echo " Lunal Upstream Attestation: present but could not decode (expected base64+gzip or JSON)"
417435
fi
418436
rm -f "$INF_EVIDENCE_FILE"
419437
else

0 commit comments

Comments
 (0)