Skip to content

.Net: Improve OpenAPI HTTP connection handling - #14570

Merged
SergeyMenshykh merged 5 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-index-security-issue
Oct 9, 2026
Merged

SergeyMenshykh merged 5 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-index-security-issue

Conversation

@SergeyMenshykh

Copy link
Copy Markdown
Contributor

Motivation and Context

Improve consistency of the built-in OpenAPI HTTP client while preserving request identity and existing customization points.

Description

Refine connection handling and internal validation-result propagation. Preserve caller-supplied clients and existing redirect behavior. Add regression coverage for connection selection, pooling, and HTTPS behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh self-assigned this Oct 8, 2026
Copilot AI balanced review requested due to automatic review settings October 8, 2026 10:28
@SergeyMenshykh
SergeyMenshykh requested a review from a team as a code owner October 8, 2026 10:28
@semantic-kernel-automation semantic-kernel-automation Bot added the .NET Issue or Pull requests regarding .NET code label Oct 8, 2026
@github-actions github-actions Bot changed the title .NET: Improve OpenAPI HTTP connection handling .Net: Improve OpenAPI HTTP connection handling Oct 8, 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 new owning HTTP clients lack a disposal path, potentially retaining connection pools and sockets.

1 open finding
What changed in this PR

Improves OpenAPI SSRF protection by binding validated DNS addresses to outgoing connections while preserving host identity and custom clients.

Changes:

  • Propagates validated DNS addresses to HTTP requests.
  • Adds separate pinned and unpinned connection pools.
  • Adds connection, TLS, pooling, and client-preservation tests.
File Description
PublicNetworkAddressValidator.cs Returns validated DNS addresses.
ServerUrlValidatorTests.cs Verifies validation results.
OpenApiHttpClientProviderTests.cs Tests pinning, pooling, TLS, and custom clients.
ServerUrlValidator.cs Propagates validated addresses.
RestApiOperationRunner.cs Attaches addresses to requests.
OpenApiKernelPluginFactory.cs Uses the new default HTTP client.
OpenApiHttpClientProvider.cs Implements pinned connection handling.
OpenApiFunctionExecutionParameters.cs Documents pinning limitations.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@semantic-kernel-automation semantic-kernel-automation Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 1ce41a37edc5
Model: gpt-5.6-sol

Overview

The PR carries validated DNS results into the built-in .NET client, separates pinned and unchecked socket pools, preserves the HTTP/TLS hostname, and retains redirect and certificate checks. The regression tests cover direct exact-address routing, pool separation, SNI, and validator propagation. Three Medium risks remain: the newly owned handlers lack a deterministic lifetime, sequential address attempts can prevent fallback to a healthy endpoint, and manifest-based imports lose document-session cookies when they create a second default client for operations.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
3 verified findings remained after source verification (3 medium) across 2 files. Details are attached to the affected lines below.

Affected areas: dotnet/src/Functions/Functions.OpenApi/OpenApiHttpClientProvider.cs, dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs

Comment thread dotnet/src/Functions/Functions.OpenApi/OpenApiHttpClientProvider.cs Outdated
Comment thread dotnet/src/Functions/Functions.OpenApi/OpenApiHttpClientProvider.cs
SergeyMenshykh and others added 2 commits October 8, 2026 11:46
Reuse the default handler across clients while retaining separate connection pools. Add client disposal and connection reuse coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use staggered connection attempts with a single completion wait. Preserve cancellation and connection ownership, and add fallback coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Oct 9, 2026
Merged via the queue into microsoft:main with commit 11f0723 Oct 9, 2026
18 checks passed
@SergeyMenshykh
SergeyMenshykh deleted the sergeymenshykh-index-security-issue branch October 9, 2026 18:14

This branch was previously deployed

2 inactive deployments
github-app-auth — 6facd08b Deployed Oct 8, 2026 by SergeyMenshykh via add_label #29302
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

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants