redis-store / redis-rack-cache

Redis stores for Rack::Cache

Home Page:http://redis-store.org/redis-rack-cache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Password having special characters breaks URI format

t-anjan opened this issue · comments

Reference:

Azure's redis cache service provides passwords (access keys, in their terminology) which contain special characters like /, +, =, etc.

The redis-rack-cache gem supports only the URI format to specify redis connection parameters for the metastore and entitystore. Passwords like the above breaks the URI format.

The solution, as mentioned in the referred links above, is to CGI::escape the password in the URI. When parsing the URI, the password should be CGI::unescaped. The unescaping part is currently not happening.

I traced the issue to lib/redis/store/factory.rb in the redis-store/redis-store repo. I have made a commit which I think should solve the problem. Please comment.

I am finding it hard to believe nobody has faced this problem before.

I am finding it hard to believe nobody has faced this problem before.

Azure's redis cache service provides passwords (access keys, in their terminology) which contain special characters like /, +, =, etc.

I think you answered your own question. Who the hell uses Azure? ;-)

Anyway, this seems like a solid bug fix. Please ensure you have tests written proving your change actually works, and make a pull request to this repository. Pretty sure I'll be holding off on a release until after Rails 5's final version comes out, but it's still good to get the code in anyway.

@t-anjan Good news! The CGI.unescape fix here has been merged into redis-store. Can you give the latest version of redis-store a shot and see if that fixes your problem? Should also fix the issue if you use redis-store for rails/sidekiq cache or session storage

redis-store/redis-store#284
redis-store/redis-store#280

I don't currently use Azure's Redis-as-a-service. I use a Linux VM with Redis installed. So, I won't be able to test the fix. But, good to know that the issue has been fixed, finally! Thank you!