Rework webhook signature header to align with larger implementations and defined standards at https://superfeedr-misc.s3.amazonaws.com/pubsubhubbub-core-0.4.html\#authednotify

remotes/origin/issue/4795/notification_even_they_are_disabled
Stefan Auditor 2016-09-21 09:23:37 +02:00 committed by David Barragán Merino
parent 3dd0e8fc79
commit e8dae79ce0
3 changed files with 4 additions and 1 deletions

View File

@ -33,5 +33,6 @@ answer newbie questions, and generally made taiga that much better:
- Motius GmbH <mail@motius.de> - Motius GmbH <mail@motius.de>
- Riccardo Coccioli <riccardo.coccioli@immobiliare.it> - Riccardo Coccioli <riccardo.coccioli@immobiliare.it>
- Ricky Posner <e@eposner.com> - Ricky Posner <e@eposner.com>
- Stefan Auditor <stefan.auditor@erdfisch.de>
- Yamila Moreno <yamila.moreno@kaleidos.net> - Yamila Moreno <yamila.moreno@kaleidos.net>
- Yaser Alraddadi <yaser@yr.sa> - Yaser Alraddadi <yaser@yr.sa>

View File

@ -30,6 +30,7 @@
- Improve messages generated on webhooks input. - Improve messages generated on webhooks input.
- Add mentions support in commit messages. - Add mentions support in commit messages.
- Cleanup hooks code. - Cleanup hooks code.
- Rework webhook signature header to align with larger implementations and defined [standards](https://superfeedr-misc.s3.amazonaws.com/pubsubhubbub-core-0.4.html\#authednotify). (thanks to [Stefan Auditor](https://github.com/sanduhrs))
- Add created-, modified-, finished- and finish_date queryset filters - Add created-, modified-, finished- and finish_date queryset filters
- Support exact match, gt, gte, lt, lte - Support exact match, gt, gte, lt, lte
- added issues, tasks and userstories accordingly - added issues, tasks and userstories accordingly

View File

@ -66,7 +66,8 @@ def _send_request(webhook_id, url, key, data):
serialized_data = UnicodeJSONRenderer().render(data) serialized_data = UnicodeJSONRenderer().render(data)
signature = _generate_signature(serialized_data, key) signature = _generate_signature(serialized_data, key)
headers = { headers = {
"X-TAIGA-WEBHOOK-SIGNATURE": signature, "X-TAIGA-WEBHOOK-SIGNATURE": signature, # For backward compatibility
"X-Hub-Signature": "sha1={}".format(signature),
"Content-Type": "application/json" "Content-Type": "application/json"
} }
request = requests.Request('POST', url, data=serialized_data, headers=headers) request = requests.Request('POST', url, data=serialized_data, headers=headers)