guard against the case where receiver_keys are missing in the

configuration
This commit is contained in:
Jakob Ketterl 2020-10-16 22:53:57 +02:00
parent 93f7195429
commit 1bc3830e5e
1 changed files with 4 additions and 1 deletions

View File

@ -77,7 +77,10 @@ class ReceiverId(object):
return Key(keyString)
except KeyException as e:
logger.error(e)
keys = [parseKey(keyString) for keyString in Config.get()['receiver_keys']]
config = Config.get()
if "receiver_keys" not in config or config["receiver_keys"] is None:
return None
keys = [parseKey(keyString) for keyString in config["receiver_keys"]]
keys = [key for key in keys if key is not None]
matching_keys = [key for key in keys if key.source == challenge.source and key.id == challenge.id]
if matching_keys: