Skip to content

Commit

Permalink
Improve tcb advisory error test
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Sep 30, 2024
1 parent b1310f5 commit 77591d1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/attestation/attestation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func TestVerifyCertificate(t *testing.T) {
"tcb error with advisories rejected": {
config: func() Config {
config := defaultConfig
config.AcceptedTCBStatuses = []string{"SWHardeningNeeded"}
config.AcceptedAdvisories = []string{"INTEL-SA-0002"}
return config
}(),
Expand Down Expand Up @@ -278,6 +279,25 @@ func TestVerifyCertificate(t *testing.T) {
}, attestation.ErrTCBLevelInvalid
},
},
"report contains tcb advisory parsing error": {
config: func() Config {
config := defaultConfig
config.AcceptedTCBStatuses = []string{"SWHardeningNeeded"}
config.AcceptedAdvisories = []string{"INTEL-SA-0001"}
return config
}(),
verify: func([]byte) (attestation.Report, error) {
return attestation.Report{
Data: quoteData[:],
SecurityVersion: 2,
ProductID: []byte{0x03, 0x00},
SignerID: []byte{0xAB, 0xCD},
TCBStatus: tcbstatus.SWHardeningNeeded,
TCBAdvisoriesErr: assert.AnError,
}, attestation.ErrTCBLevelInvalid
},
wantErr: true,
},
}

for name, tc := range testCases {
Expand Down

0 comments on commit 77591d1

Please sign in to comment.