(params, record_uids)
| 1173 | |
| 1174 | |
| 1175 | def add_record_audit_data(params, record_uids): # type: (KeeperParams, Iterable[str]) -> None |
| 1176 | if not params.enterprise_ec_key: |
| 1177 | return |
| 1178 | |
| 1179 | uids = set((x for x in record_uids if x in params.record_cache)) |
| 1180 | audit_data = [] # type: List[record_pb2.RecordAddAuditData] |
| 1181 | for record_uid in uids: |
| 1182 | record = get_record(params, record_uid) |
| 1183 | if record: |
| 1184 | if record.title: |
| 1185 | title = record.title |
| 1186 | if len(title) > 900: |
| 1187 | title = title[:900] |
| 1188 | audit = record_pb2.RecordAddAuditData() |
| 1189 | audit.record_uid = utils.base64_url_decode(record_uid) |
| 1190 | audit.revision = record.revision |
| 1191 | data = { |
| 1192 | 'title': title, |
| 1193 | 'record_type': record.record_type, |
| 1194 | } |
| 1195 | if record.login_url: |
| 1196 | data['url'] = utils.url_strip(record.login_url) |
| 1197 | audit.data = crypto.encrypt_ec(json.dumps(data).encode('utf-8'), params.enterprise_ec_key) |
| 1198 | audit_data.append(audit) |
| 1199 | |
| 1200 | if audit_data: |
| 1201 | rq = record_pb2.AddAuditDataRequest() |
| 1202 | rq.records.extend(audit_data) |
| 1203 | try: |
| 1204 | communicate_rest(params, rq, 'vault/record_add_audit_data') |
| 1205 | except Exception as e: |
| 1206 | logging.info('Failed to store audit data: %s', str(e)) |
| 1207 | |
| 1208 | |
| 1209 | def add_record_v3(params, record, **kwargs): # type: (KeeperParams, dict, ...) -> Optional[bool] |
no test coverage detected