Merge pull request #9578 from cli/bundle-panic
Check for nil values to prevent nil dereference panic
This commit is contained in:
commit
3b7b7a4752
1 changed files with 8 additions and 0 deletions
|
|
@ -307,11 +307,19 @@ func buildTableVerifyContent(results []*verification.AttestationProcessingResult
|
|||
content := make([][]string, len(results))
|
||||
|
||||
for i, res := range results {
|
||||
if res.VerificationResult == nil ||
|
||||
res.VerificationResult.Signature == nil ||
|
||||
res.VerificationResult.Signature.Certificate == nil {
|
||||
return nil, fmt.Errorf("bundle missing verification result fields")
|
||||
}
|
||||
builderSignerURI := res.VerificationResult.Signature.Certificate.Extensions.BuildSignerURI
|
||||
repoAndOrg, workflow, err := extractAttestationDetail(builderSignerURI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if res.VerificationResult.Statement == nil {
|
||||
return nil, fmt.Errorf("bundle missing attestation statement (bundle must originate from GitHub Artifact Attestations)")
|
||||
}
|
||||
predicateType := res.VerificationResult.Statement.PredicateType
|
||||
content[i] = []string{repoAndOrg, predicateType, workflow}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue