[EventGrid] Fix credential leak on cross-host redirect in legacy publisher (MSRC 126697)#48239
[EventGrid] Fix credential leak on cross-host redirect in legacy publisher (MSRC 126697)#48239Nishanth-MS wants to merge 14 commits into
Conversation
…her (MSRC 126697)
…her (MSRC 126697)
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Fixes cross-host redirect credential leakage in the legacy Event Grid publisher clients.
Changes:
- Adds sensitive-header cleanup to sync and async pipelines.
- Adds redirect regression tests for all credential types.
- Bumps the patch version and updates the changelog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_eg_redirect.py |
Tests credential stripping after redirects. |
CHANGELOG.md |
Documents the security fix. |
_version.py |
Bumps version to 4.22.1. |
_legacy/_publisher_client.py |
Adds sync header cleanup. |
_legacy/aio/_publisher_client_async.py |
Adds async header cleanup. |
Comments suppressed due to low confidence (2)
sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_publisher_client.py:138
- This remains vulnerable when the redirected host returns a retryable response. The package still permits
azure-core>=1.30.0, butSensitiveHeaderCleanupPolicydid not preserve the cross-domain flag across retries until azure-core 1.38.3; on older supported versions the retry auth pass can re-add the credential after cleanup. Require azure-core 1.38.3+ (adjusting Python support metadata as needed), or implement equivalent retry-safe cleanup locally, and cover a 301 -> 500 -> 200 sequence.
SensitiveHeaderCleanupPolicy(
sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/_publisher_client_async.py:132
- The async pipeline has the same retry gap: with the declared
azure-core>=1.30.0, versions before 1.38.3 lose the cross-domain flag after the first redirected send, allowing the async auth policy to restore the credential on a retry to the new host. Require azure-core 1.38.3+ (and reconcile Python support), or implement retry-safe cleanup locally, with a 301 -> 500 -> 200 regression test.
SensitiveHeaderCleanupPolicy(
This comment has been minimized.
This comment has been minimized.
|
Thanks for the review — addressed all comments: 1. Inaccurate policy comment (sync + async): Reworded to note that 2. Retry gap before azure-core 1.38.3: Raised the minimum dependency to 3. Async AAD test used a sync credential: Added an 4. Python 3.8 vs azure-core 1.38.3: azure-core dropped 3.8 in 1.33.0, so bumped Note on the CI failures ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
sdk/eventgrid/azure-eventgrid/setup.py:68
- Raising
python_requiresfrom 3.8 to 3.9 is a compatibility break, so this conflicts with the PR description's claim that 4.22.1 is backward-compatible. It also means Python 3.8 installations cannot receive this security release and will remain on 4.22.0. Please explicitly document the runtime support removal and adjust the compatibility claim, or provide a security-fix path that remains installable on 3.8.
python_requires=">=3.9",
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
sdk/eventgrid/azure-eventgrid/setup.py:68
- This makes 4.22.1 incompatible with Python 3.8 even though the PR describes the patch as backward-compatible. The package README still says Python 3.8 is supported (
README.md:20), and the existing changelog promises Python 3.8+ for future versions (CHANGELOG.md:70). Because azure-core 1.38.3 itself requires Python 3.9+, either explicitly document this runtime-support drop in the release notes/PR or provide a security-fix path that remains installable on the previously supported runtime.
python_requires=">=3.9",
| # ServiceLabel: %Event Grid | ||
| # PRLabel: %Event Grid | ||
| /sdk/eventgrid/ @rajeshka @shankarsama | ||
| /sdk/eventgrid/ @shankarsama @Nishanth-MS |
[Pilot] PR Pipeline Failure AnalysisA CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green. What failedTwo distinct failure categories were detected in the
Recommended next steps
Raw pipeline analysis (azsdk ci analyze)
|
Summary
Fixes a credential-leak vulnerability (MSRC 126697 / ICM 31000000661197) in the legacy
EventGridPublisherClient.When the server returns an HTTP 3xx redirect to a different host, the client re-attached the caller's credential header to the redirected request and sent it to the new host, disclosing the credential.
Root cause: the legacy client hand-rolls its pipeline (
_policies()) and omitted azure-core'sSensitiveHeaderCleanupPolicy. The stateless auth policies re-add the credential header on every redirect hop;RedirectPolicyflags the cross-domain hop (insecure_domain_change) but nothing consumed that flag to strip the header.Fix
Add
SensitiveHeaderCleanupPolicyafter the authentication policy in both the sync (_legacy/_publisher_client.py) and async (_legacy/aio/_publisher_client_async.py) pipelines. The policy's default only coversAuthorization, so the Event Grid SAS headers are added explicitly:This covers all three credential types:
TokenCredential) ->AuthorizationAzureKeyCredential) ->aeg-sas-keyAzureSasCredential) ->aeg-sas-tokenTests
tests/test_eg_redirect.pydrives the pipeline through a mock transport that issues a cross-host 301 redirect and asserts the credential header is stripped from the redirected request, for all three credential types, sync and async.Changelog / version
4.22.0->4.22.1(backward-compatible security patch).Bugs FixedCHANGELOG entry.Notes
aeg-sas-key/aeg-sas-tokenleak by default) and as latent hardening gaps in JS/Java/.NET; those are tracked separately.