From 6e493ca9e15215bde36d9ed16c7e00b2de673844 Mon Sep 17 00:00:00 2001 From: kaniini Date: Wed, 31 Oct 2018 02:12:35 +0000 Subject: [PATCH] http signatures: handle fetch_actor_key failure more gracefully --- relay/http_signatures.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/relay/http_signatures.py b/relay/http_signatures.py index 683fe77..6ccdd65 100644 --- a/relay/http_signatures.py +++ b/relay/http_signatures.py @@ -60,11 +60,14 @@ def sign_headers(headers, key, key_id): async def fetch_actor_key(actor): actor_data = await fetch_actor(actor) + if not actor_data: + return None + if 'publicKey' not in actor_data: - return None + return None if 'publicKeyPem' not in actor_data['publicKey']: - return None + return None return RSA.importKey(actor_data['publicKey']['publicKeyPem'])