From bd8e60f4da54df6542e134bbfd0404b9b94dc89b Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sat, 4 May 2024 18:11:23 +0530 Subject: [PATCH] network: when using API key & secret key drop params Params need to be dropped as apikey & secretkey based URL has all the params and it causes signature validation issues when the same params are also posted again. For example, add host API with username, password params. Signed-off-by: Rohit Yadav --- cmd/network.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/network.go b/cmd/network.go index af97740..b5f4bef 100644 --- a/cmd/network.go +++ b/cmd/network.go @@ -221,6 +221,7 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str mac.Write([]byte(strings.ToLower(encodedParams))) signature := base64.StdEncoding.EncodeToString(mac.Sum(nil)) encodedParams = encodedParams + fmt.Sprintf("&signature=%s", url.QueryEscape(signature)) + params = nil } else if len(r.Config.ActiveProfile.Username) > 0 && len(r.Config.ActiveProfile.Password) > 0 { sessionKey, err := Login(r) if err != nil {