Repository navigation
fix(sms): redact reflected credentials from Twilio API error text - #120170
Closed
Monkey-wusky wants to merge 2 commits into
Closed
Monkey-wusky wants to merge 2 commits into
Monkey-wusky wants to merge 2 commits into
Conversation
The Twilio SMS error response reader now applies redactToolPayloadText before returning error body text to the TwilioSmsApiError boundary. This protects against upstream proxies that may reflect the request's Authorization: Basic header in error response bodies. The shared readTwilioApiResponseText path covers every send, lookup, and list request the SMS extension makes to the Twilio API.
Member
|
Thanks @Monkey-wusky. This independently identifies a real Twilio error-body credential exposure, but #119963 is the canonical fix. It predates this PR, protects the same surfaced This PR reaches the same user-visible outcome, while still carrying a temporary proof script marked for removal and duplicating the canonical regression coverage. Closing as superseded so we keep one landing path. Thank you for independently validating the bug and fix direction. |
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes an issue where SMS/Twilio users could have Basic Auth credentials exposed in surfaced API errors when an upstream service or proxy reflected the request's
Authorization: Basicheader in its response body.The SMS extension sends
Authorization: Basic base64(accountSid:authToken)on every Twilio API request (send, lookup, list, messaging-service retrieval). The error response reader (readTwilioApiResponseText) returned the raw body text without redaction, which then enteredTwilioSmsApiError.message(for non-JSON errors) andTwilioSmsApiError.responseText(for all errors).Why This Change Was Made
The shared
readTwilioApiResponseTexterror path now appliesredactToolPayloadTextbefore returning remote text to theTwilioSmsApiErrorboundary. This protects every send, lookup, and list request that uses the shared response path without changing status handling, retries, or error types.The pattern mirrors:
redactToolPayloadTextcall in the error response readerUser Impact
Twilio SMS API failures retain useful status, error codes, and provider details without returning reflected request credentials to users, agents, logs, or downstream error consumers.
Evidence
Real behavior proof
The proof script is at
scripts/proofs/sms-twilio-redact-proof.ts(to be removed before merge).Test coverage
Added 3 tests to
extensions/sms/src/twilio.test.ts:Authorization: Basic <token>— verifies token is absent fromError.messagewhile provider detail and header label surviveresponseTextwhile Twilio error code survivestwilioCode,httpStatus, detail message) is preserved unchangedAll 28 tests pass (25 existing + 3 new):
npx vitest run extensions/sms/src/twilio.test.ts— 28 passed, 0 failedgit diff --checkpassedpnpm-lock.yamlchangesAI-assisted: developed with Claude; the author reviewed the complete change and its shared error-response behavior.