Skip to content

Commit

Permalink
use correct error on banned (#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
woutslakhorst authored Jul 14, 2023
1 parent 8aa3d9b commit c3f476c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pki/denylist.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (b *denylistImpl) ValidateCert(cert *x509.Certificate) error {
Debug("Rejecting banned certificate")

// Return an error indicating the certificate has been denylisted
return fmt.Errorf("%w: %s", ErrCertBanned, entry.Reason)
return ErrCertBanned
}
}

Expand Down
4 changes: 2 additions & 2 deletions pki/denylist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ func TestDenylistedCertificateBlocked(t *testing.T) {

// Ensure the validation returned an error, meaning the certificate is banned
assert.Error(t, err)
assert.Equal(t, fmt.Errorf("%w: %s", ErrCertBanned, "baz3"), err)
assert.Equal(t, ErrCertBanned, err)
}

// TestEmptyFieldsDoNotBlock ensures empty fields in a denylist entry cannot block certificates
Expand Down Expand Up @@ -456,7 +456,7 @@ func TestEmptyFieldsDoNotBlock(t *testing.T) {

// Ensure the validation returned an error, meaning the certificate is banned
assert.Error(t, err)
assert.Equal(t, fmt.Errorf("%w: %s", ErrCertBanned, "baz3"), err)
assert.Equal(t, ErrCertBanned, err)
}

// TestRSACertificateJWKThumbprint ensures ceritficate thumbprints are correctly computed
Expand Down

0 comments on commit c3f476c

Please sign in to comment.