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

binary key breaks view generation (non-UTF8 byte sequence in key)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 2.0-beta
    • 2.0-developer-preview-3, 2.0-developer-preview-4
    • view-engine
    • Security Level: Public
    • None
    • Tested on CentOS and MacOS

    Description

      Setting values with a binary key will break the view updater. To ensure this isn't specific to MacOS I also deployed couchbase to a CentOS machine and the same problem occurred.

      Problem: Error occurs when View updater encounters certain binary keys
      Expected: View updater should ignore binary keys with non-UTF8 byte sequences

      Discussion:
      This could disable the functionality of a view if an unscrupulous user caused a key to be generated with invalid utf8 byte sequences. I like that I can set binary values (eg, invalid json) and there isn't any issues generating views – would be good to see the same functionality for keys. Also – I'm assuming the issue is that the byte sequence is non-utf8.

      Below is example with Ruby code which reproduces the issue as well as the only (relevant) errors I could find in log files.

      1. Connect to bucket and set a value
        1.9.2p290 :013 > rc = Couchbase.connect(:hostname => 'couch.test', :bucket => 'couchtest')
        => #<Couchbase::Bucket:0x007fce2a9a67f8 "http://couch.test:8091/pools/default/buckets/couchtest/" default_format=:document, default_flags=0x0, quiet=false, connected=true, timeout=2500000>
        1.9.2p290 :014 > rc.set('test', {set:1}

        )
        => 11045888751782266112

      In browser, access http://couch.test:8092/couchtest/_design/dev_b/_view/b?full_set=true&connection_timeout=60000&limit=10&skip=0
      This will render a beautiful JSON hash which has one row (as expected)

      1.9.2p290 :015 > rc.set("xFF\xFF end",

      {set:1}

      )
      => 8720605621192688896
      1.9.2p290 :016 > rc.set("test end",

      {set:1}

      )
      => 13489129147942241536

      1. Notice, all the values can be read
        1.9.2p290 :017 > c.get("test")
        => {"set"=>1}
        1.9.2p290 :018 > c.get("xFF\xFF end")
        => {"set"=>1}


        1.9.2p290 :019 > c.get("test end")
        =>

        {"set"=>1}

      In browser access http://couch.test:8092/couchtest/_design/dev_b/_view/b?full_set=true&connection_timeout=60000&limit=10&skip=0

      This will only show one row (excluding new values) and an error will appear in log file:

      [couchdb:info] [2012-08-06 15:50:43] [ns_1@couch.test:<0.9035.0>:couch_log:error:42] Set view `couchtest`, main group `_design/dev_a`, received error from updater: epipe

      From here, future values or modifications will not render to the view and an error occurs with each view request.

      Attachments

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

        Activity

          People

            damien damien (Inactive)
            nessence Alex Leverington
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty