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

Commit 94e9893

Browse files
authored
Merge pull request #22 from CSCfi/devel
Devel
2 parents 08114e9 + 3dc82cf commit 94e9893

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

swift_sharing_request/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
__name__ = "swift_sharing_request"
5-
__version__ = "0.4.3"
5+
__version__ = "0.4.4"
66
__author__ = "CSC Developers"
77
__license__ = "MIT License"

swift_sharing_request/auth.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import hmac
1414
import time
1515
import logging
16+
import secrets
1617

1718
import aiohttp.web
1819
from asyncpg import InterfaceError
@@ -64,7 +65,7 @@ async def test_signature(
6465
byte_message,
6566
digestmod="sha256"
6667
).hexdigest()
67-
if digest == signature:
68+
if secrets.compare_digest(digest, signature):
6869
return
6970
raise aiohttp.web.HTTPUnauthorized(
7071
reason="Missing valid query signature"
@@ -107,8 +108,8 @@ async def handle_validate_authentication(
107108
except InterfaceError:
108109
handle_dropped_connection(request)
109110
else:
110-
LOGGER.debug(f"No project ID found in request {request}")
111111
if request.path != "/health":
112+
LOGGER.debug(f"No project ID found in request {request}")
112113
raise aiohttp.web.HTTPUnauthorized(
113114
reason="No project ID in request"
114115
)

0 commit comments

Comments
 (0)