Skip to content

[Storage] Strip sensitive auth info on cross-domain redirect#47541

Open
weirongw23-msft wants to merge 3 commits into
Azure:mainfrom
weirongw23-msft:weirongw23/disable-redirect-attach
Open

[Storage] Strip sensitive auth info on cross-domain redirect#47541
weirongw23-msft wants to merge 3 commits into
Azure:mainfrom
weirongw23-msft:weirongw23/disable-redirect-attach

Conversation

@weirongw23-msft

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Jun 17, 2026
@weirongw23-msft weirongw23-msft marked this pull request as ready for review June 17, 2026 16:20
Copilot AI review requested due to automatic review settings June 17, 2026 16:20

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.

Pull request overview

This PR introduces a Storage pipeline policy intended to prevent credential/SAS leakage by stripping sensitive authentication headers and query parameters when an HTTP redirect crosses domains, and wires that policy into the Blob, Queue, File Share, and Data Lake pipelines.

Changes:

  • Added StorageSensitiveHeaderCleanupPolicy to scrub sensitive headers and remove sig from the URL query when RedirectPolicy flags a cross-domain redirect.
  • Inserted the new policy into the sync/async pipeline construction for Blob, Queue, File Share, and Data Lake clients.
  • Added a Blob unit test covering the redirect-cleanup behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py Adds StorageSensitiveHeaderCleanupPolicy implementation for Queue.
sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py Wires the new cleanup policy into the Queue sync pipeline.
sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py Wires the new cleanup policy into the Queue async pipeline.
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py Adds StorageSensitiveHeaderCleanupPolicy implementation for File Share.
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py Wires the new cleanup policy into the File Share sync pipeline.
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py Wires the new cleanup policy into the File Share async pipeline.
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py Adds StorageSensitiveHeaderCleanupPolicy implementation for Data Lake.
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py Wires the new cleanup policy into the Data Lake sync pipeline.
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client_async.py Wires the new cleanup policy into the Data Lake async pipeline.
sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py Adds StorageSensitiveHeaderCleanupPolicy implementation for Blob.
sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py Wires the new cleanup policy into the Blob sync pipeline.
sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client_async.py Wires the new cleanup policy into the Blob async pipeline.
sdk/storage/azure-storage-blob/tests/test_sensitive_redirect.py Adds unit coverage for redirect-based sensitive header/query cleanup (Blob only).

Comment on lines +912 to +919
# Clean up request query parameters
parsed = urlparse(request.http_request.url)
kept = [
pair
for pair in parsed.query.split("&")
if pair and pair.split("=", 1)[0] not in self._blocked_query_params
]
request.http_request.url = urlunparse(parsed._replace(query="&".join(kept)))
Comment on lines +912 to +919
# Clean up request query parameters
parsed = urlparse(request.http_request.url)
kept = [
pair
for pair in parsed.query.split("&")
if pair and pair.split("=", 1)[0] not in self._blocked_query_params
]
request.http_request.url = urlunparse(parsed._replace(query="&".join(kept)))
Comment on lines +912 to +919
# Clean up request query parameters
parsed = urlparse(request.http_request.url)
kept = [
pair
for pair in parsed.query.split("&")
if pair and pair.split("=", 1)[0] not in self._blocked_query_params
]
request.http_request.url = urlunparse(parsed._replace(query="&".join(kept)))
Comment on lines +918 to +925
# Clean up request query parameters
parsed = urlparse(request.http_request.url)
kept = [
pair
for pair in parsed.query.split("&")
if pair and pair.split("=", 1)[0] not in self._blocked_query_params
]
request.http_request.url = urlunparse(parsed._replace(query="&".join(kept)))
)

def __init__(
self,
)

def __init__(
self,
)

def __init__(
self,
StorageResponseHook(**kwargs),
DistributedTracingPolicy(**kwargs),
HttpLoggingPolicy(**kwargs),
StorageSensitiveHeaderCleanupPolicy(**kwargs),
StorageResponseHook(**kwargs),
DistributedTracingPolicy(**kwargs),
HttpLoggingPolicy(**kwargs),
StorageSensitiveHeaderCleanupPolicy(**kwargs),
StorageResponseHook(**kwargs),
DistributedTracingPolicy(**kwargs),
HttpLoggingPolicy(**kwargs),
StorageSensitiveHeaderCleanupPolicy(**kwargs),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants