Title: Request verification using SHA1 and secret fails · Issue #29 · bloomberg/python-github-webhook · GitHub
Open Graph Title: Request verification using SHA1 and secret fails · Issue #29 · bloomberg/python-github-webhook
X Title: Request verification using SHA1 and secret fails · Issue #29 · bloomberg/python-github-webhook
Description: I tried using this to handle webhook requests and I kept seeing 400 Bad Request responses: Bad Request
Invalid signature
After a bit o...Open Graph Description: I tried using this to handle webhook requests and I kept seeing 400 Bad Request responses: Bad Request
X Description: I tried using this to handle webhook requests and I kept seeing 400 Bad Request responses: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>400 Bad Request</t...
Opengraph URL: https://github.com/bloomberg/python-github-webhook/issues/29
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Request verification using SHA1 and secret fails","articleBody":"I tried using this to handle webhook requests and I kept seeing `400 Bad Request` responses:\r\n```\r\n\u003c!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\"\u003e\r\n\u003ctitle\u003e400 Bad Request\u003c/title\u003e\r\n\u003ch1\u003eBad Request\u003c/h1\u003e\r\n\u003cp\u003eInvalid signature\u003c/p\u003e\r\n```\r\nAfter a bit of investigation I found out that this fails because `request.data` is empty:\r\nhttps://github.com/bloomberg/python-github-webhook/blob/61e713c3781e2de6e327554be54095df2d666604/github_webhook/webhook.py#L56-L59\r\nAnd what should be used instead is `request.get_data()`, since it returns value regardless off payload format used:\r\n\r\n\u003e`Request.get_data(cache=True, as_text=False, parse_form_data=False)`\r\n\u003eThis reads the buffered incoming data from the client into one bytestring. By default this is cached but that behavior can be changed by setting cache to False.\r\nhttps://tedboy.github.io/flask/generated/generated/flask.Request.get_data.html\r\n\r\nNot sure how this worked before...","author":{"url":"https://github.com/jakubgs","@type":"Person","name":"jakubgs"},"datePublished":"2021-03-15T11:46:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/29/python-github-webhook/issues/29"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6e3d4383-d76f-e5d2-3feb-b65854c74f09 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 959C:29B9E4:23E5A9:31605A:696FE658 |
| html-safe-nonce | 3e89d5d3cc7fce7b51d0758a6832a955960b89f7f8126c1a5d16e067ee9b2c2d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTlDOjI5QjlFNDoyM0U1QTk6MzE2MDVBOjY5NkZFNjU4IiwidmlzaXRvcl9pZCI6IjE5ODI3OTY0OTYwNTgxODEyMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 94e0eb67db25d2cec6b654f03361c9737e47201e15668cd9e7dbfa456e5b4d15 |
| hovercard-subject-tag | issue:831729298 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bloomberg/python-github-webhook/29/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff8783701857c917efe7c912b5468ef00c0731c4164bcf74812e631e7b14d726/bloomberg/python-github-webhook/issues/29 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff8783701857c917efe7c912b5468ef00c0731c4164bcf74812e631e7b14d726/bloomberg/python-github-webhook/issues/29 |
| og:image:alt | I tried using this to handle webhook requests and I kept seeing 400 Bad Request responses: Bad Request |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jakubgs |
| hostname | github.com |
| expected-hostname | github.com |
| None | bb7c872aa74896d911608183f4997f8b9c121a1624064705ec4570cd91bd7839 |
| turbo-cache-control | no-preview |
| go-import | github.com/bloomberg/python-github-webhook git https://github.com/bloomberg/python-github-webhook.git |
| octolytics-dimension-user_id | 1416818 |
| octolytics-dimension-user_login | bloomberg |
| octolytics-dimension-repository_id | 50692237 |
| octolytics-dimension-repository_nwo | bloomberg/python-github-webhook |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 50692237 |
| octolytics-dimension-repository_network_root_nwo | bloomberg/python-github-webhook |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 257e1b418957178bd3ac9f7520608a40ebbb0f1e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width