Skip to content

Avoid logging IIS pairing token - #69425

Merged
Youssef1313 merged 1 commit into
dotnet:mainfrom
halter73:halter73-fix-iis-pairing-token-disclosure
Sep 23, 2026
Merged

Youssef1313 merged 1 commit into
dotnet:mainfrom
halter73:halter73-fix-iis-pairing-token-disclosure

Conversation

@halter73

@halter73 halter73 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member
  • Stop including the IIS pairing token in token-mismatch error logs.
  • Remove MS-ASPNETCORE-TOKEN from the request after IIS Integration validates it.

The pairing token is an implementation detail used only to validate that a request was forwarded by ANCM. Application middleware does not need to observe it. Avoiding unnecessary logging and downstream exposure hardens the IIS out-of-process hosting path against accidental disclosure through application logs or telemetry.

Copilot AI lite review requested due to automatic review settings September 22, 2026 00:04
@github-actions github-actions Bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Sep 22, 2026
@halter73 halter73 changed the title Harden IIS pairing token handling Avoid logging IIS pairing token Sep 22, 2026

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.

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified in the reviewed changes.

Review effort: Lite
Findings: None

What changed in this PR

Harden IIS pairing-token handling by redacting tokens from mismatch logs and removing validated tokens before application middleware runs.

Changes:

  • Redacts pairing tokens from error messages.
  • Removes the validated token header downstream.
  • Adds regression tests for both behaviors.
File Description
src/​Servers/​IIS/​IISIntegration/​test/​Tests/​IISMiddlewareTests.cs Verifies log redaction and header removal.
src/​Servers/​IIS/​IISIntegration/​src/​IISMiddleware.cs Updates token validation logging and removes the validated header.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@Youssef1313

Copy link
Copy Markdown
Member

@ilonatommy

  Failed Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests.ServerVirtualizationTest.AnchorMode_DeleteBelowViewport_ViewportStaysStable(anchorMode: "2", useItemsProvider: True) [14 s]
  Error Message:
   Assert.Equal() Failure: Strings differ
            ↓ (pos 1)
Expected: "995"
Actual:   "985"
            ↑ (pos 1)
  Stack Trace:
     at Microsoft.AspNetCore.Components.E2ETest.Tests.VirtualizationTest.AnchorMode_DeleteBelowViewport_ViewportStaysStable(String anchorMode, Boolean useItemsProvider) in /mnt/vss/_work/1/s/src/Components/test/E2ETest/Tests/VirtualizationTest.cs:line 4323
   at InvokeStub_VirtualizationTest.AnchorMode_DeleteBelowViewport_ViewportStaysStable(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

@Youssef1313

Copy link
Copy Markdown
Member

/ba-g unrelated Blazor E2E failure.

@Youssef1313
Youssef1313 merged commit b6b5b43 into dotnet:main Sep 23, 2026
28 of 31 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants