mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
lib/flagutil: do not expose sensitive info (passwords, keys and urls) at /flags page
This commit is contained in:
parent
8ad95f0db7
commit
8991c8b589
@ -4,12 +4,17 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// WriteFlags writes all the explicitly set flags to w.
|
||||
func WriteFlags(w io.Writer) {
|
||||
flag.Visit(func(f *flag.Flag) {
|
||||
lname := strings.ToLower(f.Name)
|
||||
value := f.Value.String()
|
||||
if IsSecretFlag(lname) {
|
||||
value = "secret"
|
||||
}
|
||||
fmt.Fprintf(w, "-%s=%q\n", f.Name, value)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user