-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
Details
As of v4.2.0 ObjectId's began interpreting strings of length 12 as UTF8 instead of latin1. We should remove support for strings that aren't exactly hex strings to make construction from string input clear and lack a variation of interpretations.
AC
- Only allow strings of length 24 that contain hex characters
- Remove strings of length 12 from objectId constructor
- Update tests
Drive-by improvement
- Now that we are developing on Node.js 20 there are dev dependencies we do not need to always install that are failing on Node.js 20.
- Remove v8-profiler-next and add tar
- is depended on by
-
COMPASS-6258 Investigate changes in NODE-4770: Remove UTF8 length 12 strings from ObjectId constructor
- Closed
- is duplicated by
-
NODE-4912 ObjectID constructor accepts invalid String
- Closed
- is related to
-
NODE-6046 ObjectId.isValid("PROFIT_SHARE") returns TRUE
- Closed
-
NODE-6371 ObjectId.isValid returns true for non-objectid strings
- Closed
- related to
-
NODE-3725 Constrain new ObjectId constructor and drop support for non-relevant cases
- Closed