Redact admin prefix when registering profiling handlers, too

This commit is contained in:
Seednode 2024-01-07 22:25:00 -06:00
parent adaa7378ff
commit de94c5eb49
2 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"net/http/pprof"
"strings"
"time"
"github.com/julienschmidt/httprouter"
@ -16,6 +17,10 @@ import (
func registerProfileHandler(mux *httprouter.Router, verb, path string, handler http.HandlerFunc) {
mux.HandlerFunc(verb, path, handler)
if Redact && AdminPrefix != "" {
path = strings.ReplaceAll(path, AdminPrefix, "/<admin_prefix>")
}
if Handlers {
fmt.Printf("%s | SERVE: Registered handler for %s\n",
time.Now().Format(logDate),

View File

@ -17,7 +17,7 @@ import (
const (
AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "4.0.1"
ReleaseVersion string = "4.0.2"
)
var (