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

Backup/Restore fails when bucket name contains "." character

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 7.0.0
    • Morpheus, 7.2.0
    • eventing
    • None
    • 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.

      Attachments

        Issue Links

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

          Activity

            jon.strabala Jon Strabala added a comment - - edited

            Ankit Prabhu is this really an component === evening ticket, I mean KV works and Eventing works with a bucket named "dot.dot.dot.foo" keyspace "dot.dot.dot.foo._default._default" is there some other issue also in Eventing?  Perhaps Eventing/RBAC or advanced bucket accessors - just trying to see the Eventing (not backup/restore) relationship.  I see we handle the our own API for backup/restore.

            jon.strabala Jon Strabala added a comment - - edited Ankit Prabhu is this really an component === evening ticket, I mean KV works and Eventing works with a bucket named "dot.dot.dot.foo" keyspace "dot.dot.dot.foo._default._default" is there some other issue also in Eventing?  Perhaps Eventing/RBAC or advanced bucket accessors - just trying to see the Eventing (not backup/restore) relationship .  I see we handle the our own API for backup/restore.

            Build couchbase-server-7.5.0-3250 contains eventing commit 0edf6df with commit message:
            MB-54451: Handle backup restore when bucket name contains '.' character

            build-team Couchbase Build Team added a comment - Build couchbase-server-7.5.0-3250 contains eventing commit 0edf6df with commit message: MB-54451 : Handle backup restore when bucket name contains '.' character
            sujay.gad Sujay Gad added a comment -

            Gilad Kalchheim I have assigned this ticket to you for verification. Please do let me know if you need Information from the Eventing side.

            sujay.gad Sujay Gad added a comment - Gilad Kalchheim I have assigned this ticket to you for verification. Please do let me know if you need Information from the Eventing side.

            I discussed it with Sujay. I couldn't reproduce the problem in the cbbackupmgr level in  7.5.0, apparently because there were other fixes in Neo that masked the error, so it's not visible in 7.1.3/7.5.0. 

            We agreed that the best way forward is to test it in the Eventing level.

             

            Thanks Sujay

            gilad.kalchheim Gilad Kalchheim added a comment - I discussed it with Sujay. I couldn't reproduce the problem in the cbbackupmgr level in  7.5.0, apparently because there were other fixes in Neo that masked the error, so it's not visible in 7.1.3/7.5.0.  We agreed that the best way forward is to test it in the Eventing level.   Thanks Sujay

            After a further discussion with Sujay we agreed that fro 7.5.0/7.1.3 we just sanity check that the backup works with a bucket that contains "." (that nothing was broken). I've confirmed it for 7.5.0.

            gilad.kalchheim Gilad Kalchheim added a comment - After a further discussion with Sujay we agreed that fro 7.5.0/7.1.3 we just sanity check that the backup works with a bucket that contains "." (that nothing was broken). I've confirmed it for 7.5.0.

            Build couchbase-server-8.0.0-1166 contains eventing commit 0edf6df with commit message:
            MB-54451: Handle backup restore when bucket name contains '.' character

            build-team Couchbase Build Team added a comment - Build couchbase-server-8.0.0-1166 contains eventing commit 0edf6df with commit message: MB-54451 : Handle backup restore when bucket name contains '.' character

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty