mgomes / api_auth

HMAC authentication for Rails and HTTP Clients
MIT License
480 stars 147 forks source link

URI edge case: having another URI in the URI #149

Closed zfletch closed 7 years ago

zfletch commented 7 years ago

The regular expression used in the ApiAuth::Headers#parse_uri method matches all strings that look like hosts in the uri, not only the real host.

For example, https://www.google.com/?redirect_to=https://www.example.com is turned into /?redirect_to= when it should be /?redirect_to=https://www.example.com.

This commit adds a test for that case and fixes it by using Ruby's URI.parse method instead of a custom regexp.