-
Type:
Task
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
-
-
None
-
None
-
None
-
None
-
None
-
None
winklemad has created PR #2961: PYTHON-XXXX Reject extra fields in Extended JSON timestamps in mongo-python-driver
Issue Text:
PYTHON-XXXX
-
- Changes in this PR
`bson.json_util.loads` now rejects `$timestamp` value documents that contain anything other than the required `t` and `i` components. Previously, unexpected fields could be silently discarded while constructing `bson.timestamp.Timestamp`.
This adds regressions for both additional fields and same-length invalid key sets, and updates the changelog and contributor list.
AI assistance disclosure: I used OpenAI Codex to help investigate the existing behavior, search for duplicates, implement the change, and run validation. I reviewed and understand every changed line and can explain and maintain the contribution.
-
- Test Plan
- `python3 -m unittest test.test_json_util.TestJsonUtil.test_timestamp test.test_json_util.TestJsonUtil.test_timestamp_with_invalid_fields`
- `python3 -m unittest test.test_json_util test.test_bson_corpus`
- `ruff check bson/json_util.py test/test_json_util.py`
- `ruff format --check bson/json_util.py test/test_json_util.py`
- `python3 -m compileall -q bson/json_util.py test/test_json_util.py`
- `git diff --check`
All listed checks passed.
-
- Checklist
-
-
- Checklist for Author
-
- [x] Did you update the changelog (if necessary)?
- [x] Is there test coverage?
- [ ] Is any followup work tracked in a JIRA ticket? If so, add links.
No follow-up work is currently identified. As an external contributor without an existing JIRA ticket, I retained the template `PYTHON-XXXX` placeholder for a MongoDB employee to update.
-
-
- Checklist for Reviewer
-
- [ ] Does the title of the PR reference a JIRA Ticket?
- [ ] Do you fully understand the implementation?
- [ ] Is all relevant documentation updated?