[fix](trx-server): truncate raw JSON in error logs to 128 chars

Prevent potential information disclosure by truncating raw client input
in log messages instead of logging the full payload.

https://claude.ai/code/session_01XzurkeuUmamBuhQwxVy7T4
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-25 22:43:15 +00:00
committed by Stan Grams
parent edf16b63d6
commit c299e9a2d2
+7 -1
View File
@@ -201,7 +201,13 @@ async fn handle_client(
let envelope = match parse_envelope(trimmed) {
Ok(envelope) => envelope,
Err(e) => {
error!("Invalid JSON from {}: {} / {:?}", addr, trimmed, e);
// Truncate raw input in logs to prevent information disclosure.
let preview = if trimmed.len() > 128 {
format!("{}...", &trimmed[..128])
} else {
trimmed.to_string()
};
error!("Invalid JSON from {}: {} / {:?}", addr, preview, e);
let resp = ClientResponse {
success: false,
rig_id: None,