Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-862

CBL 2.7 and later doesn't catch Illegal top-level key like "_id"

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.0
    • 3.0
    • LiteCore
    • Security Level: Public
    • None
    • Jim 32
    • 3

    Description

      mobile-testkit framework has a generic function to create bulk documents, this function add documents whose data contains a key/value pair like below:

      _id = doc_id_name

      the key _id is considered as an illegal top-level key, 2.6.4.2-1 Android build capture this issue, however, not 2.7 or later CBL fail on this validation during the weekly test run.

      Repro Steps:

      1. use 2.7. or 2.8 CBL Android build
      2. prepare a document like this:
      MutableDocument document = new MutableDocument(id, data);
      in this case, set id = cbl_1
      and data = {channels=[ABC], dict_with_list=

      {list=[true, false]}

      , dict=

      {name=zFakpGdcYp}

      , list=[2115284486470778685, 1745721136811925734], date_time_added=2020-04-15 11:55:22.303358, list_of_dicts=[

      {friend_one=QYLGYazGqd}

      ,

      {friend_two=VQYPpYGBJe}

      ], _id=cbl_1, updates=0}
      3. call database.save(document)

      Expected Result:
      save function throws exception:
      CouchbaseLiteException

      {CouchbaseLite,5,'Illegal top-level key `_id` in document'}

      at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:81)
      at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:32)
      at com.couchbase.lite.AbstractDatabase.saveInTransaction(AbstractDatabase.java:1460)
      at com.couchbase.lite.AbstractDatabase.saveInternal(AbstractDatabase.java:1366)
      at com.couchbase.lite.AbstractDatabase.save(AbstractDatabase.java:399)
      at com.couchbase.lite.Database.save(Database.java:31)
      .......

      Actual Result:
      document is saved successfully, no validation check placed/failed

      Attachments

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

        Activity

          eunice.huang Eunice Huang (Inactive) created issue -
          eunice.huang Eunice Huang (Inactive) made changes -
          Field Original Value New Value
          Attachment android logcat 2.7.txt [ 91057 ]
          eunice.huang Eunice Huang (Inactive) made changes -
          Attachment python console 2.7.txt [ 91058 ]
          eunice.huang Eunice Huang (Inactive) made changes -
          Link This issue relates to CBL-858 [ CBL-858 ]
          eunice.huang Eunice Huang (Inactive) added a comment - - edited

          either of this one or CBL-858 logic is valid, but not both.

          eunice.huang Eunice Huang (Inactive) added a comment - - edited either of this one or CBL-858 logic is valid, but not both.
          daniel.petersen Daniel Petersen made changes -
          Story Points 3
          daniel.petersen Daniel Petersen made changes -
          Assignee The Lite [ cbgto ] Jim Borden [ jimb ]
          daniel.petersen Daniel Petersen made changes -
          Sprint Jim 20 [ 1063 ]
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked lower
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked lower
          daniel.petersen Daniel Petersen made changes -
          Sprint Jim 20 [ 1063 ]
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked higher
          jimb Jim Borden added a comment -

          By any chance was 2.6.4.2 a debug build?  This logic is checked and an exception is thrown for a debug build but not release build (maybe for performance reasons?).  This behavior has never changed in the entire 2.x timeframe. 

          jimb Jim Borden added a comment - By any chance was 2.6.4.2 a debug build?  This logic is checked and an exception is thrown for a debug build but not release build (maybe for performance reasons?).  This behavior has never changed in the entire 2.x timeframe. 
          jimb Jim Borden added a comment -

          According to Priya Rajagopal we are not going to fix this until 3.0 because it will break compatibility.  However we are going to discourage this behavior so the test fest app should continue to not use these keys. 

          jimb Jim Borden added a comment - According to Priya Rajagopal we are not going to fix this until 3.0 because it will break compatibility.  However we are going to discourage this behavior so the test fest app should continue to not use these keys. 
          jimb Jim Borden made changes -
          Fix Version/s Lithium [ 16190 ]
          Fix Version/s Hydrogen [ 16189 ]
          priya.rajagopal Priya Rajagopal added a comment - FYI : Filed https://issues.couchbase.com/browse/DOC-6759
          daniel.petersen Daniel Petersen made changes -
          Security Private [ 10332 ] Public [ 10333 ]
          daniel.petersen Daniel Petersen made changes -
          Sprint Jim 32 [ 1279 ]
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked lower
          jimb Jim Borden made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Automated transition triggered when Jim Borden created pull request #1076 in GitHub -
          Status In Progress [ 3 ] In Review [ 10107 ]
          Automated transition triggered when Jim Borden merged pull request #1076 in GitHub -
          Resolution Fixed [ 1 ]
          Status In Review [ 10107 ] Resolved [ 5 ]

          Build couchbase-lite-core-3.0.0-9 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-core-3.0.0-9 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)

          Build couchbase-lite-cblite-3.0.0-11 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-cblite-3.0.0-11 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)

          Build couchbase-lite-log-3.0.0-12 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-log-3.0.0-12 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)

          Build couchbase-lite-net-3.0.0-9 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-net-3.0.0-9 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)

          Build couchbase-lite-net-3.0.0-9 contains couchbase-lite-net commit 4c2d539 with commit message:
          Update LiteCore to Commit: 6682394694e1aa6b355461727e5d534200abf53e [6682394] (CBL-862: Reject invalid top level keys)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-net-3.0.0-9 contains couchbase-lite-net commit 4c2d539 with commit message: Update LiteCore to Commit: 6682394694e1aa6b355461727e5d534200abf53e [6682394] ( CBL-862 : Reject invalid top level keys)

          Build couchbase-lite-android-3.0.0-17 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-android-3.0.0-17 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)

          Build couchbase-lite-java-3.0.0-17 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-java-3.0.0-17 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)

          Build couchbase-lite-ios-3.0.0-31 contains couchbase-lite-core commit 6682394 with commit message:
          CBL-862: Reject invalid top level keys (#1076)

          build-team Couchbase Build Team added a comment - Build couchbase-lite-ios-3.0.0-31 contains couchbase-lite-core commit 6682394 with commit message: CBL-862 : Reject invalid top level keys (#1076)
          jimb Jim Borden made changes -
          Assignee Jim Borden [ jimb ] Eunice Huang [ eunice.huang ]
          eunice.huang Eunice Huang (Inactive) made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

          People

            eunice.huang Eunice Huang (Inactive)
            eunice.huang Eunice Huang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty