Fix empty api key handling
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-08-02 01:37:19 +03:00
parent 3d7025ee4b
commit ff8f5eae36

View File

@ -15,6 +15,8 @@ def check_api_key(f):
@wraps(f)
def decorated_function(*args, **kwargs):
request_key = request.headers.get('Authorization', False)
if not request_key:
return "nope", 403
found_key = re.search(r"Basic (.*)", request_key).group(1)
if not found_key or found_key != api_key:
return "nope", 403