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

Validation issue with example_webhook_test.go #101

Closed
tjdavis3 opened this issue Jan 10, 2024 · 1 comment · Fixed by #129
Closed

Validation issue with example_webhook_test.go #101

tjdavis3 opened this issue Jan 10, 2024 · 1 comment · Fixed by #129

Comments

@tjdavis3
Copy link

In the go example there is a very high probability that it will fail validation. In the following line the signature is created using time.Now(). However, the header is set in line 42 using ts.Unix() and ts was created at the top of the function (also using time.Now()). The difference may be in the milliseconds range, but it could be enough to cause a validation failure. The correct way to do it would be to use the ts value when creating the signature.

signature, err := wh.Sign(id, time.Now(), []byte(payload))

@jorgelob
Copy link
Contributor

That's a very valid point. A millisecond drift could make this validation fail.

@zekth zekth closed this as completed in #129 Mar 7, 2024
zekth pushed a commit that referenced this issue Mar 7, 2024
Fix #101. Not urgent, just thought I'd make a contribution since I
chance upon the issue
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 a pull request may close this issue.

2 participants