mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Improve JSON sanitization in reporting mode
This commit is contained in:
committed by
Nik Bougalis
parent
b0b44d32bd
commit
d458e9972b
@@ -72,7 +72,7 @@ shouldForwardToP2p(RPC::JsonContext& context)
|
||||
if (params.isMember(jss::ledger_index))
|
||||
{
|
||||
auto indexValue = params[jss::ledger_index];
|
||||
if (!indexValue.isNumeric())
|
||||
if (indexValue.isString())
|
||||
{
|
||||
auto index = indexValue.asString();
|
||||
return index == "current" || index == "closed";
|
||||
|
||||
@@ -873,9 +873,23 @@ ServerHandlerImp::processRequest(
|
||||
params,
|
||||
{user, forwardedFor}};
|
||||
Json::Value result;
|
||||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
RPC::doCommand(context, result);
|
||||
|
||||
try
|
||||
{
|
||||
RPC::doCommand(context, result);
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
result = RPC::make_error(rpcINTERNAL);
|
||||
JLOG(m_journal.error()) << "Internal error : " << ex.what()
|
||||
<< " when processing request: "
|
||||
<< Json::Compact{Json::Value{params}};
|
||||
}
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
|
||||
logDuration(params, end - start, m_journal);
|
||||
|
||||
usage.charge(loadType);
|
||||
|
||||
Reference in New Issue
Block a user