diff --git a/br/pkg/lightning/lightning.go b/br/pkg/lightning/lightning.go index 2db76b1001078..a00ea10efdcfc 100644 --- a/br/pkg/lightning/lightning.go +++ b/br/pkg/lightning/lightning.go @@ -693,8 +693,7 @@ func (l *Lightning) handlePostTask(w http.ResponseWriter, req *http.Request) { writeJSONError(w, http.StatusBadRequest, "cannot read request", err) return } - filteredData := utils.HideSensitive(string(data)) - log.L().Info("received task config", zap.String("content", filteredData)) + log.L().Info("received task config") cfg := config.NewConfig() if err = cfg.LoadFromGlobal(l.globalCfg); err != nil { diff --git a/br/pkg/utils/BUILD.bazel b/br/pkg/utils/BUILD.bazel index c06a452711b9d..3e28195d90d4b 100644 --- a/br/pkg/utils/BUILD.bazel +++ b/br/pkg/utils/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "retry.go", "safe_point.go", "schema.go", - "sensitive.go", "store_manager.go", "suspend_importing.go", "worker.go", @@ -86,11 +85,10 @@ go_test( "retry_test.go", "safe_point_test.go", "schema_test.go", - "sensitive_test.go", ], embed = [":utils"], flaky = True, - shard_count = 33, + shard_count = 32, deps = [ "//br/pkg/errors", "//br/pkg/metautil", diff --git a/br/pkg/utils/sensitive.go b/br/pkg/utils/sensitive.go deleted file mode 100644 index fcc31ee30b78d..0000000000000 --- a/br/pkg/utils/sensitive.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2022 PingCAP, Inc. Licensed under Apache-2.0. - -package utils - -import ( - "regexp" -) - -var ( - passwordPatterns = `(password[\s]*=[\s]*(\\")?)(.*?)((\\")?\\n)` - - passwordRegexp *regexp.Regexp -) - -func init() { - passwordRegexp = regexp.MustCompile(passwordPatterns) -} - -// HideSensitive replace password with ******. -func HideSensitive(input string) string { - output := passwordRegexp.ReplaceAllString(input, "$1******$4") - return output -} diff --git a/br/pkg/utils/sensitive_test.go b/br/pkg/utils/sensitive_test.go deleted file mode 100644 index a14ce0619eb85..0000000000000 --- a/br/pkg/utils/sensitive_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2022 PingCAP, Inc. Licensed under Apache-2.0. - -package utils - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestHideSensitive(t *testing.T) { - strs := []struct { - old string - new string - }{ - { - `host = "127.0.0.1"\n user = "root"\n password = "/Q7B9DizNLLTTfiZHv9WoEAKamfpIUs="\n port = 3306\n`, - `host = "127.0.0.1"\n user = "root"\n password = ******\n port = 3306\n`, - }, - { - `host = "127.0.0.1"\n user = "root"\n password = ""\n port = 3306\n`, - `host = "127.0.0.1"\n user = "root"\n password = ******\n port = 3306\n`, - }, - { - `host = "127.0.0.1"\n user = "root"\n password= "/Q7B9DizNLLTTfiZHv9WoEAKamfpIUs="\n port = 3306\n`, - `host = "127.0.0.1"\n user = "root"\n password= ******\n port = 3306\n`, - }, - { - `host = "127.0.0.1"\n user = "root"\n password =""\n port = 3306\n`, - `host = "127.0.0.1"\n user = "root"\n password =******\n port = 3306\n`, - }, - { - `host = "127.0.0.1"\n user = "root"\n password=""\n port = 3306\n`, - `host = "127.0.0.1"\n user = "root"\n password=******\n port = 3306\n`, - }, - } - for i, str := range strs { - t.Logf("case #%d\n", i) - require.Equal(t, str.new, HideSensitive(str.old)) - } -}