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 -> main] Validate set whitelist blacklist input main #114

Merged
merged 3 commits into from
Sep 7, 2022

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Sep 7, 2022

Resolve #86
Merge #113 from release/3.1 to main

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"}]}}

linh2931 and others added 3 commits September 7, 2022 15:13
…ist_input

[3.1] validate input of set_whitelist_blacklist, add_greylist_accounts and remove_greylist_accounts
@linh2931 linh2931 merged commit 48caccb into main Sep 7, 2022
@linh2931 linh2931 deleted the validate_set_whitelist_blacklist_input_main branch September 7, 2022 21:12
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