[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user