inspector/server/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Cliff Hall 4df119117e
fix(server): sanitize error responses to prevent stack trace exposure (#1187)
* fix(server): sanitize error responses to prevent stack trace exposure

Replace raw error objects passed to res.json() with generic sanitized
messages so internal error details are not leaked to clients. Full
errors continue to be logged server-side via console.error.

Also adds a missing return in the /sse ECONNREFUSED branch, which
previously fell through and attempted a second response after headers
had already been sent.

Resolves CodeQL js/stack-trace-exposure alerts in server/src/index.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(server): address review feedback on error sanitization

- Sanitize /fetch route catch block: previously leaked error.message to
  clients and silently swallowed errors with no server-side logging.
  Now logs via console.error and returns a generic sanitized response.

- Replace JSON.stringify(error).includes("ECONNREFUSED") in the /sse
  handler with a check against error.message and String(error.cause).
  Error fields are non-enumerable so JSON.stringify(new Error(...))
  produces "{}" — the old check only worked by accident when the error
  happened to carry enumerable properties.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ola Hungerford <olahungerford@gmail.com>
2026-04-12 13:53:33 -07:00
..
index.ts fix(server): sanitize error responses to prevent stack trace exposure (#1187) 2026-04-12 13:53:33 -07:00
mcpProxy.ts Addressed all Claude review issues. 2026-04-07 10:33:28 -07:00