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

KC-817: LoginCommand fix/improvements #1296

Merged
merged 4 commits into from
Aug 29, 2024
Merged
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.11'
__version__ = '16.11.12'
20 changes: 15 additions & 5 deletions keepercommander/commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,15 @@ def execute(self, params, **kwargs):

if params.session_token:
SyncDownCommand().execute(params, force=True)
if params.breach_watch:
BreachWatchScanCommand().execute(params, suppress_no_op=True)
if params.enterprise_ec_key:
SyncSecurityDataCommand().execute(params, record='@all', suppress_no_op=True)
if params.is_enterprise_admin:
api.query_enterprise(params, True)
try:
if params.breach_watch:
BreachWatchScanCommand().execute(params, suppress_no_op=True)
if params.enterprise_ec_key:
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}')


class CheckEnforcementsCommand(Command):
Expand Down Expand Up @@ -1328,7 +1331,12 @@ def get_security_data(record, pw_obj): # type: (KeeperRecord, Dict or None)
# truncate domain string if needed to avoid reaching RSA encryption data size limitation
sd_data['domain'] = domain[:200]
if sd_data:
sd.data = crypto.encrypt_rsa(json.dumps(sd_data).encode('utf-8'), params.enterprise_rsa_key)
try:
sd.data = crypto.encrypt_rsa(json.dumps(sd_data).encode('utf-8'), params.enterprise_rsa_key)
except Exception as e:
logging.error(f'Error: {e}')
logging.error(f'Enterprise RSA key length = {params.enterprise_rsa_key.key_size}')
return
sd.uid = utils.base64_url_decode(record.record_uid)
return sd

Expand Down Expand Up @@ -1389,6 +1397,8 @@ def has_stale_security_data(record):
to_update = [(r, p) for r, p in to_update if has_stale_security_data(r)]

sds = [get_security_data(r, s) for r, s in to_update] if to_update else []
# Remove empty security-data update requests (resulting from failed RSA encryption)
sds = [sd for sd in sds if sd]
while sds:
update_security_data(sds[:update_limit])
sds = sds[update_limit:]
Expand Down
Loading