Skip to content

Python: fix(security): block link-local and RFC1918 SSRF targets in OpenAPI p… - #14775

Closed
Nguyễn Xuân Thịnh (thinhnx128) wants to merge 1 commit into
microsoft:mainfrom
thinhnx128:fix/cwe-918-openapi-server-url-allowlist
Closed

Nguyễn Xuân Thịnh (thinhnx128) wants to merge 1 commit into
microsoft:mainfrom
thinhnx128:fix/cwe-918-openapi-server-url-allowlist

Conversation

@thinhnx128

Copy link
Copy Markdown

…lugin server_url override (CWE-918)

Motivation and Context

Description

Contribution Checklist

Copilot AI balanced review requested due to automatic review settings November 10, 2026 13:22
@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Nov 10, 2026
@github-actions github-actions Bot changed the title fix(security): block link-local and RFC1918 SSRF targets in OpenAPI p… Python: fix(security): block link-local and RFC1918 SSRF targets in OpenAPI p… Nov 10, 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 SSRF test exercises only a local validator, so it cannot detect removed or bypassed production checks; it needs runner-level HTTPS cases asserting FunctionExecutionException and no HTTP request.

1 open issue
What changed in this PR

This PR aims to protect OpenAPI plugin server URL overrides from server-side request forgery (SSRF). The changes add test-local validation and assertions; production validation is unchanged.

Changes:

  • Adds a local validator for URL schemes, internal hosts, and non-public IP addresses.
  • Adds rejection checks for metadata and loopback addresses, plus an acceptance check for a public hostname.
File Description
python/​tests/​unit/​connectors/​openapi_plugin/​test_openapi_server_url_ssrf_guard.py Adds a standalone URL validator and SSRF-focused test assertions.

Review effort: Balanced

Comment on lines +30 to +34
def test_blocks_aws_azure_imds_link_local_and_private_cidr():
with pytest.raises(ValueError, match="Blocked non-public IP"):
validate_openapi_server_url("http://169.254.169.254/latest/meta-data/")
with pytest.raises(ValueError, match="Blocked non-public IP"):
validate_openapi_server_url("http://127.0.0.1:8080/admin")
@thinhnx128
Nguyễn Xuân Thịnh (thinhnx128) deleted the fix/cwe-918-openapi-server-url-allowlist branch November 10, 2026 14:28

This branch was successfully deployed

1 active deployment
github-app-auth — 11fa923e Deployed Nov 10, 2026 by thinhnx128 via add_label #29656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants