Skip to content

Commit 05c9303

Browse files
authored
Merge pull request #119 from deeglaze/nilvalidate
Add some nil checking to validate.go
2 parents 606477d + c50f298 commit 05c9303

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

validate/validate.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,21 @@ func validateKeys(report *spb.Report, options *Options) error {
612612
}
613613

614614
func validateKeyKind(report *spb.Attestation) (*x509.Certificate, error) {
615+
if report == nil {
616+
return nil, fmt.Errorf("attestation cannot be nil")
617+
}
618+
if report.GetReport() == nil {
619+
return nil, fmt.Errorf("attestation report cannot be nil")
620+
}
621+
if report.GetCertificateChain() == nil {
622+
return nil, fmt.Errorf("attestation certificate chain cannot be nil")
623+
}
624+
615625
info, err := abi.ParseSignerInfo(report.GetReport().GetSignerInfo())
616626
if err != nil {
617627
return nil, err
618628
}
629+
619630
switch info.SigningKey {
620631
case abi.VcekReportSigner:
621632
if len(report.GetCertificateChain().VcekCert) != 0 {

0 commit comments

Comments
 (0)