From ad98dbfb330afe22c1ca256e936b8289fb97399d Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 19 Sep 2018 10:27:45 +1000 Subject: [PATCH] Mask password when specified as an argument with a space I was using a command line like $ openstack user password set --password "p" --original-password="x" and saw the --password argument echoed in the info log START with options: ['-v', ..., 'user', 'password', 'set', '--password', 'p', '--original-password=***'] The masking works if you set "--password=p", but not "--password p". This is because the password matching regex doesn't know they're related. An easy way to avoid this is to just make the whole log line back into a single string, and this gets masked correctly. Change-Id: I0fdd895c9449d9a90d811af4ded34f32ba2b2215 --- osc_lib/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osc_lib/shell.py b/osc_lib/shell.py index 45c457b..d880fe3 100644 --- a/osc_lib/shell.py +++ b/osc_lib/shell.py @@ -395,7 +395,7 @@ class OpenStackShell(app.App): # Parent __init__ parses argv into self.options super(OpenStackShell, self).initialize_app(argv) self.log.info("START with options: %s", - strutils.mask_password(self.command_options)) + strutils.mask_password(" ".join(self.command_options))) self.log.debug("options: %s", strutils.mask_password(self.options))