Commit Graph

9 Commits

Author SHA1 Message Date
s4na
8d46b92e30 fix(security): sanitize error responses in OpenAI-compatible APIs
## Why

The OpenAI-compatible API endpoints (`openai-http.ts`, `openresponses-http.ts`)
were returning raw `String(err)` in error responses. This can leak sensitive
internal information to HTTP clients:

- Stack traces revealing code structure
- File paths exposing server directory layout
- Internal error messages from dependencies

This is the same class of vulnerability that was fixed in #2387 for
`server-http.ts`, but these OpenAI-compatible endpoints were missed.

## What

Replace `String(err)` with safe error messages:

- **500 errors (api_error)**: Return generic "Internal server error"
- **400 errors (invalid_request_error)**: Return `err.message` only
  (no stack trace), with fallback to "Invalid request"

## Changes

- `src/gateway/openai-http.ts`: 2 catch blocks sanitized
- `src/gateway/openresponses-http.ts`: 4 catch blocks sanitized
2026-01-30 17:34:13 +09:00
Peter Steinberger
9a7160786a refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
Peter Steinberger
6d16a658e5 refactor: rename clawdbot to moltbot with legacy compat 2026-01-27 12:21:02 +00:00
Peter Steinberger
e6e71457e0 fix: honor trusted proxy client IPs (PR #1654)
Thanks @ndbroadbent.

Co-authored-by: Nathan Broadbent <git@ndbroadbent.com>
2026-01-25 01:52:19 +00:00
Peter Steinberger
f06ad4502b refactor: share responses input handling 2026-01-20 08:21:57 +00:00
Peter Steinberger
e26c647828 fix: defer pdf deps and profile flag detection 2026-01-20 08:20:07 +00:00
Peter Steinberger
bbc67f3754 fix: expand /v1/responses inputs (#1229) (thanks @RyanLisse) 2026-01-20 07:37:30 +00:00
Ryan Lisse
a5afe7bc2b feat(gateway): implement OpenResponses /v1/responses endpoint phase 2
- Add input_image and input_file support with SSRF protection
- Add client-side tools (Hosted Tools) support
- Add turn-based tool flow with function_call_output handling
- Export buildAgentPrompt for testing
2026-01-20 07:37:01 +00:00
Ryan Lisse
f4b03599f0 feat(gateway): add OpenResponses /v1/responses endpoint
Add a new `/v1/responses` endpoint implementing the OpenResponses API
standard for agentic workflows. This provides:

- Item-based input (messages, function_call_output, reasoning)
- Semantic streaming events (response.created, response.output_text.delta,
  response.completed, etc.)
- Full SSE event support with both event: and data: lines
- Configuration via gateway.http.endpoints.responses.enabled

The endpoint is disabled by default and can be enabled independently
from the existing Chat Completions endpoint.

Phase 1 implementation supports:
- String or ItemParam[] input
- system/developer/user/assistant message roles
- function_call_output items
- instructions parameter
- Agent routing via headers or model parameter
- Session key management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 07:37:01 +00:00