Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error messages for failures #267

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/rekor/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ func MatchedIndices(logEntries []models.LogEntry, mvs MonitoredValues) ([]Identi

verifiers, err := extractVerifiers(&entry)
if err != nil {
return nil, err
return nil, fmt.Errorf("error extracting verifiers for UUID %s at index %d: %w", uuid, *entry.LogIndex, err)
}
subjects, certs, fps, err := extractAllIdentities(verifiers)
if err != nil {
return nil, err
return nil, fmt.Errorf("error extracting identities for UUID %s at index %d: %w", uuid, *entry.LogIndex, err)
}

for _, monitoredFp := range mvs.Fingerprints {
Expand All @@ -130,7 +130,7 @@ func MatchedIndices(logEntries []models.LogEntry, mvs MonitoredValues) ([]Identi
for _, cert := range certs {
match, sub, iss, err := certMatchesPolicy(cert, monitoredCertID.CertSubject, monitoredCertID.Issuers)
if err != nil {
return nil, err
return nil, fmt.Errorf("error with policy matching for UUID %s at index %d: %w", uuid, *entry.LogIndex, err)
} else if match {
matchedEntries = append(matchedEntries, IdentityEntry{
CertSubject: sub,
Expand All @@ -145,7 +145,7 @@ func MatchedIndices(logEntries []models.LogEntry, mvs MonitoredValues) ([]Identi
for _, monitoredSub := range mvs.Subjects {
regex, err := regexp.Compile(monitoredSub)
if err != nil {
return nil, err
return nil, fmt.Errorf("error compiling regex for UUID %s at index %d: %w", uuid, *entry.LogIndex, err)
}
for _, sub := range subjects {
if regex.MatchString(sub) {
Expand Down
Loading