Skip to content

Commit

Permalink
Don't try to index on hash for intoto obj if one isn't available (#800)
Browse files Browse the repository at this point in the history
Signed-off-by: Priya Wadhwa <priya@chainguard.dev>
  • Loading branch information
priyawadhwa authored Apr 30, 2022
1 parent 3a2deb6 commit 6876090
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/types/intoto/v0.0.1/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func (v V001Entry) IndexKeys() ([]string, error) {

switch v.env.PayloadType {
case in_toto.PayloadType:
if v.IntotoObj.Content == nil || v.IntotoObj.Content.Hash == nil {
log.Logger.Info("IntotoObj content or hash is nil")
return result, nil
}
hashkey := strings.ToLower(fmt.Sprintf("%s:%s", *v.IntotoObj.Content.Hash.Algorithm, *v.IntotoObj.Content.Hash.Value))
result = append(result, hashkey)

Expand Down

0 comments on commit 6876090

Please sign in to comment.