Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5116

Validate null bytes keys when stringifying to EJSON

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: EJSON
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      How are you using Mongo? What version of the server and driver are you using?

      Node's EJSON implementation permits null bytes in keys when the same would be incompatible with BSON. This allows EJSON to generate a serialized output that could not be represented in BSON.

      BSON.EJSON.stringify({ 'a\x00': 1 })
      // '{"a\\u0000":1}'
      BSON.serialize({ 'a\x00': 1 })
      Uncaught BSONError: key a must not contain null bytes
      

      What is the feature/improvement you would like?

      Validate for null bytes within keys.

      What use case would this feature/improvement enable?

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: