From 49cf700bbd5ea0f050be97d453f3aa25d3cbbfeb Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 4 May 2023 10:46:38 +0200 Subject: [PATCH] Struct `Client` exposes sensitive data (#784) (#788) (cherry picked from commit ecd5ee112533cda28900cbd75afb349f67da3fa5) Co-authored-by: Sergio Mena --- rpc/jsonrpc/client/http_json_client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpc/jsonrpc/client/http_json_client.go b/rpc/jsonrpc/client/http_json_client.go index 9c928f1f04..76fa5063f9 100644 --- a/rpc/jsonrpc/client/http_json_client.go +++ b/rpc/jsonrpc/client/http_json_client.go @@ -139,6 +139,8 @@ var _ HTTPClient = (*Client)(nil) var _ Caller = (*Client)(nil) var _ Caller = (*RequestBatch)(nil) +var _ fmt.Stringer = (*Client)(nil) + // New returns a Client pointed at the given address. // An error is returned on invalid remote. The function panics when remote is nil. func New(remote string) (*Client, error) { @@ -232,6 +234,10 @@ func getHTTPRespErrPrefix(resp *http.Response) string { return fmt.Sprintf("error in json rpc client, with http response metadata: (Status: %s, Protocol %s)", resp.Status, resp.Proto) } +func (c *Client) String() string { + return fmt.Sprintf("&Client{user=%v, addr=%v, client=%v, nextReqID=%v}", c.username, c.address, c.client, c.nextReqID) +} + // NewRequestBatch starts a batch of requests for this client. func (c *Client) NewRequestBatch() *RequestBatch { return &RequestBatch{