rpc: don't display invalid json errors on default log level

It's not something the user needs to know, and will display
attacker controlled data
This commit is contained in:
moneromooo-monero 2020-04-28 14:05:41 +00:00
parent 25419b4bfb
commit 5285ecc3d6
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
2 changed files with 6 additions and 6 deletions

View File

@ -100,7 +100,7 @@ static const char *get_default_categories(int level)
switch (level) switch (level)
{ {
case 0: case 0:
categories = "*:WARNING,net:FATAL,net.http:FATAL,net.ssl:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,serialization:FATAL,daemon.rpc.payment:ERROR,stacktrace:INFO,logging:INFO,msgwriter:INFO"; categories = "*:WARNING,net:FATAL,net.http:FATAL,net.ssl:FATAL,net.p2p:FATAL,net.cn:FATAL,daemon.rpc:FATAL,global:INFO,verify:FATAL,serialization:FATAL,daemon.rpc.payment:ERROR,stacktrace:INFO,logging:INFO,msgwriter:INFO";
break; break;
case 1: case 1:
categories = "*:INFO,global:INFO,stacktrace:INFO,logging:INFO,msgwriter:INFO,perf.*:DEBUG"; categories = "*:INFO,global:INFO,stacktrace:INFO,logging:INFO,msgwriter:INFO,perf.*:DEBUG";

View File

@ -270,25 +270,25 @@ namespace cryptonote
{ {
if (!m_restricted && nettype() != FAKECHAIN) if (!m_restricted && nettype() != FAKECHAIN)
{ {
MERROR("RPC payment enabled, but server is not restricted, anyone can adjust their balance to bypass payment"); MFATAL("RPC payment enabled, but server is not restricted, anyone can adjust their balance to bypass payment");
return false; return false;
} }
cryptonote::address_parse_info info; cryptonote::address_parse_info info;
if (!get_account_address_from_str(info, nettype(), address)) if (!get_account_address_from_str(info, nettype(), address))
{ {
MERROR("Invalid payment address: " << address); MFATAL("Invalid payment address: " << address);
return false; return false;
} }
if (info.is_subaddress) if (info.is_subaddress)
{ {
MERROR("Payment address may not be a subaddress: " << address); MFATAL("Payment address may not be a subaddress: " << address);
return false; return false;
} }
uint64_t diff = command_line::get_arg(vm, arg_rpc_payment_difficulty); uint64_t diff = command_line::get_arg(vm, arg_rpc_payment_difficulty);
uint64_t credits = command_line::get_arg(vm, arg_rpc_payment_credits); uint64_t credits = command_line::get_arg(vm, arg_rpc_payment_credits);
if (diff == 0 || credits == 0) if (diff == 0 || credits == 0)
{ {
MERROR("Payments difficulty and/or payments credits are 0, but a payment address was given"); MFATAL("Payments difficulty and/or payments credits are 0, but a payment address was given");
return false; return false;
} }
m_rpc_payment_allow_free_loopback = command_line::get_arg(vm, arg_rpc_payment_allow_free_loopback); m_rpc_payment_allow_free_loopback = command_line::get_arg(vm, arg_rpc_payment_allow_free_loopback);
@ -308,7 +308,7 @@ namespace cryptonote
if (!set_bootstrap_daemon(command_line::get_arg(vm, arg_bootstrap_daemon_address), if (!set_bootstrap_daemon(command_line::get_arg(vm, arg_bootstrap_daemon_address),
command_line::get_arg(vm, arg_bootstrap_daemon_login))) command_line::get_arg(vm, arg_bootstrap_daemon_login)))
{ {
MERROR("Failed to parse bootstrap daemon address"); MFATAL("Failed to parse bootstrap daemon address");
return false; return false;
} }