Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Add note in dev.rst about use of the safe option in urllib.quote_plus()#17

Merged
rafaelweingartner merged 1 commit intoapache:masterfrom
phillipkent:dev_add_urllib_safe_option
Apr 24, 2018
Merged

Add note in dev.rst about use of the safe option in urllib.quote_plus()#17
rafaelweingartner merged 1 commit intoapache:masterfrom
phillipkent:dev_add_urllib_safe_option

Conversation

@phillipkent
Copy link
Contributor

There is a mismatch between the URL encoding behavior of Python and CloudStack's internal URL encoder (Java URLEncoder): Python encodes * (asterisk) characters, while Java does not. When an API call contains a * character, an authentication failure will occur because the computed signatures will not agree.

The solution is to add the option "safe = '*'" to Python's urllib.quote_plus().

NOTE: I can only test this problem on CloudStack version 4.3.2 and I don't have access to later versions where the behavior might be different. But the issue was confirmed by @bhaisaab for Cloudmonkey (see apache/cloudstack-cloudmonkey#11).

@yadvr
Copy link
Member

yadvr commented Apr 8, 2016

LGTM, I tested this against ACS 4.5 whenever an API arg (of type string) has an asterisk between text (something like arg="some*value"). When @phillipkent originally opened the issue I could not reproduce this at the time, but I could reproduce this recently.

@yadvr
Copy link
Member

yadvr commented Apr 8, 2016

I've also find this to be an issue with Marvin, and the same fix works with Marvin as well. I'll be send that PR soon.

@phillipkent
Copy link
Contributor Author

@bhaisaab Just to clarify, the problem isn't when * is between other characters, it is a * anywhere in the request URL which will lead to disagreement of the signatures when CS attempts to validate the incoming API request.

@rafaelweingartner rafaelweingartner merged commit 849137d into apache:master Apr 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants