Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a dev, I want to resolve the issue with get_user_container_client failing due to incorrect authorization headers #170

Open
k-allagbe opened this issue Sep 28, 2024 · 0 comments
Assignees

Comments

@k-allagbe
Copy link
Member

Description

Context
Currently, when using the datastore.get_user_container_client function, it fails to authenticate the request correctly. Despite passing valid environment variables, the function throws an azure.core.exceptions.ClientAuthenticationError related to the Authorization header and signed times.

Sample code triggering the issue:

import asyncio
import os
import datastore

BLOB_CONNECTION_STRING = os.environ["FERTISCAN_STORAGE_URL"]
if BLOB_CONNECTION_STRING is None or BLOB_CONNECTION_STRING == "":
    raise ValueError("FERTISCAN_STORAGE_URL_TESTING is not set")

BLOB_ACCOUNT = os.environ["FERTISCAN_BLOB_ACCOUNT"]
if BLOB_ACCOUNT is None or BLOB_ACCOUNT == "":
    raise ValueError("NACHET_BLOB_ACCOUNT is not set")

BLOB_KEY = os.environ["FERTISCAN_BLOB_KEY"]
if BLOB_KEY is None or BLOB_KEY == "":
    raise ValueError("NACHET_BLOB_KEY is not set")

container_client = asyncio.run(
    datastore.get_user_container_client(
        user_id="user",
        storage_url=BLOB_CONNECTION_STRING,
        account=BLOB_ACCOUNT,
        key=BLOB_KEY,
        tier="test-user",
    )
)

Problem Statement
When calling datastore.get_user_container_client, the following error occurs:

azure.core.exceptions.ClientAuthenticationError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:8a82ebb2-901e-0027-1295-111b8f000000
Time:2024-09-28T10:58:33.6544104Z
ErrorCode:AuthenticationFailed
authenticationerrordetail:Signed expiry time [Sat, 28 Sep 2024 07:03:33 GMT] has to be after signed start time [Sat, 28 Sep 2024 10:58:33 GMT]

The error suggests that the signed expiry time is incorrectly set before the signed start time, which is causing the failure.

Acceptance Criteria

  • Investigate and fix the issue in datastore.get_user_container_client where the authorization headers are incorrectly formed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants