Skip to content

.Net: Bind validated HTTP addresses to connections - #14719

Merged
Roger Barreto (rogerbarreto) merged 2 commits into
microsoft:mainfrom
rogerbarreto:i626r875-dns-validation
Nov 4, 2026
Merged

Roger Barreto (rogerbarreto) merged 2 commits into
microsoft:mainfrom
rogerbarreto:i626r875-dns-validation

Conversation

@rogerbarreto

Copy link
Copy Markdown
Member

Motivation and Context

HttpPlugin validated resolved addresses before sending a request, but the built-in HTTP transport did not retain that address set when opening the connection. This change keeps the validation decision and the resulting connection consistent.

Description

  • Moves the existing validated-address connection handling into the shared internal HTTP client provider.
  • Passes the addresses validated by HttpPlugin to the built-in transport while preserving the original HTTP and TLS hostname.
  • Keeps validated and explicitly unchecked requests in separate connection pools.
  • Fails closed for hostname requests when a caller-supplied client or target framework cannot guarantee address binding.
  • Adds deterministic request projection, connection, and custom-client regression coverage.

Validation:

  • dotnet build dotnet\src\Plugins\Plugins.Core\Plugins.Core.csproj -c Debug --tl:off --warnaserror --no-restore — passed for net10.0, net8.0, and netstandard2.0 with no warnings.
  • dotnet build dotnet\src\Functions\Functions.OpenApi\Functions.OpenApi.csproj -c Debug --tl:off --warnaserror --no-restore — passed for net10.0, net8.0, and netstandard2.0 with no warnings.
  • dotnet build dotnet\src\Plugins\Plugins.UnitTests\Plugins.UnitTests.csproj -f net10.0 -c Debug --tl:off --warnaserror --no-restore — passed with no warnings.
  • dotnet build dotnet\src\Functions\Functions.UnitTests\Functions.UnitTests.csproj -f net10.0 -c Debug --tl:off --warnaserror --no-restore — passed with no warnings.
  • dotnet test dotnet\src\Plugins\Plugins.UnitTests\Plugins.UnitTests.csproj -f net10.0 -c Debug --no-restore -v Normal --logger trx — passed: 583 passed, 15 environment-specific skips, 0 failed.
  • dotnet test dotnet\src\Functions\Functions.UnitTests\Functions.UnitTests.csproj -f net10.0 -c Debug --no-restore --filter FullyQualifiedName~OpenApiHttpClientProviderTests -v Normal --logger trx — passed: 11 passed, 0 failed.
  • Container-based dotnet format --verify-no-changes for the affected projects — passed.

Contribution Checklist

@rogerbarreto
Roger Barreto (rogerbarreto) requested a review from a team as a code owner November 3, 2026 23:29
Copilot AI balanced review requested due to automatic review settings November 3, 2026 23:29
@semantic-kernel-automation semantic-kernel-automation Bot added the .NET Issue or Pull requests regarding .NET code label Nov 3, 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.

🟡 Changes recommended

The validated HTTP handler leaves proxy routing enabled, allowing a configured proxy to bypass address validation and reach private addresses even when AllowPrivateNetworkAccess is false.

1 open issue
What changed in this PR

This PR connects HttpPlugin address validation to the built-in HTTP transport, reusing connection-handling logic previously owned by the OpenAPI provider.

Changes:

  • Moves validated-address connection handling and separate validated/unchecked pools into the shared HTTP client provider.
  • Passes validated addresses from HttpPlugin to the transport and rejects hostname requests when address binding cannot be guaranteed.
  • Adds tests for address propagation, custom-client rejection, and connections that preserve the original HTTP hostname.
File Description
dotnet/​src/​Plugins/​Plugins.UnitTests/​Core/​HttpPluginTests.cs Adds address-binding and custom-client regression tests.
dotnet/​src/​Plugins/​Plugins.Core/​HttpPlugin.cs Supplies validated addresses and enforces transport support.
dotnet/​src/​InternalUtilities/​src/​Http/​HttpClientProvider.cs Centralizes address-bound connections and separate connection pools.
dotnet/​src/​Functions/​Functions.OpenApi/​OpenApiHttpClientProvider.cs Delegates transport creation to the shared provider.

Review effort: Balanced

@rogerbarreto
Roger Barreto (rogerbarreto) added this pull request to the merge queue Nov 4, 2026
Merged via the queue into microsoft:main with commit 1a3ccd8 Nov 4, 2026
22 checks passed
@rogerbarreto
Roger Barreto (rogerbarreto) deleted the i626r875-dns-validation branch November 4, 2026 15:35

This branch was previously deployed

1 inactive deployment
github-app-auth — 6386ad47 Deployed Nov 4, 2026 by rogerbarreto via add_label #29584
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants