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:
Peter Chen
2023-06-30 02:05:21 -04:00
committed by GitHub
parent 1cb67fbd20
commit f18c6dfea7
2 changed files with 20 additions and 0 deletions

View File

@@ -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())