Skip to content

🛡️ Sentinel: [security improvement] Prevent sensitive data leak in HTTP client error logging#46

Draft
badMade wants to merge 1 commit into
mainfrom
security-fix-log-leak-16030927670522045557
Draft

🛡️ Sentinel: [security improvement] Prevent sensitive data leak in HTTP client error logging#46
badMade wants to merge 1 commit into
mainfrom
security-fix-log-leak-16030927670522045557

Conversation

@badMade

@badMade badMade commented May 23, 2026

Copy link
Copy Markdown
Owner

🛡️ Sentinel: [MEDIUM] Fix sensitive data leak in HTTP client error logging

🚨 Severity: MEDIUM
💡 Vulnerability: When Axios throws an error, the full error object includes the request configuration, which contains HTTP headers. Logging the entire error using console.error(error) exposes any Authorization headers, API tokens, or secrets to the log stream.
🎯 Impact: If these logs are ingested by a centralized logging system, secrets are leaked in plain text, potentially leading to unauthorized access.
🔧 Fix: Modified the console.error statements in src/openapi-mcp-server/client/http-client.ts and src/openapi-mcp-server/mcp/proxy.ts to log an object containing only safe, destructured properties (e.g., error.message, error.name, error.response?.status).
Verification:

  1. Ran npx vitest run --passWithNoTests to verify no regressions in tests.
  2. Simulated HTTP requests that fail, verifying that the console outputs an object with only message, name, and status, omitting the sensitive request configuration completely.

PR created automatically by Jules for task 16030927670522045557 started by @badMade

Modifies `console.error` statements in the HTTP client and proxy to log
safe properties (message, name, status) instead of full Axios/HTTP error
objects. This prevents sensitive information like `Authorization` headers
or API keys embedded in the request configuration from being leaked to
logs.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves security and log clarity by sanitizing error logs in the HttpClient and MCPProxy classes. Instead of logging full error objects, which could potentially leak sensitive information from headers or configurations, the code now logs specific safe properties such as message, name, and status. A review comment identifies a redundant log statement in the MCPProxy tool call handler that should be removed to reduce log noise, as the error information is already captured in a preceding log entry.

Comment on lines 107 to 112
if (error instanceof HttpClientError) {
console.error('HttpClientError encountered, returning structured error', error)
console.error('HttpClientError encountered, returning structured error', {
message: error.message,
status: error.status,
})
const data = error.data?.response?.data ?? error.data ?? {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This log statement is redundant. The error has already been logged at line 102 with the same information (message, name, and status). Removing this second log will reduce noise in the log stream while still providing the necessary diagnostic information.

        if (error instanceof HttpClientError) {
          const data = error.data?.response?.data ?? error.data ?? {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant