From bae67f16bc8e15e64c34042a275fb75641ce158b Mon Sep 17 00:00:00 2001 From: KIProtect GmbH Date: Thu, 24 Mar 2022 13:47:37 +0100 Subject: [PATCH] Use random ID for 'requestConnection' request. --- channels/grpc_client.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/channels/grpc_client.go b/channels/grpc_client.go index 9d766cc..6a76c7f 100644 --- a/channels/grpc_client.go +++ b/channels/grpc_client.go @@ -18,9 +18,11 @@ package channels import ( "context" + "encoding/hex" "fmt" "github.com/iris-connect/eps" "github.com/iris-connect/eps/grpc" + "github.com/iris-connect/eps/helpers" "github.com/kiprotect/go-helpers/forms" "net" "sync" @@ -436,9 +438,17 @@ func (c *GRPCClientChannel) DeliverRequest(request *eps.Request) (*eps.Response, } method := fmt.Sprintf("%s.requestConnection", settings.Proxy) + + // does not need to be secure just unique for this EPS server... + id, err := helpers.RandomID(8) + + if err != nil { + return nil, err + } + request := &eps.Request{ Method: method, - ID: fmt.Sprintf("%s(1)", method), + ID: fmt.Sprintf("%s(%s)", method, hex.EncodeToString(id)), Params: map[string]interface{}{ "to": address.Operator, "channel": "grpc_server",