Skip to content

Commit

Permalink
always increment counter for rekor prober
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway committed Nov 1, 2023
1 parent 2f5659f commit 0ad3d0e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/prober/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ func fulcioWriteEndpoint(ctx context.Context, priv *ecdsa.PrivateKey) (*x509.Cer
// if a certificate is provided, the Rekor entry will contain that certificate,
// otherwise the provided key is used
func rekorWriteEndpoint(ctx context.Context, cert *x509.Certificate, priv *ecdsa.PrivateKey) error {
verified := "false"
endpoint := rekorEndpoint
hostPath := rekorURL + endpoint
defer func() {
verificationCounter.With(prometheus.Labels{verifiedLabel: verified}).Inc()
}()

body, err := rekorEntryRequest(cert, priv)
if err != nil {
Expand Down Expand Up @@ -170,15 +174,13 @@ func rekorWriteEndpoint(ctx context.Context, cert *x509.Certificate, priv *ecdsa
logEntryAnon = e
break
}
verified := "true"
rekorPubKeys, err := cosign.GetRekorPubs(ctx)
if err != nil {
return fmt.Errorf("getting rekor public keys: %w", err)
}
if err = cosign.VerifyTLogEntryOffline(ctx, &logEntryAnon, rekorPubKeys); err != nil {
verified = "false"
if err = cosign.VerifyTLogEntryOffline(ctx, &logEntryAnon, rekorPubKeys); err == nil {
verified = "true"
}
verificationCounter.With(prometheus.Labels{verifiedLabel: verified}).Inc()
return err
}

Expand Down

0 comments on commit 0ad3d0e

Please sign in to comment.