Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.1] validate input of set_whitelist_blacklist, add_greylist_accounts and remove_greylist_accounts #113

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Sep 7, 2022

Resolve #86

Add input validation for set_whitelist_blacklist, add_greylist_accounts and remove_greylist_accounts by ensuring at least one optional parameter is present in a RPC call.

Previously,

curl -d '{"foo":["bar"]}' http://127.0.0.1:8888/v1/producer/set_whitelist_blacklist
{"result":"ok"}

Now,

curl -d '{"foo":["bar"]}' http://127.0.0.1:8888/v1/producer/set_whitelist_blacklist
{"code":400,"message":"Invalid Request","error":{"code":3200006,"name":"invalid_http_request","what":"invalid http request","details":[{"message":"At least one of actor_whitelist, actor_blacklist, contract_whitelist, contract_blacklist, action_blacklist, and key_blacklist is required","file":"producer_plugin.cpp","line_number":1382,"method":"set_whitelist_blacklist"}]}}~/work/validate_input_3_1/plugins
curl -d '{"accounts":[]}' http://127.0.0.1:8888/v1/producer/add_greylist_accounts
{"code":400,"message":"Invalid Request","error":{"code":3200006,"name":"invalid_http_request","what":"invalid http request","details":[{"message":"At least one account is required","file":"producer_plugin.cpp","line_number":1338,"method":"add_greylist_accounts"}]}}
curl -d '{"accounts":[]}' http://127.0.0.1:8888/v1/producer/remove_greylist_accounts
{"code":400,"message":"Invalid Request","error":{"code":3200006,"name":"invalid_http_request","what":"invalid http request","details":[{"message":"At least one account is required","file":"producer_plugin.cpp","line_number":1347,"method":"remove_greylist_accounts"}]}}

Copy link
Member

@heifner heifner left a comment

Choose a reason for hiding this comment

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

This is targeting main, but marked as 3.1. It needs to target release/3.1.

@linh2931
Copy link
Member Author

linh2931 commented Sep 7, 2022

Thanks for noticing this! I intended it for release/3.1 but somehow picked a wrong branch to compare. Will open a new PR for release/3.1 and discard this one.

@heifner heifner changed the base branch from main to release/3.1 September 7, 2022 19:57
@heifner
Copy link
Member

heifner commented Sep 7, 2022

Thanks for noticing this! I intended it for release/3.1 but somehow picked a wrong branch to compare. Will open a new PR for release/3.1 and discard this one.

Sometimes you can just change the base, worked this time.

@linh2931
Copy link
Member Author

linh2931 commented Sep 7, 2022

Thanks one more time for changing base branch for me!

@linh2931 linh2931 merged commit fc96431 into release/3.1 Sep 7, 2022
@linh2931 linh2931 deleted the validate_set_blacklist_whitelist_input branch September 7, 2022 20:06
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.

Insufficient input validation on set_whitelist_blacklist, add_greylist_accounts, remove_greylist_accounts
2 participants