Remove url, uri, host, broker, id from redaction (#4869)

This commit is contained in:
premultiply 2022-10-19 09:28:59 +02:00 • committed by GitHub
parent c4a5e35294
commit fc083a8547
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -50,11 +50,11 @@ func unwrap(err error) (res []string) {
// redact redacts a configuration string
func redact(src string) string {
secrets := []string{
"url", "uri", "host", "broker", "mac", // infrastructure
"mac", // infrastructure
"sponsortoken", "plant", // global settings
"user", "password", "pin", // users
"token", "access", "refresh", // tokens
"ain", "id", "secret", "serial", "deviceid", "machineid", // devices
"ain", "secret", "serial", "deviceid", "machineid", // devices
"vin"} // vehicles
return regexp.
MustCompile(fmt.Sprintf(`\b(%s)\b.*?:.*`, strings.Join(secrets, "|"))).

View file

@ -27,8 +27,8 @@ func TestRedact(t *testing.T) {
token:
access: geheim
refresh: geheim
host: geheim
url: geheim
pin: geheim
mac: geheim
secret: geheim # comment
secret : geheim
`