mirror of
https://github.com/prometheus/alertmanager
synced 2024-12-26 16:12:20 +00:00
Merge pull request #1486 from mxinden/staticcheck
config/test: Count `<secret>` occurrences via golang strings
This commit is contained in:
commit
4fff29c683
@ -257,9 +257,7 @@ func TestHideConfigSecrets(t *testing.T) {
|
||||
|
||||
// String method must not reveal authentication credentials.
|
||||
s := c.String()
|
||||
secretRe := regexp.MustCompile("<secret>")
|
||||
matches := secretRe.FindAllStringIndex(s, -1)
|
||||
if len(matches) != 14 || strings.Contains(s, "mysecret") {
|
||||
if strings.Count(s, "<secret>") != 14 || strings.Contains(s, "mysecret") {
|
||||
t.Fatal("config's String method reveals authentication credentials.")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user