Skip to content

Python: .NET/Python: Share HTTP request validation utilities - #14546

Merged
SergeyMenshykh merged 8 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-last-commit-review
Oct 6, 2026
Merged

SergeyMenshykh merged 8 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-last-commit-review

Conversation

@SergeyMenshykh

@SergeyMenshykh SergeyMenshykh commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Motivation and Context

Improve consistency and maintainability of HTTP request validation in the .NET and Python SDKs.

Description

  • Extract existing request validation into shared internal utilities and reuse them in the HTTP plugins.
  • Update HTTP plugin configuration and documentation.
  • Extend unit coverage for shared validation and plugin behavior.

Contribution Checklist

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh
SergeyMenshykh requested review from a team as code owners October 5, 2026 09:42
Copilot AI balanced review requested due to automatic review settings October 5, 2026 09:42
@semantic-kernel-automation semantic-kernel-automation Bot added .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel labels Oct 5, 2026
@github-actions github-actions Bot changed the title .NET/Python: Share HTTP request validation utilities .Net/Python: Share HTTP request validation utilities Oct 5, 2026
@github-actions github-actions Bot changed the title .NET/Python: Share HTTP request validation utilities Python: .NET/Python: Share HTTP request validation utilities Oct 5, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this Oct 5, 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

🟡 Changes recommended

Both validators permit the non-public IPv6 site-local range fec0::/10, leaving an SSRF bypass.

Review effort: Balanced
Findings: 2 High severity

Open (2)
What changed in this PR

Introduces shared public-network validation utilities across .NET and Python and applies them to HTTP plugins.

Changes:

  • Extracts shared DNS and non-public IP validation.
  • Adds explicit private-network opt-ins to HTTP plugins.
  • Expands validation and plugin tests.
File Description
python/​tests/​unit/​core_plugins/​test_http_plugin.py Tests DNS, IP, IDNA, and opt-in behavior.
python/​tests/​unit/​connectors/​openapi_plugin/​test_server_url_validator.py Tests explicit hostname allowlisting.
python/​semantic_kernel/​utils/​public_network_address_validator.py Adds shared Python network validation.
python/​semantic_kernel/​core_plugins/​http_plugin.py Applies validation to HTTP requests.
python/​semantic_kernel/​connectors/​openapi_plugin/​server_url_validator.py Reuses the shared Python validator.
dotnet/​src/​Plugins/​Plugins.UnitTests/​Core/​HttpPluginTests.cs Tests .NET plugin network restrictions.
dotnet/​src/​Plugins/​Plugins.Core/​HttpPlugin.cs Adds private-network controls and validation.
dotnet/​src/​InternalUtilities/​src/​Http/​PublicNetworkAddressValidator.cs Adds shared .NET network validation.
dotnet/​src/​Functions/​Functions.UnitTests/​OpenApi/​ServerUrlValidatorTests.cs Expands shared-validator coverage.
dotnet/​src/​Functions/​Functions.OpenApi/​ServerUrlValidator.cs Reuses the shared .NET validator.

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

Comment thread python/semantic_kernel/utils/public_network_address_validator.py
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
connectors/openapi_plugin
   server_url_validator.py65789%83–84, 95, 97, 99, 108, 113
core_plugins
   http_plugin.py840100% 
utils
   public_network_address_validator.py98297%41, 83
TOTAL29121548481% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4455 22 💤 0 ❌ 0 🔥 2m 23s ⏱️

@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)): eabe49f57c4c
Model: gpt-5.6-sol

Overview

The PR consolidates destination validation across .NET and Python and adds fail-closed DNS/address checks to the HTTP plugins, backed by domain gates, redirect controls, all-answer validation, and broad unit coverage. Two Medium residual risks remain: the approved DNS result is not bound to the actual connection, and deprecated site-local IPv6 destinations fall through as public in both implementations.

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

Affected areas: dotnet/src/InternalUtilities/src/Http/PublicNetworkAddressValidator.cs

SergeyMenshykh and others added 2 commits October 5, 2026 11:03
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>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small nit, but python side approved

Comment thread python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py Outdated
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 6, 2026
Merged via the queue into microsoft:main with commit 71b2193 Oct 6, 2026
35 checks passed
@SergeyMenshykh
SergeyMenshykh deleted the sergeymenshykh-last-commit-review branch October 6, 2026 10:26

This branch was successfully deployed

1 active and 1 inactive deployments
github-app-auth — cc0430ec Deployed Oct 6, 2026 by SergeyMenshykh via add_label #29269
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 python Pull requests for the Python Semantic Kernel

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants