Przeglądaj źródła

Update secret check for sha256

JoostSijm 6 lat temu
rodzic
commit
f268d1a326
1 zmienionych plików z 1 dodań i 2 usunięć
  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'])