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

Verifying signatures: add hint about line endings #1981

Closed
forgotPassword opened this issue Dec 24, 2023 · 3 comments · Fixed by #1992
Closed

Verifying signatures: add hint about line endings #1981

forgotPassword opened this issue Dec 24, 2023 · 3 comments · Fixed by #1992

Comments

@forgotPassword
Copy link

forgotPassword commented Dec 24, 2023

Is your feature request related to a problem? Please describe.

Stripe's uses \n in it's payload. If you were to console.log() the raw payload, and paste into say, Postman (on windows at least), you will have a bad time since it uses \r\n for new lines, and you will waste a few hours trying to figure out where the problem is (ask me how I know).

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@richardm-stripe
Copy link
Contributor

Hi @forgotPassword, we 100% want to prevent this trouble for happening for future users. Thank you for reporting this.

Can you help me understand exactly what text you were console.log-ing and where you were pasting it with the extra carriage return to cause an error? Right now I'm not certain where the warning you suggest would go.

@forgotPassword
Copy link
Author

I was just dumping the req.body of the webhook payload, in order to manually/more easily replay it from Postman. The newlines are part of the json payload itself (so there are like 100 of them).

It's more a Postman 'bug' than anything (it seems over the years it switched from \n to \r\n, perhaps OS dependent). postmanlabs/postman-app-support#422

postman

Right now there is already an error when there is signature mismatch: https://github.com/stripe/stripe-node/blob/master/src/Webhooks.ts#L380

Perhaps also hinting that the payload uses linux line endings by default?

@pakrym-stripe
Copy link
Contributor

Opened #1992

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

Successfully merging a pull request may close this issue.

3 participants