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

View File

@ -77,7 +77,10 @@ class ReceiverId(object):
return Key(keyString) return Key(keyString)
except KeyException as e: except KeyException as e:
logger.error(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] 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] matching_keys = [key for key in keys if key.source == challenge.source and key.id == challenge.id]
if matching_keys: if matching_keys: