Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NODE-6803): kms proxy socket creates unhandled rejection #4444

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Mar 4, 2025

Description

What is changing?

  • Move KMS net socket creation into flagged path
Is there new documentation needed for these changes?

No

What is the motivation for this change?

The net socket was created unconditionally and in the finally block we destroy it which will reject the "willConnect" promise that is unhandled. Moving creation of the socket and the promise into a flagged path prevents this scenario.

Release Highlight

KMS Requests can cause unhandled

When using explicit encryption or automatic encryption, the driver makes requests to a Key Management System when to fetch key encryption keys. The driver supports connecting to a KMS provider through a Socks5 proxy. However, the socket used for the socks5 proxy was created in all circumstances, regardless of proxy configuration. This leads to unhandled rejection errors when closing the socket the driver attempts to clean up the unused socket.

With the changes in this release, the socket is only created if a proxy is configured and the any promises created for the proxy are properly handled.

Double check the following

  • Ran npm run check:lint script
  • 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

@nbbeeken nbbeeken requested a review from a team as a code owner March 4, 2025 18:21
@nbbeeken nbbeeken requested a review from baileympearson March 4, 2025 18:37
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Mar 4, 2025
@baileympearson baileympearson merged commit ed69cf9 into main Mar 4, 2025
30 checks passed
@baileympearson baileympearson deleted the NODE-6803-kms-socket branch March 4, 2025 20:19
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.

2 participants