-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
Use Case
As a... Node Driver developer
I want... to ensure we aren't making implicit toString calls against Buffers
So that... the Driver continues to work in non-Node envs (like Deno)
User Experience
- Node Driver works without issues in non-Node envs, like Deno
- Avoid situation like https://jira.mongodb.org/browse/NODE-7548
- lint rule no-base-to-string is almost what we want, except the rule flags types whose toString() declaration lives on the Object interface — types that inherit Object.prototype.toString and produce [object Something]. But Uint8Array in TypeScript's lib has its own toString() declaration (not on Object), so the rule considers it fine.
- Add modified version of the no-base-to-string lint rule that checks for Uint8Array toString calls
- The tricky part for this repo: .eslintrc.json (legacy format) doesn't support inline plugins easily. We'd need either a local eslint-plugin-mongodb package in the repo, or migrate the config to the new flat config format (which supports inline plugin objects directly).
- Might be a good time to update our eslint format
Dependencies
- None
Risks/Unknowns
- We may uncover a lot of problematic cases
- We may uncover cases that we can't (easily) fix
- Eslint format upgrade may identify eslint issues
Acceptance Criteria
Implementation Requirements
- We have verified that we have no more implicit toString calls made on Buffer structure
- We have mechanisms in place to notify us (eg build break) that we have introduced an implicit toString call
Testing Requirements
- all tests are passing
- if an implicit toString is added, tests should fail
Documentation Requirements
- Mention that this type of bug is gone and non-Node envs should be better supported now
Follow Up Requirements
- None
- related to
-
NODE-7548 SCRAM authentication fails on non-Node runtimes (Deno) in 7.2.0 — Uint8Array.toString() in authMessage
-
- In Code Review
-