Skip to content

fix(attachments): return the download headers with the blob access info [PC-5703] - #2031

Open
andreiancuta-uipath wants to merge 1 commit into
mainfrom
fix/attachments-download-headers
Open

andreiancuta-uipath wants to merge 1 commit into
mainfrom
fix/attachments-download-headers

Conversation

@andreiancuta-uipath

Copy link
Copy Markdown
Contributor

Summary

 get_blob_file_access_uri / get_blob_file_access_uri_async
   GET Attachments(key)
-  return BlobFileAccessInfo(id, uri, name)
+  headers = BlobFileAccess.Headers
+  if BlobFileAccess.RequiresAuth
+    headers += Authorization: Bearer <SDK token>
+  return BlobFileAccessInfo(id, uri, name, headers)
  • Orchestrator sets RequiresAuth when Features.Buckets.StorageOffloadRequiresAuth is on. The URI then points to Orchestrator's offloading endpoint, which accepts only a request with a session for the same tenant.
  • Callers that download the URI with a plain HTTP client (Analyze Files in uipath-langchain) do not send the token, so the download fails with 401. The upload and download methods in the same service already send it.
  • headers is not in repr, so the token does not go into logs.
  • Headers missing from the response gives an empty dict.
  • Version bump to 0.3.22.
  • Jira: PC-5703

Evidence

  • Before: BlobFileAccessInfo has only id, uri, name.
    After: test_blob_file_access_info_has_the_download_headers (sync and async): Orchestrator's headers are returned, and Authorization is added only when RequiresAuth is true. test_blob_file_access_info_without_headers passes.

Merge Danger

Door: two-way

Blast Radius: small

headers has a default, so code that constructs BlobFileAccessInfo keeps working.

🤖 Generated with Claude Code

…fo [PC-5703]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Both blob-URI getters expose the SDK bearer token in recorded span output when authentication is required, creating a critical credential leak.

1 open issue
What changed in this PR

This PR adds download headers to attachment blob-access results so callers can authenticate requests to Orchestrator’s storage-offloading endpoint.

Changes:

  • Return Orchestrator-provided headers and SDK authorization when required, for both sync and async accessors.
  • Add a default-empty headers field excluded from repr, with tests for header propagation and missing headers.
  • Bump uipath-platform to version 0.3.22.
File Description
packages/​uipath-platform/​uv.lock Updates the locked package version to 0.3.22.
packages/​uipath-platform/​tests/​services/​test_attachments_service.py Tests download headers, conditional authorization, and missing-header handling.
packages/​uipath-platform/​src/​uipath/​platform/​orchestrator/​_attachments_service.py Shares header construction between sync and async blob-access methods.
packages/​uipath-platform/​src/​uipath/​platform/​attachments/​attachments.py Adds the documented headers field with a backward-compatible default.
packages/​uipath-platform/​pyproject.toml Sets the package version to 0.3.22.

Review effort: Balanced

Comment on lines +728 to +729
if access.get("RequiresAuth"):
headers.update(self.auth_headers)
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants