This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch signature-bugfix
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git

commit bd8e60f4da54df6542e134bbfd0404b9b94dc89b
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
AuthorDate: Sat May 4 18:11:23 2024 +0530

    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 <rohit.ya...@shapeblue.com>
---
 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 {

Reply via email to