Skip to content

Commit 663cb2e

Browse files
committed
Fix the unicode issues with hmac
That assumes that the secret passphrase is in ASCII.
1 parent 5bb8409 commit 663cb2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webhooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def index():
7474
abort(501)
7575

7676
# HMAC requires the key to be bytes, but data is string
77-
mac = hmac.new(secret, msg=request.data, digestmod=sha1)
78-
if not hmac.compare_digest(mac.hexdigest(), signature):
77+
mac = hmac.new(str(secret), msg=request.data, digestmod=sha1)
78+
if not hmac.compare_digest(str(mac.hexdigest()), str(signature)):
7979
abort(403)
8080

8181
# Implement ping

0 commit comments

Comments
 (0)