فهرست منبع

Update secret check for sha256

JoostSijm 6 سال پیش
والد
کامیت
f268d1a326
1فایلهای تغییر یافته به همراه1 افزوده شده و 2 حذف شده
  1. 1 2
      app/flaskr.py

+ 1 - 2
app/flaskr.py

@@ -25,8 +25,7 @@ def deploy():
     """Run deploy script"""
     digest = hmac.new(secret, request.data, hashlib.sha1).hexdigest()
     signature = request.headers['X-Gogs-Signature'].split('=', 1)
-    if (len(signature) < 2 or signature[0] != 'sha1'
-            or not hmac.compare_digest(signature[1], digest)):
+    if len(signature) < 2 or not hmac.compare_digest(signature, digest):
         abort(400, 'Invalid signature')
 
     call(['git', 'pull'])