Skip to content

Commit

Permalink
Verify: check if summary is nil before accessing cert. (#43)
Browse files Browse the repository at this point in the history
Before, if we returned (nil, err), this would panic. This change adds an
extra check to make sure that summary.Cert can be safely accessed.

Signed-off-by: Billy Lynch <billy@chainguard.dev>
  • Loading branch information
wlynch committed May 24, 2022
1 parent 01b9cc3 commit 05dd77d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion command_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func verifyDetached() error {

summary, err := git.Verify(context.Background(), rekor, buf.Bytes(), sig.Bytes())
if err != nil {
if summary.Cert != nil {
if summary != nil && summary.Cert != nil {
emitBadSig(summary.Cert)
} else {
// TODO: We're omitting a bunch of arguments here.
Expand Down

0 comments on commit 05dd77d

Please sign in to comment.