From b6c367044288f83ab61c1a77ad34c33adf39ecf6 Mon Sep 17 00:00:00 2001 From: takeshikurosawaa <204226757+takeshikurosawaa@users.noreply.github.com> Date: Fri, 15 May 2026 15:48:33 +0300 Subject: [PATCH] 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. --- src/i2p.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i2p.cpp b/src/i2p.cpp index 04093ea1007..03513576c45 100644 --- a/src/i2p.cpp +++ b/src/i2p.cpp @@ -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;