Skip to content

Commit

Permalink
Unexpected breachwatch status response
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-keeper committed Sep 3, 2024
1 parent 519bbae commit fa0f607
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
23 changes: 13 additions & 10 deletions keepercommander/breachwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
1 change: 1 addition & 0 deletions keepercommander/commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit fa0f607

Please sign in to comment.