Explorar el Código

Update secret check for sha256

JoostSijm hace 6 años
padre
commit
f268d1a326
Se han modificado 1 ficheros con 1 adiciones y 2 borrados
  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'])