-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
get_authenticated_params implementation is wrong. The default value of token should be calculated before calculating the signature. If the function is not passed token then signature is calculated using an empty string but response returns a random generated token value.
default_expire = int(dt.now().strftime("%s")) + DEFAULT_TIME_DIFF
auth_params = {"token": token, "expire": expire, "signature": ""}
if not private_key:
return
signature = hmac.new(
key=private_key.encode(),
msg=(token + str(expire)).encode(),
digestmod=hashlib.sha1,
).hexdigest()
auth_params["token"] = token or str(uuid.uuid4())
auth_params["expire"] = expire or default_expire
auth_params["signature"] = signature
return auth_params
Metadata
Metadata
Assignees
Labels
No labels