-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Context
It was identified in SERVER-136132 that a BSON validation `ErrorCodes::NonConformantBSON` error was swallowed and the code continued to operate on the `BSONObj`. The assumption seemed to be that BSON that fails validation with `ErrorCodes::NonConformantBSON` would still be structurally valid BSON. That assumption is incorrect.
Proposal
We should consider any of the following:
- BSON validation continues to validate until structurally invalid BSON is detected (aka `ErrorCodes::InvalidBSON` is hit).
- We can preserve other error codes hit until validation finishes.
- It's more clearly stated that `validateBSON` fails on the first error hit.
Error codes explained
The relevant BSON validate error codes in this ticket:
- InvalidBSON - indicates validation failed due to structurally invalid BSON, buffer is not safe to parse.
- NonConformantBSON - breaks certain BSON rules, but doesn't affect parsing (e.g. duplicate field names)
- is related to
-
SERVER-136132 ValidateAdaptor::validateRecord can ignore invalid BSON
-
- Closed
-