mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
committed by
GitHub
parent
fdc2f69218
commit
878bc6c72b
@@ -23,6 +23,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -80,6 +81,17 @@ func (r *recordRequest) Data() []byte {
|
||||
return logger.BodyPlaceHolder
|
||||
}
|
||||
|
||||
var ldapPwdRegex = regexp.MustCompile("(^.*?)LDAPPassword=([^&]*?)(&(.*?))?$")
|
||||
|
||||
// redact LDAP password if part of string
|
||||
func redactLDAPPwd(s string) string {
|
||||
parts := ldapPwdRegex.FindStringSubmatch(s)
|
||||
if len(parts) > 0 {
|
||||
return parts[1] + "LDAPPassword=*REDACTED*" + parts[3]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// getOpName sanitizes the operation name for mc
|
||||
func getOpName(name string) (op string) {
|
||||
op = strings.TrimPrefix(name, "github.com/minio/minio/cmd.")
|
||||
@@ -129,7 +141,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
|
||||
Proto: r.Proto,
|
||||
Method: r.Method,
|
||||
Path: SlashSeparator + pathJoin(vars["bucket"], vars["object"]),
|
||||
RawQuery: r.URL.RawQuery,
|
||||
RawQuery: redactLDAPPwd(r.URL.RawQuery),
|
||||
Client: handlers.GetSourceIP(r),
|
||||
Headers: reqHeaders,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user