Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-226

Make log redaction support redacting each item in a slice

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • 2.6.0
    • None
    • SyncGateway
    • 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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jacques.rascagneres Jacques Rascagneres
            ben.brooks Ben Brooks
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty