Skip to content

[AzureMonitorExporter] [AzureMonitorDistro] Harden redirect handling against credential and telemetry leakage - #61244

Merged
xiang17 merged 3 commits into
Azure:mainfrom
xiang17:xiang17/redirect-policy-auth
Jul 23, 2026
Merged

xiang17 merged 3 commits into
Azure:mainfrom
xiang17:xiang17/redirect-policy-auth

Conversation

@xiang17

@xiang17 xiang17 commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Background

IngestionRedirectPolicy and LiveMetricsRedirectPolicy followed 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.

Changes

  • Add shared validation for redirect destinations.
  • Require redirect targets to:
    • be absolute HTTPS URIs;
    • contain no user information;
    • use the default HTTPS port;
    • match a trusted Azure Monitor domain policy.
  • Allow ingestion redirects only when:
    • the target has the same host and port as the current endpoint; or
    • both endpoints belong to the same approved Azure Monitor domain suffix.
  • Allow Live Metrics redirects only to approved Azure Monitor domains.
  • Reject untrusted redirects before mutating the request, replaying telemetry, or updating redirect caches.
  • Cache the complete validated Live Metrics authority instead of an unchecked host.
  • Preserve support for Azure public, US Government, and China cloud endpoints.
  • Preserve same-authority behavior for explicitly configured custom ingestion endpoints.

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:

  • trusted regional redirects;
  • same-origin redirects;
  • arbitrary cross-origin targets;
  • insecure HTTP targets;
  • user-info in redirect URIs;
  • non-default ports;
  • domain suffix-confusion targets;
  • malformed redirect values;
  • rejected redirect cache poisoning;
  • application of the complete validated Live Metrics authority.

Copilot AI review requested due to automatic review settings July 22, 2026 22:21
@github-actions github-actions Bot added Monitor - Distro Monitor OpenTelemetry Distro Monitor - Exporter Monitor OpenTelemetry Exporter labels Jul 22, 2026
@azure-pipelines

Copy link
Copy Markdown
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.

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 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 IngestionRedirectPolicy and LiveMetricsRedirectPolicy to only follow/cache redirects that pass validation (and to cache the validated Live Metrics authority as a Uri).
  • 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.

@xiang17
xiang17 merged commit b901fec into Azure:main Jul 23, 2026
24 checks passed
github-actions Bot pushed a commit to BenjaminMichaelis/DotnetTemplates that referenced this pull request Aug 24, 2026
Updated
[Azure.Monitor.OpenTelemetry.AspNetCore](https://github.com/Azure/azure-sdk-for-net)
from 1.5.0 to 1.6.0.

<details>
<summary>Release notes</summary>

_Sourced from [Azure.Monitor.OpenTelemetry.AspNetCore's
releases](https://github.com/Azure/azure-sdk-for-net/releases)._

## 1.6.0

## 1.6.0 (2026-07-27)

### Bugs Fixed

- Hardened Azure Monitor ingestion and Live Metrics redirect handling to
prevent credentials and telemetry from being forwarded to untrusted
destinations.
  ([#​61244](Azure/azure-sdk-for-net#61244))

### Other Changes

- Updated `Azure.Monitor.OpenTelemetry.Exporter` dependency to `1.8.3`,
which brings: customer SDK stats enabled by default (opt out with
`APPLICATIONINSIGHTS_SDKSTATS_DISABLED=true`), internal Network SDK
statistics signals, GenAI agent attribution processors for spans and
logs, and `CategoryName` added to custom event custom dimensions.


Commits viewable in [compare
view](https://github.com/Azure/azure-sdk-for-net/commits/Azure.Monitor.OpenTelemetry.AspNetCore_1.6.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Azure.Monitor.OpenTelemetry.AspNetCore&package-manager=nuget&previous-version=1.5.0&new-version=1.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Distro Monitor OpenTelemetry Distro Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants