Skip to content

Fix binary webhook payload parsing - #2011

Merged
zacchua-stripe merged 3 commits into
masterfrom
zacchua/fix-webhook-binary-payload
Nov 3, 2026
Merged

zacchua-stripe merged 3 commits into
masterfrom
zacchua/fix-webhook-binary-payload

Conversation

@zacchua-stripe

@zacchua-stripe zacchua-stripe commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Why?

Rails exposes request.raw_post as an ASCII-8BIT string. When the payload contains non-ASCII UTF-8 bytes, construct_event_without_verification and parse_event_notification_without_verification attempt to transcode it and raise Encoding::UndefinedConversionError.

What?

  • Read binary webhook payloads as UTF-8 without mutating the caller’s string.
  • Preserve transcoding for payloads with other encodings, including UTF-16.

See Also

http://go/j/RUN_DEVSDK-3469

Configuration

  • skip-changefile: This PR is not a user-facing change, so there's no changefile.

zacchua-stripe and others added 2 commits October 28, 2026 14:30
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@zacchua-stripe
zacchua-stripe marked this pull request as ready for review October 28, 2026 21:48
@zacchua-stripe
zacchua-stripe requested a review from a team as a code owner October 28, 2026 21:48
@zacchua-stripe
zacchua-stripe requested review from jar-stripe, mark-kogan-stripe and xavdid and removed request for a team October 28, 2026 21:48
Comment thread lib/stripe/webhook.rb Resolved
@zacchua-stripe
zacchua-stripe merged commit ccd5995 into master Nov 3, 2026
16 checks passed
@zacchua-stripe
zacchua-stripe deleted the zacchua/fix-webhook-binary-payload branch November 3, 2026 16:44
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