mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
APIv2(account_info): handle invalid "signer_lists" value (#4585)
When requesting `account_info` with an invalid `signer_lists` value, the API should return an "invalidParams" error. `signer_lists` should have a value of type boolean. If it is not a boolean, then it is invalid input. The response now indicates that. * This is an API breaking change, so the change is only reflected for requests containing `"api_version": 2` * Fix #4539
This commit is contained in:
@@ -125,6 +125,15 @@ doAccountInfo(RPC::JsonContext& context)
|
||||
}
|
||||
result[jss::account_flags] = std::move(acctFlags);
|
||||
|
||||
// The document states that signer_lists is a bool, however
|
||||
// assigning any string value works. Do not allow this.
|
||||
// This check is for api Version 2 onwards only
|
||||
if (!params[jss::signer_lists].isBool() && context.apiVersion > 1)
|
||||
{
|
||||
RPC::inject_error(rpcINVALID_PARAMS, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Return SignerList(s) if that is requested.
|
||||
if (params.isMember(jss::signer_lists) &&
|
||||
params[jss::signer_lists].asBool())
|
||||
|
||||
Reference in New Issue
Block a user