Skip to content

Commit

Permalink
Fix missing fields on deleted passwords
Browse files Browse the repository at this point in the history
How a deleted record remains in the logins.json file isn't clear
but we should now handle the missing information gracefully.

Fixes #99
  • Loading branch information
unode committed Nov 8, 2023
1 parent ae46381 commit 3368d99
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions firefox_decrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,17 @@ def __iter__(self) -> Iterator[tuple[str, str, str, int]]:
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:
Expand Down

0 comments on commit 3368d99

Please sign in to comment.