(params, record)
| 109 | return ssd |
| 110 | |
| 111 | def needs_security_audit(params, record): # type: (KeeperParams, KeeperRecord) -> bool |
| 112 | if not params.enterprise_ec_key or not record: |
| 113 | return False |
| 114 | |
| 115 | saved_score_data = params.security_score_data.get(record.record_uid, {}) |
| 116 | saved_sec_data = params.breach_watch_security_data.get(record.record_uid, {}) |
| 117 | score_data = saved_score_data.get('data', {}) |
| 118 | score_revision = saved_score_data.get('revision') |
| 119 | sec_revision = saved_sec_data.get('revision') |
| 120 | current_password = _get_pass(record) |
| 121 | if current_password != score_data.get('password'): |
| 122 | return True |
| 123 | |
| 124 | scores = dict(new=get_security_score(record) or 0, old=score_data.get('score', 0)) |
| 125 | score_changed_on_passkey = any(x >= 100 for x in scores.values()) and any(x < 100 for x in scores.values()) |
| 126 | creds_removed = bool(scores.get('old') and not scores.get('new')) |
| 127 | needs_alignment = current_password is not None and score_revision != sec_revision |
| 128 | return score_changed_on_passkey or creds_removed or needs_alignment |
| 129 | |
| 130 | def update_security_audit_data(params, records): # type: (KeeperParams, List[KeeperRecord]) -> int |
| 131 | if not params.enterprise_ec_key: |
no test coverage detected