Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Devel #22

Merged
merged 4 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion swift_sharing_request/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


__name__ = "swift_sharing_request"
__version__ = "0.4.3"
__version__ = "0.4.4"
__author__ = "CSC Developers"
__license__ = "MIT License"
5 changes: 3 additions & 2 deletions swift_sharing_request/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import hmac
import time
import logging
import secrets

import aiohttp.web
from asyncpg import InterfaceError
Expand Down Expand Up @@ -64,7 +65,7 @@ async def test_signature(
byte_message,
digestmod="sha256"
).hexdigest()
if digest == signature:
if secrets.compare_digest(digest, signature):
return
raise aiohttp.web.HTTPUnauthorized(
reason="Missing valid query signature"
Expand Down Expand Up @@ -107,8 +108,8 @@ async def handle_validate_authentication(
except InterfaceError:
handle_dropped_connection(request)
else:
LOGGER.debug(f"No project ID found in request {request}")
if request.path != "/health":
LOGGER.debug(f"No project ID found in request {request}")
raise aiohttp.web.HTTPUnauthorized(
reason="No project ID in request"
)
Expand Down