Skip to content

Commit

Permalink
network: when using API key & secret key drop params (#150)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rohityadavcloud committed May 20, 2024
1 parent 9df1724 commit 1f45761
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmd/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1f45761

Please sign in to comment.