Skip to content

fix(sms): redact reflected credentials in Twilio errors - #119963

Merged
obviyus merged 3 commits into
openclaw:mainfrom
Leon-SK668:leon/twilio-error-response-redaction-20260806
Aug 28, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
Leon-SK668:leon/twilio-error-response-redaction-20260806

Conversation

@Leon-SK668

@Leon-SK668 Leon-SK668 commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Twilio SMS failures could expose a Basic authentication credential when an upstream server or proxy reflected the request Authorization header in its error body.

Why This Change Was Made

The shared Twilio error boundary now redacts the bounded response body before parsing or exposing it. The same boundary serves send, phone-number lookup, message lookup, and Messaging Service lookup failures.

The regression stays in the existing Twilio owner suite. It checks the real request header and both exposed error fields without adding a separate 146-line transport test.

User Impact

Twilio API failures keep useful status, code, and message details without returning the encoded credential to users, agents, logs, or downstream error consumers.

Evidence

Exact head: 3488e27afc4e45c7ee055f06fe38454cbd994095

  • Main at cb696a1bb3b66a8d51392a8ab743e270e4f249cf: a loopback HTTP server reflected the real request header. The encoded credential appeared in both Error.message and responseText.
  • Exact head: the identical loopback contract built the Basic header, but the encoded credential was absent from both fields.
  • Structured control: HTTP status 400, Twilio code 21610, provider message, and JSON response text remained available.
  • Regression test: failed against pre-fix production for the raw credential mismatch, then passed with the repair.
  • Validation: 66 Twilio tests, one exact-head full build, formatter, scoped Oxlint, and relevant repository ratchets passed.

Production delta: +7/-3 lines, net +4. Test delta: +26/-8 lines, net +18.

AI-assisted: developed with Codex; the author reviewed the complete change and its error-boundary behavior.

@openclaw-barnacle openclaw-barnacle Bot added channel: sms Channel integration: sms size: S labels Aug 6, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 6, 2026
@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 9:37 AM ET / 13:37 UTC.

ClawSweeper review

What this changes

The PR redacts credentials reflected by Twilio error responses before SMS send and status operations expose the message or response text.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main still exposes raw Twilio error text, while this focused owner-boundary repair redacts both public error fields with no blocking correctness finding. Exact-head CI is still in progress.

Priority: P1
Reviewed head: 3488e27afc4e45c7ee055f06fe38454cbd994095

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, owner-boundary security repair with credible after-fix behavior evidence; only exact-head CI completion remains before landing.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body records a before/after loopback reflection using the real Basic request header and verifies the credential is absent after the repair while structured error details remain available.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body records a before/after loopback reflection using the real Basic request header and verifies the credential is absent after the repair while structured error details remain available.
Evidence reviewed 6 items Introduced owner-boundary repair: The introduced change redacts the response once before parsing and assigns that same sanitized value to both surfaced fields.
All relevant Twilio failures share the boundary: The request helper feeds send, phone-number lookup, messaging-service lookup, and message lookup failures into the same error class.
Shared redactor contract: The public plugin SDK exports the redactor, which forces tool-mode built-in patterns; its tests explicitly mask Basic authorization tokens and serialized authorization objects.
Findings None None.
Security None None.

How this fits together

The SMS plugin sends authenticated requests to Twilio for deliveries and status lookups. Bounded error responses flow into one Twilio error object, which is then surfaced to callers and operators.

flowchart LR
  A[SMS send or status lookup] --> B[Authenticated Twilio request]
  B --> C[Bounded error response]
  C --> D[Twilio error boundary]
  D --> E[Redacted message and response text]
  E --> F[Operator or caller]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI is still incomplete, so the maintainer should wait for the current merge result's required checks before landing.
  • Resolve merge risk (P1) - Production grows by four net lines; the growth is limited to one shared redaction call and one sanitized value that keeps both public fields on the same boundary.
  • Complete next step (P2) - No repair job is needed because the submitted patch has no supported actionable defect; landing remains gated on exact-head CI.
Agent review details

Security

None.

PR surface

Source +4, Tests +18. Total +22 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 3 +4
Tests 1 26 8 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 33 11 +22

Review metrics

Metric Value Why it matters
Production versus test delta production +4 net; tests +18 net The small production increase establishes one canonical sanitized error value for both public fields, with focused regression coverage.

Root-cause cluster

Relationship: canonical
Canonical: #119963
Summary: This is the viable focused repair; the matching Twilio credential-redaction proposal was closed unmerged as superseded.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single Twilio error-boundary redaction and land it after the exact-head checks complete; do not duplicate sanitization across send and lookup callers.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single Twilio error-boundary redaction and land it after the exact-head checks complete; do not duplicate sanitization across send and lookup callers.

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

Yes—current main constructs the Basic header, carries the bounded response into the shared error class, and exposes its raw text; the focused reflected-header scenario is source-reproducible with high confidence.

Is this the best way to solve the issue?

Yes—the constructor is the narrowest common owner for all Twilio failure callers, whereas per-caller or response-reader redaction would duplicate policy or affect successful responses.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: Reflected Twilio Basic credentials can reach SMS error consumers and logs; this repair protects a real authenticated channel workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records a before/after loopback reflection using the real Basic request header and verifies the credential is absent after the repair while structured error details remain available.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records a before/after loopback reflection using the real Basic request header and verifies the credential is absent after the repair while structured error details remain available.

Evidence

What I checked:

  • Introduced owner-boundary repair: The introduced change redacts the response once before parsing and assigns that same sanitized value to both surfaced fields. (extensions/sms/src/twilio.ts:176, 3488e27afc4e)
  • All relevant Twilio failures share the boundary: The request helper feeds send, phone-number lookup, messaging-service lookup, and message lookup failures into the same error class. (extensions/sms/src/twilio.ts:372, 3488e27afc4e)
  • Shared redactor contract: The public plugin SDK exports the redactor, which forces tool-mode built-in patterns; its tests explicitly mask Basic authorization tokens and serialized authorization objects. (src/logging/redact.ts:975, 3488e27afc4e)
  • Regression coverage: The introduced test constructs the actual Basic header, reflects it through an error response, and asserts it is absent from both exposed error fields. (extensions/sms/src/twilio.test.ts:800, 3488e27afc4e)
  • Current-main necessity: Current main still parses and assigns the raw response text in this error boundary, so the central security problem is not already implemented there. (extensions/sms/src/twilio.ts:173, 22d4279245a2)
  • Focused diff hygiene: The two introduced files pass whitespace validation; the patch is production +4 net lines and tests +18 net lines. (extensions/sms/src/twilio.ts:176, 3488e27afc4e)

Likely related people:

  • steipete: Current-file blame and the latest main-history touch identify Peter Steinberger on the Twilio error boundary. (role: recent area contributor; confidence: medium; commits: 6c7f283740dd; files: extensions/sms/src/twilio.ts)
  • Vincent Koc: Feature-history shortlog shows multiple contributions to the Twilio implementation, alongside the current-file owner trail. (role: historical area contributor; confidence: medium; files: extensions/sms/src/twilio.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the in-progress exact-head required checks finish successfully before merging.

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 (6 earlier review cycles)
  • reviewed 2026-08-06T14:39:09.366Z sha 681c106c492a8529422e9e044f4526f17a8fa622 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-06T15:43:51.172Z sha 681c106c492a8529422e9e044f4526f17a8fa622 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-07T09:46:31.162Z sha 05216bfdaac83d5b4a184cb2be9b6f95510422bf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T11:39:59.302Z sha 05216bfdaac83d5b4a184cb2be9b6f95510422bf :: needs maintainer review before merge. :: none
  • reviewed August 16, 2026, 4:44 AM ET / 08:44 UTC sha unknown :: needs maintainer review before merge. :: none
  • reviewed August 21, 2026, 6:29 AM ET / 10:29 UTC sha unknown :: needs maintainer review before merge. :: none

@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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 6, 2026
@Leon-SK668
Leon-SK668 force-pushed the leon/twilio-error-response-redaction-20260806 branch from 681c106 to 05216bf Compare August 7, 2026 09:21
@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 7, 2026
@obviyus
obviyus force-pushed the leon/twilio-error-response-redaction-20260806 branch from 05216bf to 3488e27 Compare August 28, 2026 13:28
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 28, 2026
@obviyus

obviyus commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Leon-SK668!

Proof: At 3488e27afc4e45c7ee055f06fe38454cbd994095, a loopback server reflected the real Twilio request authorization header. Current main exposed the encoded credential in both error fields. This head removed it from both fields while preserving HTTP status 400, Twilio code 21610, and the provider message.

  • Bug: A failed Twilio request could return a reflected Basic credential through Error.message and responseText.
  • Fix: The shared Twilio error boundary now redacts the bounded response once before parsing or exposing it.
  • Validation: node scripts/run-vitest.mjs extensions/sms/src/twilio.test.ts passed 66 tests, and pnpm build passed.
  • CI: openclaw/ci-gate run 33175589807 passed on the exact head. Immutable ClawSweeper also passed with no findings or rank-up moves left.

Example

Before After
Authorization: Basic <encoded credential> appears in both error fields. Both fields contain only the shared redactor's masked value; Twilio code and message details remain available.

@obviyus
obviyus enabled auto-merge (squash) August 28, 2026 13:44
@obviyus
obviyus merged commit 1bfcb71 into openclaw:main Aug 28, 2026
112 of 113 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
A reflected upstream error could expose Twilio Basic credentials. Redact bounded error bodies once at the shared SMS transport boundary while preserving provider diagnostics.

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

Labels

channel: sms Channel integration: sms P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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