From fa0f607e0e316cfacc35255ccbec8be0e94ff19e Mon Sep 17 00:00:00 2001 From: Sergey Kolupaev Date: Tue, 3 Sep 2024 15:04:36 -0700 Subject: [PATCH] Unexpected breachwatch status response --- keepercommander/breachwatch.py | 23 +++++++++++++---------- keepercommander/commands/utils.py | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/keepercommander/breachwatch.py b/keepercommander/breachwatch.py index 553050be9..1d32aba02 100644 --- a/keepercommander/breachwatch.py +++ b/keepercommander/breachwatch.py @@ -76,15 +76,16 @@ def scan_passwords(self, params, passwords): results = {} # type: Dict[str, breachwatch_pb2.HashStatus] bw_hashes = {} # type: Dict[bytes, str] for password in passwords: - score = utils.password_score(password) - bw_hash = utils.breach_watch_hash(password) - if score >= 40: - bw_hashes[bw_hash] = password - else: - status = breachwatch_pb2.HashStatus() - status.hash1 = bw_hash - status.breachDetected = True - results[password] = status + if isinstance(password, str) and len(password) > 0: + score = utils.password_score(password) + bw_hash = utils.breach_watch_hash(password) + if score >= 40: + bw_hashes[bw_hash] = password + else: + status = breachwatch_pb2.HashStatus() + status.hash1 = bw_hash + status.breachDetected = True + results[password] = status if len(bw_hashes) > 0: logging.info('Breachwatch: %d passwords to scan', len(bw_hashes)) hashes = [] # type: List[breachwatch_pb2.HashCheck] @@ -103,7 +104,9 @@ def scan_passwords(self, params, passwords): rs = self._execute_status(rq) for status in rs.hashStatus: - results[bw_hashes[status.hash1]] = status + password = bw_hashes.get(status.hash1) + if isinstance(password, str) and len(password) > 0: + results[password] = status for password in results: yield password, results[password] diff --git a/keepercommander/commands/utils.py b/keepercommander/commands/utils.py index 9a5934bc8..7e81d62c7 100644 --- a/keepercommander/commands/utils.py +++ b/keepercommander/commands/utils.py @@ -762,6 +762,7 @@ def execute(self, params, **kwargs): SyncSecurityDataCommand().execute(params, record='@all', suppress_no_op=True) except Exception as e: logging.warning(f'A problem was encountered while updating BreachWatch/security data: {e}') + logging.debug(e, exc_info=True) class CheckEnforcementsCommand(Command):