You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by "rohityadavcloud (via GitHub)" <gi...@apache.org> on 2023/03/22 15:49:00 UTC

[GitHub] [cloudstack-go] rohityadavcloud commented on a diff in pull request #49: fix asterisk encoding

rohityadavcloud commented on code in PR #49:
URL: https://github.com/apache/cloudstack-go/pull/49#discussion_r1145034272


##########
cloudstack/cloudstack.go:
##########
@@ -464,17 +464,24 @@ func (cs *CloudStackClient) newRawRequest(api string, post bool, params url.Valu
 	params.Set("command", api)
 	params.Set("response", "json")
 
-	// Generate signature for API call
+	// encode parameters
 	// * Serialize parameters, URL encoding only values and sort them by key, done by encodeValues
+	// * Replace encoded asterisk (*) back to literal.
+	//    CloudStack’s internal encoder does not encode them; this results in an authentication failure for your API call.
+	//    http://docs.cloudstack.apache.org/projects/archived-cloudstack-getting-started/en/latest/dev.html
+	// 	  Not documented http://docs.cloudstack.apache.org/en/latest/developersguide/dev.html#the-cloudstack-api
+	encodedParams := encodeValues(params)
+	encodedParams = strings.Replace(encodedParams, "%2A", "*", -1)

Review Comment:
   Would you think this also affects cmk cc @mlsorensen ? The referenced docs are quite old and writtend for Python, the more recent Go implementation in cmk uses this code for network request:
   https://github.com/apache/cloudstack-cloudmonkey/blob/main/cmd/network.go



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org