Fail explicitly when reading unsupported BSON Binary subtypes (UUID subtypes 3/4, vector subtype 9)

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When reading persisted data, we must fail explicitly for BSON Binary Data subtypes we do not support, rather than silently returning the raw bytes.

      This is the read-path portion of HIBERNATE-73. HIBERNATE-73 implemented the boot-time forbidding of unsupported domain types (java.util.UUID and the org.bson.types package) in MongoAdditionalMappingContributor, but did not implement the read-time check described in its own description.

      Currently ValueConversions.toDomainValue(BsonBinary) returns value.asBinary().getData() with no subtype inspection. Any BsonBinary — including subtype 3/4 (UUID) and subtype 9 (vector) — is silently read as a byte[]. A byte[]-mapped field pointed at a document containing such a binary returns the raw bytes instead of failing.

      Scope:
      * Fail explicitly when reading BSON Binary subtypes we do not support (subtypes 3 and 4 for UUID, 9 for vector data).
      * Ensure both representations are handled consistently: UUID / BinaryVector may arrive as a BsonBinary or as UUID / BinaryVector; both must be either supported or disallowed.

            Assignee:
            Unassigned
            Reporter:
            Jeffrey Yemin
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: