fix: handle 'not found' errors as 404 in CRL/OCSP handlers

The error routing only checked for "issuer not found" but not
"certificate not found", causing cert-not-found errors to fall
through to a generic 500. Broadened the check to match any
"not found" error string for both CRL and OCSP handlers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Shankar
2026-03-22 19:06:37 -04:00
parent 95c875d769
commit 27f9c8ceb8
+2 -2
View File
@@ -464,7 +464,7 @@ func (h CertificateHandler) GetDERCRL(w http.ResponseWriter, r *http.Request) {
derBytes, err := h.svc.GenerateDERCRL(issuerID)
if err != nil {
errMsg := err.Error()
if strings.Contains(errMsg, "issuer not found") {
if strings.Contains(errMsg, "not found") {
Error(w, http.StatusNotFound, errMsg)
return
}
@@ -504,7 +504,7 @@ func (h CertificateHandler) HandleOCSP(w http.ResponseWriter, r *http.Request) {
derBytes, err := h.svc.GetOCSPResponse(issuerID, serialHex)
if err != nil {
errMsg := err.Error()
if strings.Contains(errMsg, "issuer not found") {
if strings.Contains(errMsg, "not found") {
Error(w, http.StatusNotFound, errMsg)
return
}