Skip to content

Commit b4dc7c2

Browse files
aaunario-keepersk-keeper
authored andcommitted
add support for 1) config settings "unmask_all" and "fail_on_throttle" and 2) corresponding "--unmask-all" and "--fail-on-throttle" CLI flags
1 parent 9844e7a commit b4dc7c2

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

keepercommander/__main__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ def get_shortcut_config():
112112
if isinstance(on_throttle, bool):
113113
params.rest_context._fail_on_throttle = on_throttle
114114

115+
unmask_all = params.config.get('unmask_all')
116+
if isinstance(unmask_all, bool):
117+
params.unmask_all = unmask_all
118+
115119
except Exception as e:
116120
logging.error('Unable to parse JSON configuration file "%s"', params.config_filename)
117121
answer = input('Do you want to delete it (y/N): ')
@@ -147,6 +151,11 @@ def usage(m):
147151
help='Indicates that the app was launched using a shortcut, for example using Mac App or from '
148152
'Windows Start Menu.')
149153
parser.add_argument('--proxy', dest='proxy', action='store', help='Proxy server..')
154+
unmask_help = 'Disable default masking of sensitive information (e.g., passwords) in output'
155+
parser.add_argument('--unmask-all', action='store_true', help=unmask_help)
156+
fail_on_throttle_help = 'Disable default client-side pausing of command execution and re-sending of requests upon ' \
157+
'server-side throttling'
158+
parser.add_argument('--fail-on-throttle', action='store_true', help=fail_on_throttle_help)
150159
parser.add_argument('command', nargs='?', type=str, action='store', help='Command')
151160
parser.add_argument('options', nargs='*', action='store', help='Options')
152161
parser.error = usage
@@ -190,6 +199,12 @@ def main(from_package=False):
190199
if opts.user:
191200
params.user = opts.user
192201

202+
if opts.unmask_all:
203+
params.unmask_all = opts.unmask_all
204+
205+
if opts.fail_on_throttle:
206+
params.rest_context._fail_on_throttle = opts.fail_on_throttle
207+
193208
if opts.password:
194209
params.password = opts.password
195210
else:

keepercommander/commands/record.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ def execute(self, params, **kwargs):
339339
elif fmt == 'password':
340340
print(r.password)
341341
else:
342+
unmask = params.unmask_all or kwargs.get('unmask')
342343
if version < 3:
343-
r.display(unmask=kwargs.get('unmask', False))
344+
r.display(unmask=unmask)
344345
else:
345-
recordv3.RecordV3.display(rec, **{'params': params, 'format': fmt, 'unmask': kwargs.get('unmask')})
346+
recordv3.RecordV3.display(rec, **{'params': params, 'format': fmt, 'unmask': unmask})
346347

347348
folders = [get_folder_path(params, x) for x in find_folders(params, uid)]
348349
for i in range(len(folders)):

keepercommander/params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def __init__(self, config_filename='', config=None, server='keepersecurity.com',
160160
self.sso_login_info = None
161161
self.__proxy = None
162162
self.ssh_agent = None
163+
self.unmask_all = False
163164

164165
def clear_session(self):
165166
self.auth_verifier = None
@@ -215,6 +216,7 @@ def clear_session(self):
215216
self.breach_watch = None
216217
self.breach_watch_records = None
217218
self.sso_login_info = None
219+
self.unmask_all = False
218220
if self.ssh_agent:
219221
self.ssh_agent.close()
220222
self.ssh_agent = None

0 commit comments

Comments
 (0)