mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 02:33:07 +02:00
i2p: clean up SAM error logging
SESSION CREATE requests can contain the I2P private key. Keep using the redacted request text in error messages, and avoid echoing raw SAM replies in the generic reply error path. This keeps the error useful while avoiding logging either the private-key-bearing request or unescaped router-controlled reply bytes. No network behavior change is intended.
This commit is contained in:
@@ -285,7 +285,7 @@ std::string Session::Reply::Get(const std::string& key) const
|
||||
const auto& pos = keys.find(key);
|
||||
if (pos == keys.end() || !pos->second.has_value()) {
|
||||
throw std::runtime_error(
|
||||
strprintf("Missing %s= in the reply to \"%s\": \"%s\"", key, request, full));
|
||||
strprintf("Missing %s= in the reply to \"%s\"", key, request));
|
||||
}
|
||||
return pos->second.value();
|
||||
}
|
||||
@@ -320,7 +320,7 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
|
||||
|
||||
if (check_result_ok && reply.Get("RESULT") != "OK") {
|
||||
throw std::runtime_error(
|
||||
strprintf("Unexpected reply to \"%s\": \"%s\"", request, reply.full));
|
||||
strprintf("Reply to \"%s\": had a RESULT not equal to OK.", reply.request));
|
||||
}
|
||||
|
||||
return reply;
|
||||
|
||||
Reference in New Issue
Block a user