From c6ab24eb8e2bf02c75d0ffa8447032543eb4ea43 Mon Sep 17 00:00:00 2001 From: "Dr. Jason Breitweg" Date: Tue, 10 Oct 2023 09:50:29 +0200 Subject: [PATCH] Fix dynaconf obfuscation and add AUTH_LDAP_BIND_PASSWORD Signed-off-by: Dr. Jason Breitweg Fixed style issues Signed-off-by: Jason Breitweg jbreitwe@redhat.com Signed-off-by: Dr. Jason Breitweg Fixed yet more linting errors Signed-off-by: Jason Breitweg jbreitwe@redhat.com Signed-off-by: Dr. Jason Breitweg --- sos/report/plugins/pulp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sos/report/plugins/pulp.py b/sos/report/plugins/pulp.py index df007168ac..f5c762f48f 100644 --- a/sos/report/plugins/pulp.py +++ b/sos/report/plugins/pulp.py @@ -170,10 +170,13 @@ def postproc(self): repl = r"\1********" self.do_path_regex_sub("/etc/pulp(.*)(.json$)", jreg, repl) - # obfuscate SECRET_KEY = .. and 'PASSWORD': .. in dynaconf list output - # and also in settings.py + # obfuscate SECRET_KEY = .., 'PASSWORD': .., + # and AUTH_LDAP_BIND_PASSWORD = .. + # in dynaconf list output and also in settings.py # count with option that PASSWORD is with(out) quotes or in capitals - key_pass_re = r"(SECRET_KEY\s*=|(password|PASSWORD)(\"|'|:)+)\s*(\S*)" + key_pass_re = r"((?:SECRET_KEY|AUTH_LDAP_BIND_PASSWORD)" \ + r"(?:\<.+\>)?(\s*=)?|(password|PASSWORD)" \ + r"(\"|'|:)+)\s*(\S*)" repl = r"\1 ********" self.do_path_regex_sub("/etc/pulp/settings.py", key_pass_re, repl) self.do_cmd_output_sub("dynaconf list", key_pass_re, repl)