Skip to content

fix(gateway): redact public error responses - #105

Open
XnLemon wants to merge 1 commit into
mainfrom
codex/phase2-gateway-server-error-redaction
Open

fix(gateway): redact public error responses#105
XnLemon wants to merge 1 commit into
mainfrom
codex/phase2-gateway-server-error-redaction

Conversation

@XnLemon

@XnLemon XnLemon commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Objective

Close the next Phase2 public error-redaction gap by preventing gateway, gwclient, and OpenAI-compatible server error responses from exposing raw sensitive runtime details.

Completed Changes

  • Added fail-closed public error redaction helpers for OpenClaw gateway, gwclient, and server/openai.
  • Redacted OpenClaw gateway HTTP /messages, /messages:stream, cancel/decode errors, runner errors, stream result errors, and APIError events before they are returned to clients.
  • Redacted gwclient stream parse/read errors before emitting local run.error stream events.
  • Redacted OpenAI-compatible error response bodies produced by formatError.
  • Added regression coverage for Authorization, token, api_key, secret, password, and Cookie leakage across gateway, stream, gwclient, and OpenAI-compatible errors.

Validation

  • In openclaw: go test ./internal/gateway -count=1 -run 'TestServer_ProcessMessage_RunError|TestServer_StreamMessage_RunError|TestServer_StreamMessage_APIErrorEvent'
  • In openclaw: go test ./gwclient -count=1 -run 'TestClient_StreamMessage_ParseErrorEmitsRunError|TestParseSSEStream_EventFallbackAndErrors'
  • In openclaw: go vet ./internal/gateway ./gwclient
  • From repo root: go test ./server/openai -count=1 -run 'TestFormatError'
  • From repo root: go vet ./server/openai
  • git diff --check
  • Subagent open-code-review loop completed with 0 High / 0 Medium / 0 Low.

Known Risks / Limitations

  • This increment targets public/model-visible error responses only; internal logs/debug traces may still record raw errors where appropriate for diagnostics.
  • Redaction helpers are local to these packages to avoid broad package API churn in this small increment.

Follow-up Work

  • Continue Phase2 closure by scanning and tightening any remaining model-visible error paths outside gateway/server public responses.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@XnLemon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 24d1a87f-5622-4c1d-b8a4-4b5753955510

📥 Commits

Reviewing files that changed from the base of the PR and between 361e2a4 and 10d9e6a.

📒 Files selected for processing (11)
  • openclaw/gwclient/client_test.go
  • openclaw/gwclient/error_redaction.go
  • openclaw/gwclient/stream.go
  • openclaw/internal/gateway/error_redaction.go
  • openclaw/internal/gateway/process.go
  • openclaw/internal/gateway/server.go
  • openclaw/internal/gateway/server_test.go
  • openclaw/internal/gateway/stream.go
  • server/openai/converter.go
  • server/openai/converter_test.go
  • server/openai/error_redaction.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/phase2-gateway-server-error-redaction

Comment @coderabbitai help to get the list of available commands.

@XnLemon
XnLemon force-pushed the codex/phase2-runtime-gateway-error-redaction branch from b2770ff to cca7b08 Compare July 11, 2026 13:39
@XnLemon
XnLemon force-pushed the codex/phase2-gateway-server-error-redaction branch from 292d8b8 to b8a1f25 Compare July 11, 2026 13:39
@XnLemon
XnLemon changed the base branch from codex/phase2-runtime-gateway-error-redaction to main July 13, 2026 02:24
@XnLemon
XnLemon force-pushed the codex/phase2-gateway-server-error-redaction branch from b8a1f25 to 10d9e6a Compare July 13, 2026 02:35
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.

2 participants