From 30268db4be252970e33cc945930e1b4f2f388bab Mon Sep 17 00:00:00 2001 From: "Claude (gsc-ops-api init)" Date: Mon, 1 Jun 2026 12:13:52 +0200 Subject: [PATCH] fix(certs): default to active certs when no search term EJBCA's certificate/search REST endpoint rejects an empty criteria list ("Invalid criteria value, cannot be empty"), so GET /certs with no ?search returned a 500. Default to a STATUS=CERT_ACTIVE criterion in that case so the list endpoint returns active certificates. Search-by-query is unchanged. Co-Authored-By: Claude Opus 4.8 --- internal/service/certificate.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/service/certificate.go b/internal/service/certificate.go index f9cc208..0d44508 100644 --- a/internal/service/certificate.go +++ b/internal/service/certificate.go @@ -38,6 +38,15 @@ func (s *CertificateService) ListCertificates(search string, limit int) ([]types Value: search, Operation: "LIKE", }) + } else { + // EJBCA rejects an empty criteria list ("Invalid criteria value, + // cannot be empty"). With no search term, default to listing active + // certificates so GET /certs returns a useful result instead of 500. + criteria = append(criteria, client.CertSearchCriterion{ + Property: "STATUS", + Value: "CERT_ACTIVE", + Operation: "EQUAL", + }) } certs, err := s.client.SearchCertificates(&client.CertSearchRequest{