tidb sensitive 源码

  • 2022-09-19
  • 浏览 (309)

tidb sensitive 代码

文件路径:/br/pkg/utils/sensitive.go

// 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
}

相关信息

tidb 源码目录

相关文章

tidb backoff 源码

tidb db 源码

tidb dyn_pprof_other 源码

tidb dyn_pprof_unix 源码

tidb env 源码

tidb json 源码

tidb key 源码

tidb math 源码

tidb misc 源码

tidb permission 源码

0  赞