Skip to content

Conversation

@vbabanin
Copy link
Member

@vbabanin vbabanin commented Dec 3, 2025

@vbabanin vbabanin requested a review from a team as a code owner December 3, 2025 22:35
@vbabanin vbabanin requested a review from katcharov December 3, 2025 22:35
@vbabanin vbabanin self-assigned this Dec 3, 2025
@vbabanin vbabanin requested a review from Copilot December 3, 2025 22:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds handling for unexpected end-of-stream errors from KMS providers during encryption operations. The key change is detecting when a KMS provider closes a connection prematurely (returning -1 from read operations) and throwing a descriptive MongoException instead of allowing undefined behavior.

Key changes:

  • Added EOF detection in KMS stream reading logic for both sync and reactive drivers
  • Extracted SSL context building utilities to a shared test fixture to support new test infrastructure
  • Added test case that simulates KMS server abruptly closing connections

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
driver-sync/src/main/com/mongodb/client/internal/Crypt.java Added EOF check when reading from KMS provider streams and updated exception wrapping logic
driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/crypt/KeyManagementService.java Added EOF detection in async stream reading callback
driver-sync/src/test/functional/com/mongodb/fixture/EncryptionFixture.java Extracted SSL context and KeyManagerFactory creation utilities for test reuse
driver-sync/src/test/functional/com/mongodb/client/auth/AbstractX509AuthenticationTest.java Refactored to use shared SSL context utilities from EncryptionFixture
driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideEncryptionKmsTlsTest.java Added test simulating KMS server EOF scenario with fake SSL server
.evergreen/run-kms-tls-tests.sh Added server keystore generation and configuration for KMS TLS testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vbabanin vbabanin requested review from strogiyotec and removed request for katcharov December 3, 2025 22:56
@vbabanin vbabanin marked this pull request as draft December 7, 2025 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant