Skip to content

Commit ddf0311

Browse files
committed
Update webhook.py
Return 403 error when secret is enabled but no header is present in the request
1 parent 29fd839 commit ddf0311

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

webhooks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ def index():
6969
secret = config.get('enforce_secret', '')
7070
if secret:
7171
# Only SHA1 is supported
72-
sha_name, signature = request.headers.get('X-Hub-Signature').split('=')
72+
header_signature = request.headers.get('X-Hub-Signature')
73+
if header_signature is None:
74+
abort(403)
75+
76+
sha_name, signature = header_signature.split('=')
7377
if sha_name != 'sha1':
7478
abort(501)
7579

0 commit comments

Comments
 (0)