[azure-core] Warn when an LRO poll target host differs from the client's endpoint - #48804
Open
Anna Tchijova (annatchijova) wants to merge 1 commit into
Open
Conversation
…t's endpoint Long-running-operation polling reads the next poll URL from a service response header (Operation-Location / Azure-AsyncOperation / Location) and sends that GET through the client's credentialed pipeline. When the response names a host the client was not configured for, the poll request carries the client's credentials (API key or bearer token) to that host. SensitiveHeaderCleanupPolicy strips sensitive headers on cross-domain 3xx redirects, but the LRO poll target reaches a new host without a 3xx redirect, so that policy does not cover it. This adds a defense-in-depth warning (it does not block the request) in both the sync and async request_status paths when the poll target host differs from the initial request host, reusing get_domain for the comparison. Same-host and relative (no-host) poll targets are quiet, so services that legitimately poll the same host are unaffected. Left as a warning rather than a hard block deliberately: some services may poll a different host legitimately, and blocking by default would break them. A question for maintainers is on the PR about whether to escalate to a strip/reject. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VWmkpCnuhCPKFPD2fexY1a
Anna Tchijova (annatchijova)
requested review from
iscai-msft,
Kashif Khan (kashifkhan) and
Jeff Fisher (xirzec)
as code owners
August 30, 2026 15:41
Contributor
|
Thank you for your contribution Anna Tchijova (@annatchijova)! We will review the pull request and get back to you soon. |
Copilot started reviewing on behalf of
Anna Tchijova (annatchijova)
August 30, 2026 15:41
View session
|
Azure Pipelines: Successfully started running 3 pipeline(s). 5 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds defense-in-depth warnings for credentialed cross-host LRO polling.
Changes:
- Warns in synchronous and asynchronous polling paths.
- Documents the behavior and adds host-comparison tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
base_polling.py |
Implements warning logic and sync integration. |
async_base_polling.py |
Adds async integration. |
test_base_polling.py |
Tests warning behavior. |
CHANGELOG.md |
Documents the hardening change. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+249
to
+251
| initial_domain = get_domain(initial_request_url) | ||
| poll_domain = get_domain(status_link) | ||
| if initial_domain and poll_domain and poll_domain != initial_domain: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Long-running-operation (LRO) polling reads the next poll URL from a service response header (
Operation-Location/Azure-AsyncOperation/Location) and sends that GET through the client's credentialed pipeline (LROBasePolling.request_status, sync and async). There is no check that the poll target host matches the host the client was configured for, so when the response names a different host, the poll request carries the client's credentials (API key or bearer token) to that host.SensitiveHeaderCleanupPolicyalready strips sensitive headers on cross-domain 3xx redirects, but the LRO poll target reaches a new host without a 3xx redirect, so that policy does not cover this path.Change
Add a defense-in-depth warning (it does not block the request) in both the sync and async
request_statuspaths when the poll target host differs from the initial request host, reusing the existingget_domainhelper for the comparison.Why a warning, not a block (question for maintainers)
I deliberately left this as a warning rather than a hard block or a credential strip. A
raise-on-mismatch broke 16 existingtest_base_pollingtests, because several fixtures configure the client on one host (http://example.org) while theOperation-Location/Locationheader points to another (http://dummyurl...). That could be test-only sloppiness, or it could reflect services that legitimately poll a different host — I can't tell from outside.Question: Is credentialed cross-host LRO polling ever legitimate for shipping Azure services (regional/failover endpoints, sovereign clouds, private endpoints, Traffic-Manager-fronted services)? If not, this could be escalated to strip the credential (mirroring
SensitiveHeaderCleanupPolicy) or reject the poll. I kept it non-breaking so the decision — which needs the service inventory only Microsoft has — stays with you.Testing
test_warn_on_cross_host_poll_target_warns_only_when_host_differs: warns on cross-host; quiet on same-host, same-host-with-port, and relative targets.test_base_pollingsuite unchanged (no fixtures needed rewriting, since this does not block). pylint 10.00/10 on the changed modules.Context
Reported privately to MSRC (assessed None severity / defense-in-depth; host-validation gap acknowledged). Filing this as a public hardening improvement per that assessment.