Skip to content

fix(security): remove rawResponse field from analyze error response - #874

Open
Esc1200 wants to merge 1 commit into
vibeforge1111:mainfrom
Esc1200:spark/fix-analyze-raw-response-leak
Open

fix(security): remove rawResponse field from analyze error response#874
Esc1200 wants to merge 1 commit into
vibeforge1111:mainfrom
Esc1200:spark/fix-analyze-raw-response-leak

Conversation

@Esc1200

@Esc1200 Esc1200 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Bug: Error response in /api/analyze leaks raw Claude API response text

Severity: MEDIUM

File: src/routes/api/analyze/+server.ts (line 269)

Problem:
When the Claude API response fails to parse, the error handler includes rawResponse: textContent.text.slice(0, 500) in the 502 response body. This leaks the first 500 characters of the raw LLM output to the client, which may contain:

  • Internal prompt fragments or system instructions
  • API response metadata
  • Other sensitive backend configuration details

Fix:
Removed the rawResponse field from the error response JSON. The raw response text is still logged server-side via log.error() for debugging, but is no longer exposed to clients.

Testing:

  • Error response no longer includes raw LLM content
  • Server-side logging remains intact for operational debugging

The /api/analyze error handler included rawResponse: textContent.text.slice(0, 500)
in the 502 error response, leaking the first 500 characters of the raw Claude API
response to the client. This is an information disclosure vulnerability (MEDIUM)
that could expose internal prompt content, API response structure, or other
sensitive data returned by the upstream LLM service.

The raw response is still logged server-side for debugging (log.error) but is
no longer sent to the client.
ifeoluwaaj pushed a commit to ifeoluwaaj/vibeship-spawner-ui that referenced this pull request Jun 27, 2026
Consolidates a same-author path-redaction series:
- Remove tracePath from creator mission GET response (vibeforge1111#877)
- Remove server path from mission active POST response (vibeforge1111#876)
- Remove rawResponse field from analyze error response (vibeforge1111#874)
- Remove x-spark-preview-root header leaking server path (vibeforge1111#873)
- Use trusted x-real-ip / last x-forwarded-for entry for the
  rate-limiter client key (vibeforge1111#875)

Surviving-line indentation normalized back to file style (the patches
bundled an over-indentation reflow of untouched lines).

Co-authored-by: Esc1200 <Esc1200@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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