Skip to content

Fix webhook verification without Buffer#1950

Open
fallintoplace wants to merge 1 commit into
openai:mainfrom
fallintoplace:fix/webhooks-portable-base64
Open

Fix webhook verification without Buffer#1950
fallintoplace wants to merge 1 commit into
openai:mainfrom
fallintoplace:fix/webhooks-portable-base64

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • Replace direct Buffer decoding in webhook signature verification with the existing base64 and UTF-8 helpers.
  • Add a regression test that verifies signatures after removing globalThis.Buffer while WebCrypto is available.

Why

Runtimes with WebCrypto but no Node Buffer could pass the crypto capability check and then crash while decoding the webhook secret or signature.

Validation

  • ./node_modules/.bin/jest tests/api-resources/webhooks.test.ts --runInBand
  • ./node_modules/.bin/prettier --check src/resources/webhooks/webhooks.ts tests/api-resources/webhooks.test.ts
  • ./node_modules/.bin/eslint src/resources/webhooks/webhooks.ts tests/api-resources/webhooks.test.ts
  • ./scripts/build
  • ./node_modules/typescript/bin/tsc

@fallintoplace fallintoplace requested a review from a team as a code owner June 23, 2026 18:19
@HAYDEN-OAI HAYDEN-OAI added the upstream Needs to be addressed in Stainless upstream label Jun 23, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Needs to be addressed in Stainless upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants