瀏覽代碼

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'])