redis-commander
redis-commander copied to clipboard
Binary value setted automatic without binary payload
Hi, I've been using redis commander from a lot time ago, thank you very much to constantly update the project!
Today I've got a strange behaviors: after saving a big JSON string, unfortunately I can't attach the JSON string because contains sensitive data, the type was converted from string to binary.
I think the issue is caused by this regex check https://github.com/joeferner/redis-commander/blob/031025a91f80c0d9f765bbe6dfe580fc97d16a9f/lib/routes/apiv1.js#L387-L395 which is probably to comprensive and match also escaped JSON chars.
The above regex check and binary infer was made to satisfy https://github.com/joeferner/redis-commander/issues/140 but I think is better to add a new specific type for the binary behavior instead of inferring it.
To fix this actually I run a patched version without the auto binary type infer but would be good if the commit https://github.com/joeferner/redis-commander/commit/031025a91f80c0d9f765bbe6dfe580fc97d16a9f will be reverted on master because is broken :)
Thank you very much,
Adding a specific type for binary data whould be good but unfortunately redis dos not have its own type for binary data - binary data stored will output "string" on redis side. Due to this all generic clients need to guess what data it might get...
To not detect wrong "binary" data could you please provide the output of the redis "type" command of your JSON data and what they actualy do look like (queried via redis cli tool or similiar)?
Than it might be possible to improve the regex to not detect these as binary. And i will add a config flag to disable binary data detection globally.. This might help more people the a plain revert.
and naah - not broken - just dont work as you like :-)
To not force you maintaining your own branch i added env var BINARY_AS_HEX
that you can set to a falsy value to disable this behaviour completly :-) Or modify your config file (if you have one) - do as you like.
But will be nice to get an example of the data you had that triggered the binary view that you did not liked. Than i try to update the regex to not match here. But need an example.
@alessandro-aglietti do you have an example for this JSON? Would like to improve the binary detection but need help here... Otherwise can it be closed?