Skip to content

Commit

Permalink
Check nil key shouldn't validate signature
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Smith <nathan@chainguard.dev>
  • Loading branch information
Nathan Smith committed May 13, 2022
1 parent 20db4b0 commit 76edd42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/challenges/challenges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,11 @@ func TestCheckSignatureECDSA(t *testing.T) {
t.Fatal(err)
}

// Nil key should fail
if err := CheckSignature(nil, signature, email); err == nil {
t.Error("nil public key should raise error")
}

// Try a bad email but "good" signature
if err := CheckSignature(&priv.PublicKey, signature, "bad@email.com"); err == nil {
t.Fatal("check should have failed")
Expand Down

0 comments on commit 76edd42

Please sign in to comment.