immudb-py icon indicating copy to clipboard operation
immudb-py copied to clipboard

Add support for secure gRPC channels in ImmudbClient

Open AlphaKhaw opened this issue 9 months ago • 0 comments
trafficstars

Current Behavior

The current implementation of ImmudbClient only supports insecure gRPC channels (grpc.insecure_channel). This makes it challenging to use ImmuDB in production environments where TLS/SSL is required, such as when connecting through an Application Load Balancer (ALB) or when security policies mandate encrypted connections.

Proposed Solution

Add support for secure gRPC channels by:

  1. Adding an optional ssl_credentials parameter to ImmudbClient.__init__
  2. Creating a secure channel when credentials are provided
  3. Maintaining backward compatibility by defaulting to insecure channel

Current Workaround

Users currently need to manually override the channel after client creation:

credentials = grpc.ssl_channel_credentials()
channel = grpc.secure_channel(target=f"{host}:{port}", credentials=credentials)
client = ImmudbClient(...)
client.channel.close() # Close existing insecure channel
client.channel = channel
client.resetStub()

This workaround is functional but not ideal for production use.

AlphaKhaw avatar Feb 04 '25 08:02 AlphaKhaw