Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-57039

[BP of MB-54451] Backup/Restore fails when bucket name contains "." character

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      The problem seen here:

      https://forums.couchbase.com/t/cbbackupmgr-config-commands/34780/10

      is because filterQueryMap eventing/service_manager/utils.go in 7.0.x doesn't correctly handle escaped dots (it is too simplistic).

      https://github.com/couchbase/eventing/commit/dff6ad00bfb6e346ed99ff9f78c269744e1e4c79

      removed the error reporting in eventing/service_manager/http_handlers.go when filterQueryMap returns an error and is why the error isn't seen any longer in 7.1.

      This probably wasn't intended given that it leaves the filterMap empty - i.e. ignores the filtering.

      So returning the error reporting and using something like:

      func filterQueryMap(filterString string, include bool) (map[string]bool, error) {
          filterMap := make(map[string]bool)
          var keyspace []rune
          escaped := false
          nDots := 0
          filterString += ","
          for _, r := range filterString {
              if escaped {
                  escaped = false
              } else {
                  if r == '\\' {
                      escaped = true
                      continue
                  } else if r == ',' {
                      if len(keyspace) > 0 {
                          if nDots > 2 {
                              return nil, fmt.Errorf("Malformed input filter %s", string(keyspace))
                          }
                          filterMap[string(keyspace)] = include
                          keyspace = keyspace[:0]
                          nDots = 0
                      }
                      continue
                  } else if r == '.' {
                      nDots++
                  }
              }
              keyspace = append(keyspace, r)
          }
          return filterMap, nil
      }
      

      would validate the filters (bucket, bucket.scope or bucket.scope.collection) along with permitting embedded dots or commas in any part.

       

      Issue Resolution
      Backup and Restore did not complete successfully when bucket names contained a period or full stop character [.] This was due to a filtering issue where this character was not correctly validated. Backup and Restore has been fixed to correctly handle any period characters in bucket names.

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-57039
          # Subject Branch Project Status CR V

          Activity

            People

              sujay.gad Sujay Gad
              ankit.prabhu Ankit Prabhu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty