-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional signature for webhooks (#1115)
This update: * adds an optional webhook_secret field an OAuth2 project can provide * if provided, this is used to create an hmac-sha1 hexdigest to verify a request made to a webhook * this is included as a custom header "X-OpenHumans-Webhooks-Signature" when calling a webhook * documentation is added for the deauthorization webhook and webhook secret * the JSON payload for the deauthorization webhook has been corrected (it was accidentally doing a second JSON encoding) The webhook wasn't actually documented before now, but the last item would break something already using the webhook. So as a fallback, the server tries again with the old double-encoded version if a non-200 response is received. An update supporting the new behavior is also staged for the django-open-humans package.
- Loading branch information
Showing
4 changed files
with
105 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
private_sharing/migrations/0027_oauth2datarequestproject_webhook_secret.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 2.2.10 on 2020-07-01 21:05 | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("private_sharing", "0026_auto_20191202_2105")] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="oauth2datarequestproject", | ||
name="webhook_secret", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="If entered, this string will be used to provide a hash verifying Open Humans as the sender.", | ||
max_length=64, | ||
validators=[ | ||
django.core.validators.RegexValidator(regex="[\x00-\x7f]*"), | ||
django.core.validators.MinLengthValidator(16), | ||
], | ||
), | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters