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
This commit is contained in:
Ian Wienand 2018-09-19 10:27:45 +10:00
parent b221455f96
commit ad98dbfb33
1 changed files with 1 additions and 1 deletions

View File

@ -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))