From 1ed9043f22d7648de135bc4687d025d4e88a8dd7 Mon Sep 17 00:00:00 2001 From: Zelalem Mekonen Date: Thu, 3 Aug 2023 11:01:17 +0300 Subject: [PATCH] feat: enable tls on grpc clients (#13) --- go/clients/codehost.go | 6 ++++-- go/clients/diff.go | 6 ++++-- go/clients/robin.go | 6 ++++-- go/clients/semantic.go | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/go/clients/codehost.go b/go/clients/codehost.go index f5f3722..e8460f1 100644 --- a/go/clients/codehost.go +++ b/go/clients/codehost.go @@ -5,14 +5,16 @@ package clients import ( + "crypto/tls" + "github.com/reviewpad/api/go/services" "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/credentials" ) func NewCodeHostClient(endpoint string) (services.HostClient, *grpc.ClientConn, error) { defaultOptions := grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(419430400)) - transportCredentials := grpc.WithTransportCredentials(insecure.NewCredentials()) + transportCredentials := grpc.WithTransportCredentials(credentials.NewTLS((&tls.Config{}))) hostConnection, err := grpc.Dial(endpoint, transportCredentials, defaultOptions) if err != nil { diff --git a/go/clients/diff.go b/go/clients/diff.go index 4f112a2..502e5f7 100644 --- a/go/clients/diff.go +++ b/go/clients/diff.go @@ -5,14 +5,16 @@ package clients import ( + "crypto/tls" + "github.com/reviewpad/api/go/services" "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/credentials" ) func NewDiffClient(endpoint string) (services.DiffClient, *grpc.ClientConn, error) { defaultOptions := grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(419430400)) - transportCredentials := grpc.WithTransportCredentials(insecure.NewCredentials()) + transportCredentials := grpc.WithTransportCredentials(credentials.NewTLS((&tls.Config{}))) diffConnection, err := grpc.Dial(endpoint, transportCredentials, defaultOptions) if err != nil { diff --git a/go/clients/robin.go b/go/clients/robin.go index 7f520cf..d06d441 100644 --- a/go/clients/robin.go +++ b/go/clients/robin.go @@ -5,14 +5,16 @@ package clients import ( + "crypto/tls" + "github.com/reviewpad/api/go/services" "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/credentials" ) func NewRobinClient(endpoint string) (services.RobinClient, *grpc.ClientConn, error) { defaultOptions := grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(419430400)) - transportCredentials := grpc.WithTransportCredentials(insecure.NewCredentials()) + transportCredentials := grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})) robinConnection, err := grpc.Dial(endpoint, transportCredentials, defaultOptions) if err != nil { diff --git a/go/clients/semantic.go b/go/clients/semantic.go index 3a5a676..c359d40 100644 --- a/go/clients/semantic.go +++ b/go/clients/semantic.go @@ -5,14 +5,16 @@ package clients import ( + "crypto/tls" + "github.com/reviewpad/api/go/services" "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/credentials" ) func NewSemanticClient(endpoint string) (services.SemanticClient, *grpc.ClientConn, error) { defaultOptions := grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(419430400)) - transportCredentials := grpc.WithTransportCredentials(insecure.NewCredentials()) + transportCredentials := grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})) semanticConnection, err := grpc.Dial(endpoint, transportCredentials, defaultOptions) if err != nil {