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-5127): implement reject kmsRequest on server close #3964

Merged
merged 25 commits into from
Jan 18, 2024

Conversation

alenakhineika
Copy link
Contributor

@alenakhineika alenakhineika commented Jan 12, 2024

Description

Handle onclose event in kmsRequest.

What is changing?

  • Adding onclose handler to the socket
  • Refactoring kmsRequest to async/await
Is there new documentation needed for these changes?

None

What is the motivation for this change?

NODE-5127
NODE-3959

Release Highlight

Fixed unresolved request issue in KMS requester

Internal to the field-level encryption machinery is a helper that opens a TLS socket to the KMS provider endpoint and submits a KMS request. The code neglected to add a 'close' event listener to the socket, which had the potential to improperly leave the promise pending indefinitely if no error was encountered.

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 self-requested a review January 12, 2024 17:25
@nbbeeken nbbeeken self-assigned this Jan 12, 2024
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jan 12, 2024
@alenakhineika alenakhineika changed the title fix(NODE-5127): Promise returned by libmongocrypt's StateMachine.kmsRequest never resolves when server closes connection without an error fix(NODE-5834): 6.x implement reject kmsRequest on server close Jan 15, 2024
@alenakhineika alenakhineika marked this pull request as ready for review January 15, 2024 15:03
src/client-side-encryption/state_machine.ts Show resolved Hide resolved
src/client-side-encryption/state_machine.ts Outdated Show resolved Hide resolved
src/client-side-encryption/state_machine.ts Outdated Show resolved Hide resolved
src/client-side-encryption/state_machine.ts Outdated Show resolved Hide resolved
src/client-side-encryption/state_machine.ts Outdated Show resolved Hide resolved
test/unit/client-side-encryption/state_machine.test.ts Outdated Show resolved Hide resolved
test/unit/client-side-encryption/state_machine.test.ts Outdated Show resolved Hide resolved
@nbbeeken nbbeeken changed the title fix(NODE-5834): 6.x implement reject kmsRequest on server close fix(NODE-5834): implement reject kmsRequest on server close Jan 17, 2024
@nbbeeken nbbeeken self-requested a review January 17, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants