Skip to content

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Oct 13, 2025

Description

Summary of Changes

Notes for Reviewers

What is the motivation for this change?

Release Highlight

All BSON bundles now use globalThis.crypto for random byte generation

Until BSON@7.x, BSON has supported Node16. Node16 does not include crypto in the global object, which necessitated importing crypto from node:crypto. This require has caused many headaches for bundlers (insert jira ticket). We improved the situation in <>, but this release updates our Nodejs bundle to rely on the global object instead and removes all requires from the bundle.

Double check the following

  • Lint is passing (npm run check:lint)
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@baileympearson baileympearson marked this pull request as ready for review October 13, 2025 22:13
@baileympearson baileympearson requested a review from a team as a code owner October 13, 2025 22:13
@dariakp dariakp changed the title feat(NODE-5763): remove require('crypto') from Nodejs bundle feat(NODE-6321): remove require('crypto') from Nodejs bundle Oct 14, 2025
@durran durran self-assigned this Oct 15, 2025
@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Oct 15, 2025
Copy link
Contributor

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave a note somewhere (README.md?) that this package requires the global crypto to be a Web Crypto object

- remove `--fix` from lint script
- add fallback to math-based randomValues in Node byte utils
@durran durran merged commit 7ba8917 into main Oct 17, 2025
9 checks passed
@durran durran deleted the NODE-5763 branch October 17, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Primary Review In Review with primary reviewer, not yet ready for team's eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants