[rtems-tools commit] rtemstoolkit: Filter mail options from log output
Joel Sherrill
joel at rtems.org
Thu Dec 16 21:26:47 UTC 2021
Module: rtems-tools
Branch: 5
Commit: 6759c3ce837a43cd2047e5c162891d780fb9246d
Changeset: http://git.rtems.org/rtems-tools/commit/?id=6759c3ce837a43cd2047e5c162891d780fb9246d
Author: Alex White <alex.white at oarcorp.com>
Date: Fri Apr 9 16:52:44 2021 -0500
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 #4553
---
rtemstoolkit/options.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
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):
"""
More information about the vc
mailing list