Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Buffer instances in Webhook.constructEvent #523

Merged
merged 1 commit into from
Nov 23, 2018

Conversation

ob-stripe
Copy link
Contributor

@ob-stripe ob-stripe commented Nov 23, 2018

r? @jlomas-stripe
cc @stripe/api-libraries

Handle Buffer instances in Webhook.constructEvent, by silently converting them to UTF-8 strings.

Firebase returns the raw body as a Buffer instance, so this lets users directly pass request.rawBody to the constructEvent method, without having to do the string conversion themselves.

(What happens currently is that the buffer is coerced into a string when we compute the signed payload with the timestamp, but since no explicit encoding is applied, this can apparently cause issues in some cases, cf. #341 (comment)).

@jlomas-stripe
Copy link
Contributor

lgtm

👍

@ob-stripe ob-stripe assigned ob-stripe and unassigned jlomas-stripe Nov 23, 2018
@ob-stripe ob-stripe merged commit 55ebb45 into master Nov 23, 2018
@ob-stripe ob-stripe deleted the ob-webhook-convert-buffer branch November 23, 2018 18:28
@ob-stripe
Copy link
Contributor Author

Released as 6.15.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants