From 096d88bc9b148dbe9f15c6919b9e2e3871a457af Mon Sep 17 00:00:00 2001 From: Kevin Glisson Date: Fri, 26 Jun 2015 16:17:22 -0700 Subject: [PATCH] Ensuring a 404 is returned when we can't find the specified certificate --- lemur/certificates/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index 4bc317f1..1312d665 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -437,6 +437,9 @@ class CertificatePrivateKey(AuthenticatedResource): :statuscode 403: unauthenticated """ cert = service.get(certificate_id) + if not cert: + return dict(message="Cannot find specified certificate"), 404 + role = role_service.get_by_name(cert.owner) permission = ViewKeyPermission(certificate_id, hasattr(role, 'id'))