Skip to content

Commit 1e1b6b3

Browse files
committed
fix(proxy): don't expose upstream exception detail in passthrough 502
The RemoteProtocolError handler added for the #1112 transient-retry fix interpolated the raw httpx exception into the JSON error message returned to the external client, so upstream stack-trace/exception text could leak to callers (CodeQL py/stack-trace-exposure, alert #136 at openai.py:6341). Keep the full exception in the server-side logger.warning (unchanged) and return a generic "upstream closed the connection without sending a complete response" message with the same 502 status. Only the flagged path is touched; behaviour and the existing 502 contract are otherwise unchanged.
1 parent 5ffdf21 commit 1e1b6b3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎headroom/proxy/handlers/openai.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6486,9 +6486,13 @@ async def handle_passthrough(
64866486
{
64876487
"error": {
64886488
"type": "upstream_protocol_error",
6489+
# Full exception detail is logged server-side above;
6490+
# keep the client-facing message generic so upstream
6491+
# exception/stack-trace text is not exposed (CodeQL
6492+
# py/stack-trace-exposure).
64896493
"message": (
64906494
"Upstream closed the connection without sending "
6491-
f"a complete response: {e}"
6495+
"a complete response."
64926496
),
64936497
}
64946498
}

0 commit comments

Comments
 (0)