Skip to content

fix(voice-call): redact credential material from provider error bodies - #117304

Merged
RomneyDa merged 2 commits into
openclaw:mainfrom
zenglingbiao:fix/voice-call-redact-error-snippet
Aug 8, 2026
Merged

RomneyDa merged 2 commits into
openclaw:mainfrom
zenglingbiao:fix/voice-call-redact-error-snippet

Conversation

@zenglingbiao

Copy link
Copy Markdown
Contributor

Summary

Redact credential-bearing content from voice-call provider error bodies before they reach thrown error messages, so Twilio/Telnyx/Plivo REST failures cannot leak Authorization headers, API keys, or tokens into logs and user-facing diagnostics.

What Problem This Solves

All three voice-call telephony providers (Twilio, Telnyx, Plivo) send authenticated REST requests through the shared client guardedJsonApiRequest (extensions/voice-call/src/providers/shared/guarded-json-api.ts:48), each carrying an Authorization header with account credentials (Twilio/Plivo: Basic base64(authId:authToken), Telnyx: Bearer <apiKey>).

When the provider answers non-2xx, the client throws new Error(${errorPrefix}: ${status} ${errorText}) where errorText is the raw provider response body. Provider error bodies frequently echo request details — the Authorization header value, account identifiers, signed URLs, or the offending api_key parameter — and that body flowed unredacted into Error.message, gateway logs, and user-facing error surfaces. This is the same shape as the Discord REST credential leak fixed in #116805.

Code evidence: readProviderErrorResponseSnippet in extensions/voice-call/src/providers/shared/response-body.ts returned the bounded body text verbatim; the throw site at guarded-json-api.ts:48 embedded it directly into the error.

Root Cause

  • Introduced by commit 6f0b4ca (2026-02-26, "refactor(voice-call): share header and guarded api helpers"), which centralized all three providers onto one error path embedding raw response bodies.
  • Violated invariant: the client assumes provider error bodies are safe to surface verbatim. That only holds if providers never reflect credential-bearing request data — they do (echoed auth headers, api_key= query parameters, signed media URLs).
  • Trigger: any authenticated Twilio/Telnyx/Plivo REST call that fails (bad credentials, expired token, provider-side 5xx with a verbose body).

Why This Fix

  • Redact inside readProviderErrorResponseSnippet with the repo-standard redactSensitiveText, forced to tools mode so redaction cannot be switched off by logging config. One change at the shared choke point covers Twilio, Telnyx, and Plivo uniformly.
  • Alternatives considered: (a) drop response bodies from errors entirely — loses genuinely useful provider diagnostics (error codes, messages); (b) per-provider redaction patches — three near-identical changes that drift apart; (c) this approach reuses the same redaction list already maintained for log hygiene.

User Impact

  • Affected operations: outbound calls and call-status polling via Twilio, Telnyx, or Plivo when the provider rejects a request.
  • Before: thrown errors and gateway logs could contain the account's Authorization header or API key; anyone with log access could lift working telephony credentials.
  • After: error messages keep the useful provider diagnostics with credential material masked (***).

Evidence

  • Before: a real local HTTP provider returns 401 echoing the Authorization: Basic … header and an api_key=… parameter → the thrown error message contains both secrets verbatim → FAIL
  • After: the same failing request produces an error message with the Basic credential masked and api_key=*** → PASS

Real Behavior Proof

Before (on main)

$ node --import tsx proof.mjs
caught provider error message:
Twilio API error: 401 {"message":"Authentication failed","detail":"Authorization: Basic QUMxMjM6c3VwZXItc2VjcmV0LWF1dGgtdG9rZW4 rejected; retry with api_key=sk-live-1234567890abcdef"}
FAIL: error message leaks credential material

After (with fix)

$ node --import tsx proof.mjs
caught provider error message:
Twilio API error: 401 {"message":"Authentication failed","detail":"Authorization: Basic QUMxMj…rZW4 rejected; retry with api_key=***"}
PASS: credential material redacted from error message

Tests and Validation

  • pnpm check passed
  • Added regression coverage in extensions/voice-call/src/providers/shared/guarded-json-api.test.ts: a 401 body echoing the Basic credential and an api_key parameter must surface with both masked; all 8 cases in that file pass
  • Proof above runs against a real local HTTP server through the real guarded client code path; no external services involved

@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call size: XS labels Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 6:49 PM ET / 22:49 UTC.

ClawSweeper review

What this changes

The PR redacts sensitive content from bounded voice-call provider error responses and adds a regression test for reflected Basic credentials and API-key parameters.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for landing: current main still surfaces raw voice-call provider error text, while the patch applies the supported shared redaction contract at the boundary used by all three providers. No actionable patch finding was found.

Priority: P1
Reviewed head: d534f32eb4b821e4cb97e7632aa47ab273c0f4c4

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong boundary-specific proof and a small, contract-aligned repair with no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides before-and-after terminal output from a real local HTTP response through the real guarded client, and the focused regression test corroborates the same error boundary.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides before-and-after terminal output from a real local HTTP response through the real guarded client, and the focused regression test corroborates the same error boundary.
Evidence reviewed 6 items Current main remains vulnerable: Current main returns the bounded provider error body verbatim, and the guarded client embeds it directly in a thrown error.
Shared owner boundary: The PR redacts the bounded text before the existing truncation handling, covering both the guarded client and Twilio's direct form client without changing provider APIs or configuration.
Redaction contract: The public plugin SDK exports redactSensitiveText; explicit tools mode enables the standard credential patterns independently of logging configuration, including Basic auth and api_key-shaped text.
Findings None None.
Security None None.

How this fits together

Voice-call providers make authenticated REST requests through shared helpers. On failure, the shared response reader supplies bounded provider text to thrown diagnostics used by callers and logs.

flowchart LR
A[Voice-call providers] --> B[Authenticated REST request]
B --> C[Non-success provider response]
C --> D[Shared bounded response reader]
D --> E[Sensitive-text redaction]
E --> F[Provider diagnostic error]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +5, Tests +36. Total +41 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 1 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 42 1 +41

Review metrics

Metric Value Why it matters
Production vs test LOC production +6/-1 (net +5), tests +36/-0 The production increase is the shared confidentiality guard; the added test covers the reflected-credential error path.

Stored data model

Persistent data-model change detected: serialized state: extensions/voice-call/src/providers/shared/guarded-json-api.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #117304
Summary: This PR is the canonical repair for the voice-call error-reader boundary; related PRs use separate plugin or provider owners.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Land the shared-reader redaction so all Twilio, Telnyx, and Plivo error paths retain useful bounded diagnostics without retaining reflected credentials.

Do we have a high-confidence way to reproduce the issue?

Yes: on current main, a non-2xx response body is returned verbatim and interpolated into a thrown error; a local HTTP endpoint that reflects an Authorization value exercises the path described in the PR proof.

Is this the best way to solve the issue?

Yes: redacting once at the shared bounded response-reader boundary covers every voice-call provider consumer without losing status or non-sensitive provider diagnostics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e8da40010a33.

Labels

Label justifications:

  • P1: A failed authenticated voice-call request can otherwise expose credentials in diagnostics visible to operators or callers.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides before-and-after terminal output from a real local HTTP response through the real guarded client, and the focused regression test corroborates the same error boundary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before-and-after terminal output from a real local HTTP response through the real guarded client, and the focused regression test corroborates the same error boundary.

Evidence

What I checked:

Likely related people:

  • steipete: The shared helper's originating refactor and current blame/history point to this area. (role: shared voice-call helper author and recent area contributor; confidence: high; commits: 6f0b4caa266f, 2dd0e9b95046; files: extensions/voice-call/src/providers/shared/response-body.ts, extensions/voice-call/src/providers/shared/guarded-json-api.ts)
  • vincentkoc: Feature-history sampling shows repeated contributions to the voice-call response and provider-helper area. (role: adjacent response-body contributor; confidence: medium; files: extensions/voice-call/src/providers/shared/response-body.ts, extensions/voice-call/src/providers/twilio/api.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-08-01T08:33:07.795Z sha 7c54019 :: needs maintainer review before merge. :: none
  • reviewed August 1, 2026, 5:01 AM ET / 09:01 UTC sha unknown :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T10:13:45.662Z sha 7c54019 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T07:12:59.952Z sha d534f32 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T01:22:47.674Z sha d534f32 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-06T02:41:17.077Z sha d534f32 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-07T21:51:39.012Z sha d534f32 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 6, 2026
@RomneyDa
RomneyDa merged commit 0eeb9db into openclaw:main Aug 8, 2026
98 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 8, 2026
steipete added a commit to zenglingbiao/openclaw that referenced this pull request Aug 27, 2026
Bind bounded error diagnostics to the actual outgoing request headers for
shared web tools and both Perplexity transports. Preserve caller cancellation
and replace case-insensitive owned headers without combining credentials.

Reuse the provider error redactor and remove duplicate xAI parser-only test
paths while retaining real HTTP and sibling coverage. Production -18 lines;
total -14 lines including regression tests and documentation.

Refs openclaw#120200, openclaw#117304, openclaw#119536.

Co-authored-by: zenglingbiao <[email protected]>
steipete added a commit that referenced this pull request Aug 27, 2026
…and reason phrase (#120200)

* fix(web): redact request credentials from provider errors

Bind bounded error diagnostics to the actual outgoing request headers for
shared web tools and both Perplexity transports. Preserve caller cancellation
and replace case-insensitive owned headers without combining credentials.

Reuse the provider error redactor and remove duplicate xAI parser-only test
paths while retaining real HTTP and sibling coverage. Production -18 lines;
total -14 lines including regression tests and documentation.

Refs #120200, #117304, #119536.

Co-authored-by: zenglingbiao <[email protected]>

* fix(tooling): install managed signals before spawning children

Prevent early SIGTERM from orphaning a detached compiler before its supervisor
registers the child. Retain shared handlers for concurrent commands and clean
them up after synchronous or asynchronous spawn failure.

Reproduce the race at the real process boundary and consolidate stale type
comments and one-use registration wrappers.

---------

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…and reason phrase (openclaw#120200)

* fix(web): redact request credentials from provider errors

Bind bounded error diagnostics to the actual outgoing request headers for
shared web tools and both Perplexity transports. Preserve caller cancellation
and replace case-insensitive owned headers without combining credentials.

Reuse the provider error redactor and remove duplicate xAI parser-only test
paths while retaining real HTTP and sibling coverage. Production -18 lines;
total -14 lines including regression tests and documentation.

Refs openclaw#120200, openclaw#117304, openclaw#119536.

Co-authored-by: zenglingbiao <[email protected]>

* fix(tooling): install managed signals before spawning children

Prevent early SIGTERM from orphaning a detached compiler before its supervisor
registers the child. Retain shared handlers for concurrent commands and clean
them up after synchronous or asynchronous spawn failure.

Reproduce the race at the real process boundary and consolidate stale type
comments and one-use registration wrappers.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: voice-call Channel integration: voice-call P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants