diff options
author | Alex White <alex.white@oarcorp.com> | 2021-04-09 16:52:44 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-04-13 16:44:42 -0500 |
commit | 92f7f67297b9053e6846760e6c8059be0fa1c86c (patch) | |
tree | dae5b26599e9043dacf737ad7441418794a9f009 | |
parent | rtemstoolkit/mailer.py: Return full smtp-host arg value (diff) | |
download | rtems-tools-92f7f67297b9053e6846760e6c8059be0fa1c86c.tar.bz2 |
rtemstoolkit: Filter mail options from log output
This filters mail-related options out before logging the command line
options. This is needed to prevent leaking potentially sensitive
information via logs and emails.
Updates #4384
-rw-r--r-- | rtemstoolkit/options.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/rtemstoolkit/options.py b/rtemstoolkit/options.py index 32a7016..5ebe3bc 100644 --- a/rtemstoolkit/options.py +++ b/rtemstoolkit/options.py @@ -508,7 +508,22 @@ class command_line(object): return None def log_info(self): - log.output(log.info(self.argv)) + # Filter potentially sensitive mail options out. + filtered_args = [ + arg for arg in self.argv + if all( + smtp_opt not in arg + for smtp_opt in [ + '--smtp-host', + '--mail-to', + '--mail-from', + '--smtp-user', + '--smtp-password', + '--smtp-port' + ] + ) + ] + log.output(log.info(filtered_args)) def load(opts): """ |