From 1ddf75240d15d6bbc3d06ee27aa025ae86a0d599 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Thu, 8 Oct 2015 15:13:21 +0100 Subject: [PATCH] config: Don't hide username, it's not secret. Usernames are not generally considered to be secrets, and treating them as secrets may lead to confusion as to how secure they are. Obscuring them also makes debugging harder. --- config/config.go | 2 +- config/config_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index dd482ad2f..2be3524d1 100644 --- a/config/config.go +++ b/config/config.go @@ -33,7 +33,7 @@ var ( patJobName = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_-]*$`) patFileSDName = regexp.MustCompile(`^[^*]*(\*[^/]*)?\.(json|yml|yaml|JSON|YML|YAML)$`) patRulePath = regexp.MustCompile(`^[^*]*(\*[^/]*)?$`) - patAuthLine = regexp.MustCompile(`((?:username|password|bearer_token|secret_key):\s+)(".+"|'.+'|[^\s]+)`) + patAuthLine = regexp.MustCompile(`((?:password|bearer_token|secret_key):\s+)(".+"|'.+'|[^\s]+)`) ) // Load parses the YAML input s into a Config. diff --git a/config/config_test.go b/config/config_test.go index 053e94c21..28324c97a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -282,7 +282,7 @@ func TestLoadConfig(t *testing.T) { // String method must not reveal authentication credentials. s := c.String() - if strings.Contains(s, "admin_name") || strings.Contains(s, "admin_password") { + if strings.Contains(s, "admin_password") { t.Fatalf("config's String method reveals authentication credentials.") } }