redis-commander icon indicating copy to clipboard operation
redis-commander copied to clipboard

Unable to see value of specific string keys

Open WatersJohn opened this issue 5 years ago • 7 comments

We've noticed that we're unable to see the values of certain keys that we create programattically in redis. If we create them manually via redis-commander they appear. They also appear when using RedisInsight, so this appears to be unique to redis commander. Example of a key:

RC

The only other item that is notable is that this entry has no TTL. We expected to see a value of True or False displayed under the key name, but instead see nothing.
The other item that's notable is that we've changed the default folding character from : to |. However, reverting that change made no impact.

WatersJohn avatar Feb 18 '20 14:02 WatersJohn

I've since discovered that this only occurs when hosting redis-commander in Azure under node 12.13 on Windows. The same code works fine locally on a VM with node 12.16; I doubt this is a version issue but Azure does not yet have 12.16 available.

WatersJohn avatar Feb 21 '20 03:02 WatersJohn

Hi - can you please give some more informations to find out whats different?

  • Redis server version?
  • Output of redis command "TYPE <problematic_key>"?
  • Output of redis command "GET <problematic_key>"?

And you said problem only happens on Azure. I assume booth redis commander (Azure and local) use the same Redis server to display data from?

sseide avatar Feb 21 '20 12:02 sseide

Thanks for replying! The version of redis is 4.0.14. Correct - redis commander on local and Azure point to the same Redis server.

TYPE <problematic_key> is "string" GET <problematic_key> is "True"

WatersJohn avatar Feb 21 '20 17:02 WatersJohn

One more item - this appears to occur when there is a // in the keyname. ex: SET Test-https://www.test.com/site False displays in redis-commander as Test-https:/www.test.com/site,with no value displayed. however, GET Test-https://www.test.com/site works and shows the value.

WatersJohn avatar Feb 21 '20 17:02 WatersJohn

currently i am unable to reproduce it and i have no clue about he reasons. I tested with the latest version from github (master branch).

Are there some error messages inside the browsers javascript console? No log messages of redis commander server process?

The Azure redis is a Azure db as a service or something you started yourself (VM or container or something like it).

sseide avatar Feb 27 '20 12:02 sseide

btw - the docker image is currently running on Node 8, Node 10 should work fine too if its a problem with the node version inside Azure...

sseide avatar Feb 27 '20 16:02 sseide

Hi,

Same problem here. For us it's due to a nginx proxy pass (https://serverfault.com/questions/459369/disabling-url-decoding-in-nginx-proxy)

For example if your key is a:b:{"url","https,//c.com"}

then redis-commander will call /key/<some-connectionId>/a%3Ab%3A%7B"url"%2C"https%2C%2F%2Fc.com"%7D that will become /key/<some-connectionId>/a:b:{"url","https,/c.com"} (with one slash) when received by redis-commander server.

if you want @sseide i can create a PR with a function like this on front side to build key in url :

window.btoa('a:b:{"url","https,//c.com"}')
    .replace(/\+/g, '-') // (https://en.wikipedia.org/wiki/Base64#Base64_table)
    .replace(/\//g, '_')
    .replace(/=/g, '.')
// => 'YTpiOnsidXJsIiwiaHR0cHMsLy9jLmNvbSJ9'

and then on server-side to get the original key back

Buffer.from(
    'YTpiOnsidXJsIiwiaHR0cHMsLy9jLmNvbSJ9'
      .replace(/-/g, '+')
      .replace(/_/g, '/')
      .replace(/\./g, '='),
    'base64',
  ).toString()

//  => `a:b:{"url","https,//c.com"}`

it will protect the key integrity no matter the architecture above

cbazureau avatar Nov 08 '21 10:11 cbazureau