grpc / grpc/grpc-node

Custom Server Certificate Verification Logic from Client Side

Open
#1,965 3 comments 0 reactions 0 assignees View on GitHub
package: @grpc/grpc-js
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Is your feature request related to a problem? Please describe.

I need to put in custom logic to verifying the server certificate from the client side (and I also want to fetch this certificate for further processing because it has useful data).

The way I've currently done it is by first disabling certificate checking, then monkey patching and getting the http2session object by reaching down into the internals and fetching the socket certificate.

This allows me to verify the server certificate using my own custom logic.

However this isn't very robust solution. I've found that in some cases the http2 session object is still null in the subchannel because the subchannel state is still idle. I thought that subchannel state would be ready by the time channel state is ready, but this appears not to be the case. **How can the channel state be ready while subchannel state is still not ready? Doesn't it need to verify the certificates somehow?**

### Describe the solution you'd like

Ideally there would be some way of hooking into the TLS logic, and passing my own certificate verification logic without monkey patching. I actually do this on both client side and server side, but this issue is about client side.

### Describe alternatives you've considered

I've also looked into overriding the channel object, but It seems quite complicated since the TLS is occurring inside the http2 which is inside a subchannel.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.