Fixed according to comments

This commit is contained in:
Jovan Djukic
2026-05-04 23:49:02 +02:00
parent 1d71f9fb88
commit 12b3b61e8b
2 changed files with 12 additions and 0 deletions
+3
View File
@@ -125,6 +125,9 @@ func (v *verifier) VerifyWithCoRIM(report []byte, manifest *corim.UnsignedCorim)
if err := json.Unmarshal(resp.ClaimsJSON, &deviceClaims); err != nil {
return fmt.Errorf("gpu: failed to parse claims JSON: %w", err)
}
if len(deviceClaims) == 0 {
return fmt.Errorf("gpu: verifier response contained no device claims")
}
return appraiseGPUClaims(deviceClaims, manifest)
}
+9
View File
@@ -77,6 +77,9 @@ func TestGPUVerifierHelperProcess(t *testing.T) {
case "verifier-invalid-claims-format":
fmt.Fprintln(os.Stdout, `{"claims_json":[1,2,3]}`)
os.Exit(0)
case "verifier-empty-device-claims":
fmt.Fprintln(os.Stdout, `{"claims_json":{}}`)
os.Exit(0)
default:
var req helperRequest
if err := json.NewDecoder(os.Stdin).Decode(&req); err != nil {
@@ -196,6 +199,12 @@ func TestVerifierVerifyWithCoRIMErrors(t *testing.T) {
report: []byte(`[{"nonce":"aabbcc"}]`),
wantError: "gpu: failed to parse claims JSON",
},
{
name: "empty device claims",
binary: "verifier-empty-device-claims",
report: []byte(`[{"nonce":"aabbcc"}]`),
wantError: "gpu: verifier response contained no device claims",
},
}
for _, tt := range tests {