Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #1279

Merged
merged 6 commits into from
Jul 24, 2024
Merged

Release #1279

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keepercommander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# Contact: ops@keepersecurity.com
#

__version__ = '16.11.7'
__version__ = '16.11.8'
9 changes: 1 addition & 8 deletions keepercommander/commands/aram.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,14 +1710,7 @@ def parse_date(date_str):

cutoff_date = kwargs.get('cutoff_date')
period = kwargs.get('period')
if cutoff_date is not None:
cutoff_date = parse_date(cutoff_date)
dt = cutoff_date
elif period is not None:
dt = get_floor(period)
else:
return

dt = parse_date(cutoff_date) if cutoff_date else get_floor(period)
period_min_ts = int(dt.timestamp())

rebuild = kwargs.get('rebuild')
Expand Down
26 changes: 23 additions & 3 deletions keepercommander/commands/security_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from json import JSONDecodeError
from typing import Dict, List, Optional, Any
from charset_normalizer import detect, from_bytes

from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey

Expand Down Expand Up @@ -346,14 +347,33 @@ def decrypt_security_data(sec_data, k): # type: (bytes, RSAPrivateKey) -> Dict[
decrypted = None
if sec_data:
try:
decrypted = crypto.decrypt_rsa(sec_data, k, apply_padding=True)
decrypted_bytes = crypto.decrypt_rsa(sec_data, k, apply_padding=True)
except Exception as e:
error = f'Decrypt fail (incremental data): {e}'
self.get_error_report_builder().update_report_data(error)
return decrypted
return

try:
decrypted = json.loads(decrypted.decode())
decoded = decrypted_bytes.decode()
except UnicodeDecodeError as ude:
error = f'Failed to decode incremental data: {decrypted_bytes}'
self.get_error_report_builder().update_report_data(error)
try:
detected_encoding = detect(decrypted_bytes).get('encoding')
decoded_guess = from_bytes(decrypted_bytes).best().output()
detected_encoding_msg = f'Using detected encoding ({detected_encoding}), decoded = {decoded_guess}'
self.get_error_report_builder().update_report_data(detected_encoding_msg)
except:
pass

return
except Exception as e:
error = f'Decode fail: {e}'
self.get_error_report_builder().update_report_data(error)
return

try:
decrypted = json.loads(decoded)
except Exception as e:
reason = f"Invalid JSON: {e.doc}" if isinstance(e, JSONDecodeError) else e
error = f'Load fail (incremental data). {reason}'
Expand Down
2 changes: 0 additions & 2 deletions keepercommander/importer/imp_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,8 +2135,6 @@ def prepare_record_add_or_update(update_flag, params, records):
for import_record in record_to_import:
if not import_record.type:
continue
if import_record.schema:
continue
record_type = import_record.type
if record_type in record_types:
fields = record_types[record_type].get('fields') or []
Expand Down
2 changes: 2 additions & 0 deletions keepercommander/importer/json/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def json_to_record(j_record): # type: (Dict[str, Any]) -> Optional[Record]
if 'schema' in j_record:
record.schema = []
for s in j_record['schema']:
if s.endswith(':1'):
s = s[:-2]
pos = s.find(':')
if pos > 0:
schema_ref = s[0:pos].strip()
Expand Down
Loading