Skip to content

Commit

Permalink
Add a test to check what we choose to redact (#4406)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Mar 8, 2024
1 parent 0624167 commit 4dc8731
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/configconverter/config_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,36 @@ func assertValidYAMLPages(t *testing.T, expected map[string]any, path string) {

assert.Equal(t, expected, confmap.NewFromStringMap(unmarshalled).ToStringMap())
}

func TestSimpleRedact(t *testing.T) {
result := simpleRedact(map[string]any{
"foo": "bar",
"access": "bar",
"api_key": "bar",
"apikey": "bar",
"auth": "bar",
"credential": "bar",
"creds": "bar",
"login": "bar",
"password": "bar",
"pwd": "bar",
"token": "bar",
"user": "bar",
"X-SF-Token": "bar",
})
assert.Equal(t, map[string]any{
"foo": "bar",
"access": "<redacted>",
"api_key": "<redacted>",
"apikey": "<redacted>",
"auth": "<redacted>",
"credential": "<redacted>",
"creds": "<redacted>",
"login": "<redacted>",
"password": "<redacted>",
"pwd": "<redacted>",
"token": "<redacted>",
"user": "<redacted>",
"X-SF-Token": "<redacted>",
}, result)
}

0 comments on commit 4dc8731

Please sign in to comment.