fix(security): remove error details from HTTP 500 response (#12)

The 500 error response previously included the raw error message {e}
in the body, potentially leaking internal implementation details (SDP
parse errors, ICE candidate info) to clients.

The detailed error is already logged server-side via tracing::error!,
so the response body is now a fixed generic string with a proper
HTTP/1.1 status line.
This commit is contained in:
dailz
2026-06-06 21:22:57 +08:00
parent 1beaea8088
commit 8b04893ceb

View File

@@ -210,7 +210,7 @@ impl WebRtcState {
}
Err(e) => {
tracing::error!("SDP offer handling failed: {e}");
let resp = format!("HTTP/1.1 500 Error\r\nConnection: close\r\n\r\n{e}");
let resp = "HTTP/1.1 500 Internal Server Error\r\nConnection: close\r\n\r\n";
let _ = stream.write_all(resp.as_bytes());
}
}