-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query strings with arrays cannot be properly signed #39
Comments
@nicktacular Please help us understand a bit more about this issue by providing more information.
|
@stevenmaguire I responded with a few more details in #42 but I can provide more detail here.
Currently, I see there being 2 different, but related issues:
I think we can solve in this manner. Create an interface called Thoughts? |
Awesome, Thanks for providing this! Can you add a bit more clarity to these responses?
Are these parameters being used to create entities? to filter a query of existing entities?
Can you provide a specific example of a request query string that is causing some problems? I do think the two points you've made are valid, I am trying to discern the scope of the use case you are experiencing. Service providers implement OAuth (1 and 2!) inconsistently. I want to understand the instigator of this issue to research whether or not other providers, at least the ones I know of, are susceptible. It is worth noting that another project had this same discussion and the root of the initial concern was more enlightening than the solution being proposed. woocommerce/woocommerce#7833 |
Edit: Same issue here when passing a multidimensional array as the |
@stevenmaguire - I've not had time to work on this. I will get to this sometime later this month. Thanks. |
… signature. Fixes thephpleague#39 With this implementation, multi-dimensional arrays can be passed to League\OAuth1\Client\Server::getHeaders() and be correctly transformed. For prior art, consider the WP REST API - OAuth 1.0a Server plugin. specifically: * [https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L667-L674](https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L667-L674) * [https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L706-L753](https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L706-L753)
… signature. Fixes thephpleague#39 With this implementation, multi-dimensional arrays can be passed to League\OAuth1\Client\Server::getHeaders() and be correctly transformed. For prior art, consider the WP REST API - OAuth 1.0a Server plugin. specifically: * [https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L667-L674](https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L667-L674) * [https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L706-L753](https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L706-L753)
Hi guys, any updates on this? |
Ignore previous comment ;) |
Allow mult-dimension arrays when generating base string for HMAC-SHA1 signature. Fixes #39
I've encountered an issue whereby if you create a service that extends
League\OAuth1\Client\Server\Server
and use$this->getHeaders(...)
with a query string that has array notation (i.e.var[]=whatever
) then the URL cannot be properly signed.Here's an example:
This generates a warning:
Warning: rawurlencode() expects parameter 1 to be string, array given in /my/proj/vendor/league/oauth1-client/src/Client/Signature/HmacSha1Signature.php on line 66
Which means that the service is sending an invalid signature.
When I dug deeper, it looks like the method
League\OAuth1\Client\Signature\HmacSha1Signature::baseString
does not properly operate on such nested arrays. Specifically this line:$data[rawurlencode($key)] = rawurlencode($value);
. The methodrawurlencode
doesn't know how to act on an array.Is this a bug or did I miss another way to sign a URL here?
Client version: 1.6.1
The text was updated successfully, but these errors were encountered: