Python: Add OpenAPI server URL validation#14097
Merged
TaoChenOSU merged 2 commits intoJun 19, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Adds SSRF-focused validation for OpenAPI operation request URLs in the Python connector, including configurable allowlists and private-network access controls, and wires the new policy into OpenAPI execution.
Changes:
- Introduces
ServerUrlValidationOptions+validate_server_url()for scheme/allowlist/DNS-to-non-public-IP checks. - Integrates URL validation into
OpenApiRunner.run_operation()and propagates settings fromOpenAPIFunctionExecutionParametersviacreate_functions_from_openapi(). - Expands unit/integration coverage for blocked URLs and server-variable substitution scenarios.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py | New URL validation implementation and policy model. |
| python/semantic_kernel/connectors/openapi_plugin/openapi_runner.py | Calls URL validation before outbound requests; stores validation options. |
| python/semantic_kernel/connectors/openapi_plugin/openapi_manager.py | Propagates validation settings into OpenApiRunner. |
| python/semantic_kernel/connectors/openapi_plugin/openapi_function_execution_parameters.py | Adds execution settings fields + validation for allowed base URLs; documents default SSRF protections. |
| python/semantic_kernel/connectors/openapi_plugin/models/rest_api_operation.py | Passes operation arguments into server URL resolution for server-variable substitution. |
| python/semantic_kernel/connectors/openapi_plugin/init.py | Exposes ServerUrlValidationOptions from the package. |
| python/tests/unit/connectors/openapi_plugin/test_server_url_validator.py | New unit tests for address categorization and validation behavior (scheme, allowlist, DNS outcomes). |
| python/tests/unit/connectors/openapi_plugin/test_openapi_runner.py | Updates/extends runner tests to account for validation and ensure blocking occurs pre-request. |
| python/tests/unit/connectors/openapi_plugin/test_openapi_manager.py | Ensures execution settings propagate into runner validation options. |
| python/tests/unit/connectors/openapi_plugin/test_sk_openapi.py | Adds regression coverage for invalid allowed base URL configuration. |
| python/tests/integration/cross_language/test_cross_language.py | Sets allowed base URL for localhost-based integration test flows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
moonbox3
approved these changes
Jun 18, 2026
TaoChenOSU
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
uv run pytest tests/unit/connectors/openapi_plugin/test_server_url_validator.py tests/unit/connectors/openapi_plugin/test_openapi_runner.py tests/unit/connectors/openapi_plugin/test_openapi_manager.py tests/unit/connectors/openapi_plugin/test_sk_openapi.pyuv run pytest tests/integration/cross_language/test_cross_language.py -k openapiuv run ruff check ...uv run ruff format --check ...