diff --git a/0001-Proper-exception-handling-in-tornado_requests.patch b/0001-Proper-exception-handling-in-tornado_requests.patch new file mode 100644 index 0000000..64f25d8 --- /dev/null +++ b/0001-Proper-exception-handling-in-tornado_requests.patch @@ -0,0 +1,37 @@ +From 6c015819dffaafd6450916ac3028b446e9e36313 Mon Sep 17 00:00:00 2001 +From: George Almasi +Date: Sat, 8 Oct 2022 14:10:00 +0000 +Subject: [PATCH] Proper exception handling in tornado_requests + +Signed-off-by: George Almasi +--- + keylime/tornado_requests.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/keylime/tornado_requests.py b/keylime/tornado_requests.py +index 67c03ab..9485c33 100644 +--- a/keylime/tornado_requests.py ++++ b/keylime/tornado_requests.py +@@ -32,7 +32,6 @@ async def request(method, url, params=None, data=None, context=None, headers=Non + except httpclient.HTTPError as e: + if e.response is None: + return TornadoResponse(500, str(e)) +- + return TornadoResponse(e.response.code, e.response.body) + except ConnectionError as e: + return TornadoResponse(599, f"Connection error: {str(e)}") +@@ -40,8 +39,10 @@ async def request(method, url, params=None, data=None, context=None, headers=Non + return TornadoResponse(599, f"SSL connection error: {str(e)}") + except OSError as e: + return TornadoResponse(599, f"TCP/IP Connection error: {str(e)}") ++ except Exception as e: ++ return TornadoResponse(599, f"General communication failure: {str(e)}") + if response is None: +- return None ++ return TornadoResponse(599, "Unspecified failure in tornado (empty http response)") + return TornadoResponse(response.code, response.body) + + +-- +2.38.1 + diff --git a/keylime.spec b/keylime.spec index c5f99e9..db22c32 100644 --- a/keylime.spec +++ b/keylime.spec @@ -18,6 +18,8 @@ Source1: %{srcname}.sysusers # The selinux policy for keylime is distributed via this repo: https://github.com/RedHat-SP-Security/keylime-selinux Source2: https://github.com/RedHat-SP-Security/%{name}-selinux/archive/v%{policy_version}/keylime-selinux-%{policy_version}.tar.gz +Patch: 0001-Proper-exception-handling-in-tornado_requests.patch + # Main program: BSD # Icons: MIT License: ASL 2.0 and MIT