verify payload signature if present#2732
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2732 +/- ##
=======================================
Coverage 98.03% 98.03%
=======================================
Files 131 131
Lines 11505 11505
=======================================
Hits 11279 11279
Misses 154 154
Partials 72 72
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Verify the payload signature if the request has a signature present in HTTP headers, or if a non-empty secretToken is passed to the ValidatePayload method, indicating that a signature is expected. This modifies the behavior added in #1127, but not the spirit of what was requested in #1126, which is to support webhooks that don't have configured secrets. Specifically, this no longer allows signature checking to be skipped entirely, even for webhooks with a configured secret, simply by passing an empty secretToken to ValidatePayload. Fixes #2731
6c7300d to
5920108
Compare
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @willnorris !
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
I don't think a second approval should be necessarily when the change is coming from another maintainer... they are basically the second :) At least, that's how I recall internal Google systems handling it. (But I also don't recall when that review policy got added to the process and what its purpose was.) |
|
Oh, sorry. Just habit. Thank you, @willnorris ! |
Verify the payload signature if the request has a signature present in HTTP headers, or if a non-empty secretToken is passed to the ValidatePayload method, indicating that a signature is expected.
This modifies the behavior added in #1127, but not the spirit of what was requested in #1126, which is to support webhooks that don't have configured secrets.
Specifically, this no longer allows signature checking to be skipped entirely, even for webhooks with a configured secret, simply by passing an empty secretToken to ValidatePayload.
This also cleans up some documentation and unused fields in the accompanying test.
Fixes #2731
/cc @myitcv