Potential fix for code scanning alert no. 4045: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Ishaan Jaff 2026-02-03 15:14:10 -08:00 • committed by GitHub
parent 0c3c1d4c70
commit 77cfaa0870
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -102,12 +102,17 @@ async def _handle_stream_message(
else:
yield "data: " + json.dumps(chunk) + "\n\n"
except Exception as e:
verbose_proxy_logger.exception(f"Error streaming A2A response: {e}")
# Log full exception details server-side for debugging
verbose_proxy_logger.exception("Error streaming A2A response")
# Return a generic error message to the client without exposing internal details
yield "data: " + json.dumps(
{
"jsonrpc": "2.0",
"id": request_id,
"error": {"code": -32603, "message": f"Streaming error: {str(e)}"},
"error": {
"code": -32603,
"message": "Streaming error",
},
}
) + "\n\n"