Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
Security Level: Public
-
None
-
CBG Sprint 12
-
3
Description
When redacting a slice, we redact the whole string representation of that slice, rather than tagging each item in the slice individually. What would be easier to support would be redacting each element of the slice individually (for comparison/grepping purposes)
This is probably a bit tricky with slices of arbitrary types, but seems achievable with some reflection/string replacement. Note that we don't want to hardcode the <ud></ud> tags. Ideally we'd still rely on this: https://github.com/couchbase/sync_gateway/blob/b6919abb725f4b9802bd8b112efdb8be43e472a0/base/redactor_userdata.go#L28
Before fix
mySlice := []string{"secret", "xyz", "abc"}
|
Infof(KeyAll, "mySlice was: %s", UD(mySlice))
|
// Prints out: mySlice was: <ud>[secret xyz abc]</ud>
|
After fix
mySlice := []string{"secret", "xyz", "abc"}
|
Infof(KeyAll, "mySlice was: %s", UD(mySlice))
|
// Prints out: mySlice was: [<ud>secret</ud> <ud>xyz</ud> <ud>abc</ud>]
|
Real-world log example: https://github.com/couchbase/sync_gateway/blob/b6919abb725f4b9802bd8b112efdb8be43e472a0/db/change_listener.go#L166-L167