[AzureMonitorExporter] [AzureMonitorDistro] Harden redirect handling against credential and telemetry leakage - #61244
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 10 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
This PR hardens Azure Monitor ingestion and Live Metrics redirect handling in Azure.Monitor.OpenTelemetry.Exporter to prevent credential/telemetry leakage via untrusted redirect targets, by validating redirect destinations before replaying requests or updating redirect caches.
Changes:
- Introduces shared redirect destination validation (
RedirectPolicyHelper) with an allowlist-based trust boundary and HTTPS/userinfo/port checks. - Updates
IngestionRedirectPolicyandLiveMetricsRedirectPolicyto only follow/cache redirects that pass validation (and to cache the validated Live Metrics authority as aUri). - Adds targeted unit test coverage for trusted vs. untrusted redirects (including cache-poisoning scenarios) and updates changelogs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/LiveMetricsRedirectPolicyTests.cs | New tests covering trusted Live Metrics redirects, validated authority application, and rejection/non-caching of untrusted/invalid targets. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/IngestionRedirectPolicyTests.cs | Updates existing tests to use trusted Azure Monitor endpoints and adds tests for rejecting/un-caching untrusted/invalid ingestion redirects. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/LiveMetrics/Internals/LiveMetricsRedirectPolicy.cs | Validates redirect URI and caches a validated Uri; applies scheme/host/port rather than only host. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/RedirectPolicyHelper.cs | Adds centralized redirect validation logic and trusted domain suffix policy. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/IngestionRedirectPolicy.cs | Validates cached and newly received ingestion redirects against the trust policy before applying or caching. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md | Documents the security hardening under “Bugs Fixed”. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md | Notes the redirect hardening in the ASP.NET Core package changelog. |
Harsimar Kaur (harsimar)
approved these changes
Jul 23, 2026
This was referenced Jul 25, 2026
Bump Azure.Monitor.OpenTelemetry.Exporter and 7 others
frasermolyneux/observability-opentelemetry#13
Open
Merged
Closed
Closed
This was referenced Aug 3, 2026
Open
Open
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.
Background
IngestionRedirectPolicyandLiveMetricsRedirectPolicyfollowed and cached server-provided redirect targets without validating their trust boundary. When AAD authentication was enabled, this could forward the bearer token and telemetry payload to an attacker-controlled endpoint.The ingestion redirect could remain cached for up to 12 hours, while the Live Metrics redirect remained active for the policy lifetime.
This change addresses MSRC cases 119714, 123485, and 125643.
Changes
Rejected redirects are not followed or cached, preventing bearer-token disclosure, telemetry leakage, and persistent redirect cache poisoning.
Testing
Added coverage for both redirect policies, including: