🐛 Fix missing fields on deleted passwords

How a deleted record remains in the logins.json file isn't clear
but we should now handle the missing information gracefully.

Fixes #99
This commit is contained in:
Renato Alves
2023-11-08 21:35:57 +01:00
parent ae46381c19
commit f95996e3d2

View File

@@ -194,12 +194,17 @@ class JsonCredentials(Credentials):
raise Exit(Exit.BAD_SECRETS)
for i in logins:
yield (
i["hostname"],
i["encryptedUsername"],
i["encryptedPassword"],
i["encType"],
)
try:
yield (
i["hostname"],
i["encryptedUsername"],
i["encryptedPassword"],
i["encType"],
)
except KeyError:
# This should handle deleted passwords that still maintain
# a record in the JSON file - GitHub issue #99
LOG.info(f"Skipped record {i} due to missing fields")
def find_nss(locations, nssname) -> ct.CDLL: