Skip to content

[MultiDB] sonic-utilities - replace redis-cli/redis-dump with sonic-db-cli/sonic-db-dump#810

Merged
qiluo-msft merged 3 commits intosonic-net:masterfrom
dzhangalibaba:multidb
Feb 28, 2020
Merged

[MultiDB] sonic-utilities - replace redis-cli/redis-dump with sonic-db-cli/sonic-db-dump#810
qiluo-msft merged 3 commits intosonic-net:masterfrom
dzhangalibaba:multidb

Conversation

@dzhangalibaba
Copy link
Copy Markdown
Contributor

Signed-off-by: Dong Zhang [email protected]

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

depends on sonic-net/sonic-py-swsssdk#62, need sonic-db-dump command merged first

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

retest this please

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

@qiluo-msft

local db_name=$2
save_cmd "redis-dump -d $db -s /var/run/redis/redis.sock -y" "$db_name.json"
local db_name=$1
save_cmd "sonic-db-dump -n $db_name -y" "$db_name.json"
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$db_name [](start = 31, length = 8)

Escape it to prevent input injection. #Closed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this what you mean to?

Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft Feb 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I mean quotation instead of escaping the $db_name variable. If it is quoted properly, sonic-db-dump will find malicious input easily.
No need to add new restriction on db_name here.


In reply to: 377958584 [](ancestors = 377958584)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. GOT IT. UPDATED

Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comment

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

retest this please

4 similar comments
@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

retest this please

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

retest this please

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

retest this please

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

retest this please

@dzhangalibaba
Copy link
Copy Markdown
Contributor Author

sonic-net/sonic-py-swsssdk#62. already in, can we merge this now ? @qiluo-msft

@qiluo-msft qiluo-msft merged commit 66e9dfb into sonic-net:master Feb 28, 2020
@dzhangalibaba dzhangalibaba deleted the multidb branch April 14, 2020 00:21
abdosi pushed a commit to abdosi/sonic-utilities that referenced this pull request Aug 4, 2020
…b-cli/sonic-db-dump (sonic-net#810)

* [MultiDB] sonic-utilities - replace redis-cli/redis-dump with sonic-db-cli/sonic-db-dump
* only accept upper and underscore to prevent injection
* quotation on db_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants