Repository navigation
Python: normalize OpenAPI allowlist paths before prefix match - #14668
Open
Mangesh Raut (mangeshraut712) wants to merge 2 commits into
Open
Mangesh Raut (mangeshraut712) wants to merge 2 commits into
Mangesh Raut (mangeshraut712) wants to merge 2 commits into
Conversation
Mangesh Raut (mangeshraut712)
deployed
to
github-app-auth
October 27, 2026 08:26 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Path-scope bypasses remain, and terminal dot segments lose trailing slashes required for correct allowlist matching.
3 open issues
What changed in this PR
This PR hardens Python OpenAPI URL allowlist validation against same-host path escapes, addressing issue #14662.
Changes:
- Normalizes request and allowlist paths before prefix matching.
- Decodes percent-encoded dots and resolves dot segments while preserving empty segments.
- Adds tests for traversal attempts, valid paths, and prefix boundaries.
| File | Description |
|---|---|
| python/tests/unit/connectors/openapi_plugin/test_server_url_validator.py | Adds rejection and acceptance regression cases. |
| python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py | Adds path normalization to allowlist prefix matching. |
Review effort: Balanced
| if segment == ".": | ||
| continue | ||
| if segment == "..": | ||
| if resolved and resolved[-1] != "": |
Comment on lines
+159
to
+160
| url_path = _normalize_path(url_path or "/") | ||
| base_path = _normalize_path(base_path or "/") |
| # Absolute paths keep a leading empty segment from the initial "/". | ||
| if not resolved: | ||
| return "/" | ||
| normalized = "/".join(resolved) |
Mangesh Raut (mangeshraut712)
deployed
to
github-app-auth
October 27, 2026 09:24 — with
GitHub Actions
Active
Decode %2e/%2E and apply RFC 3986 remove_dot_segments so allowed_base_urls cannot be escaped with .. or encoded dots. Matches httpx path normalization; empty segments preserved. Fixes microsoft#14662
Mangesh Raut (mangeshraut712)
force-pushed
the
tip/sk-14662-normalize-path-prefix
branch
from
October 27, 2026 14:24
7b423e9 to
42e3f4b
Compare
Mangesh Raut (mangeshraut712)
deployed
to
github-app-auth
October 27, 2026 14:24 — with
GitHub Actions
Active
Author
|
Rebased onto latest main (CI re-running). Ready for review/merge when you have a chance — thanks. |
Mangesh Raut (mangeshraut712)
deployed
to
github-app-auth
October 27, 2026 17:54 — with
GitHub Actions
Active
This branch was successfully deployed
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
%2e/%2Eand apply RFC 3986 remove_dot_segments beforeallowed_base_urlspath-prefix matching/api/../adminand/api/%2e%2e/adminmatched an/apiallowlist while httpx would request/admin//) preserved to match httpx; other percent-encodings left intactTests
..and%2e%2eescapes under an/apiallowlist/api/./users,/api/users,/api,/api//apiusers(shared prefix chars only)Fixes #14662