fix: sanitize internal error details in bot proxy responses#1310
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Apr 9, 2026
Merged
fix: sanitize internal error details in bot proxy responses#1310qin-ctx merged 1 commit intovolcengine:mainfrom
qin-ctx merged 1 commit intovolcengine:mainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0cbf0f7 to
060b89a
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
qin-ctx
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The bot proxy router leaked internal infrastructure details to API clients via error response messages:
httpx.RequestErrorpaths (lines 65, 131, 196): formatted the exception asf"Bot service unavailable: {str(e)}", which exposes internal hostnames, IP addresses, port numbers, and connection error specifics fromhttpx.httpx.HTTPStatusErrorpaths (lines 71, 143, 203): forwarded the raw upstream response body asf"Bot service error: {e.response.text}", which may contain internal service error details, stack traces, or debug output.This is an information disclosure vulnerability — clients can fingerprint internal network topology and service behavior from error responses alone.
Fix
Replace all six dynamic error detail strings with static generic messages:
"Bot service unavailable"for connection/transport errors"Bot service error"for upstream HTTP error responsesNo observability is lost:
logger.error(...)calls immediately preceding eachraise HTTPExceptionalready capture the full error context server-side.Also removes a stray
print()debug statement inhealth_checkthat was present in the upstream branch.Related
Related to #1233 (same class of information disclosure via error responses).
Testing
httpx.RequestError: verify response body is{"detail": "Bot service unavailable"}with no hostname/IP/port leakage.{"detail": "Bot service error"}with no upstream response body forwarded.{"error": "Bot service unavailable"}/{"error": "Bot service error"}with no internal details.