[JAVA-891] Document fields accept NULL characters Created: 19/Jul/13  Updated: 31/Mar/15  Resolved: 02/Aug/13

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: 2.11.2
Fix Version/s: 2.11.3, 3.0.0

Type: Bug Priority: Major - P3
Reporter: Ross Lawley Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DRIVERS-101 BSON cstring with null bytes should n... Closed
related to JAVA-1070 driver doesn't allow null characters ... Closed

 Description   

new BasicDBObject("foo\0bar","baz") doesn't have a valid document field name and should throw a IllegalArgumentException like fields names containing a dot.



 Comments   
Comment by Jeffrey Yemin [ 31/Mar/15 ]

Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.

Comment by Jeffrey Yemin [ 06/Jan/14 ]

It'll be needed in both places. Please create a new issue in the support project, and then we can link them.

Thanks,
Jeff

Comment by Sam Perman [ 06/Jan/14 ]

Thanks... I filed JAVA-1070

We have a support contract so let me know if I should move it to our support project. This isn't currently breaking production but is blocking a release of the upgraded driver.

Comment by Jeffrey Yemin [ 06/Jan/14 ]

Sorry, I responded too quickly. I think you're right. The change was too aggressive. The intention was to catch additional use of cstrings, like in namespaces, etc, but all strings are affected.

Would you like to report a new bug? I don't want to re-open one that's already been released. Please indicate the urgency for you as well. Is this breaking a production application, for example?

Comment by Sam Perman [ 06/Jan/14 ]

It used to work though... this change (linked above) is where values no longer could include null characters, as far as I can tell: https://github.com/mongodb/mongo-java-driver/commit/5798e1b73cf801b898d71c81fd42f8437faaf267

Comment by Jeffrey Yemin [ 06/Jan/14 ]

This is for keys, not values. Keys can't contain NULL because BSON does not support it.

Comment by Sam Perman [ 06/Jan/14 ]

Why is the null character not allowed in field values?

Comment by auto [ 12/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-891: Added an additional check for NULL character to BasicBSONEncoder.
Branch: 2.11.x
https://github.com/mongodb/mongo-java-driver/commit/d677083a8ef13f0bbc01551e148b082f9a50ec66

Comment by auto [ 12/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-891: Added an additional check for NULL character to BasicBSONEncoder.
Branch: 2.11.x
https://github.com/mongodb/mongo-java-driver/commit/2646dc2a12c7b03083faadb6281d02a6ba218d24

Comment by auto [ 12/Sep/13 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Ensure document keys can't contain NULL character (JAVA-891)
Branch: 2.11.x
https://github.com/mongodb/mongo-java-driver/commit/ae7d3df5517887e8f8070ab836c53921b91b9dbf

Comment by Jeffrey Yemin [ 02/Aug/13 ]

Fixed in both branches

Comment by auto [ 02/Aug/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-891: Added an additional check for NULL character to BasicBSONEncoder.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5798e1b73cf801b898d71c81fd42f8437faaf267

Comment by auto [ 02/Aug/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-891: Check for null characters in all cstrings
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/f21f03bf8a8e7b125fb698e2299997a09e0326e1

Comment by auto [ 02/Aug/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-891: Move element name checks from BSONWriter to FieldNameValidator
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/8152fa63e7bbdce27071d96f58a6c5da528d7e0d

Comment by auto [ 19/Jul/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Merge pull request #129 from rozza/JAVA-891

Ensure document keys can't contain NULL character (JAVA-891)
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/429149ff22ae66183cc335e37770276587a5f80f

Comment by auto [ 19/Jul/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Merge pull request #129 from rozza/JAVA-891

Ensure document keys can't contain NULL character (JAVA-891)
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/429149ff22ae66183cc335e37770276587a5f80f

Comment by auto [ 19/Jul/13 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Ensure document keys can't contain NULL character (JAVA-891)
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/afb915630edd9f2050bcbf01951067ae83ab0e2e

Generated at Thu Feb 08 08:53:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.