Skip to content

[Cherry-pick to branch-1.2] [MINOR] fix(mcp-server): URL-encode path segments in MCP REST client (#10799)#10806

Open
github-actions[bot] wants to merge 1 commit intobranch-1.2from
cherry-pick-d2268ac1-to-branch-1.2
Open

[Cherry-pick to branch-1.2] [MINOR] fix(mcp-server): URL-encode path segments in MCP REST client (#10799)#10806
github-actions[bot] wants to merge 1 commit intobranch-1.2from
cherry-pick-d2268ac1-to-branch-1.2

Conversation

@github-actions
Copy link
Copy Markdown

Cherry-pick Information:

  • Original commit: d2268ac
  • Target branch: branch-1.2
  • Status: ✅ Clean cherry-pick (no conflicts)

…10799)

### What changes were proposed in this pull request?

Add a `encode_path_segment()` helper in `utils.py` using
`urllib.parse.quote(segment, safe="")` and apply it to every
user-supplied identifier embedded in URL paths across all plain REST
client operation classes (`catalog`, `schema`, `table`, `model`,
`topic`, `fileset`, `tag`, `job`, `policy`, `statistic`). Query
parameters previously concatenated into f-strings are moved to the httpx
`params=` argument.

Also adds 29 unit tests covering various special-character inputs for
all affected operation classes.

### Why are the changes needed?

User-supplied identifiers (metalake name, catalog name, schema name,
table name, etc.) were concatenated directly into URL paths using
f-strings without encoding. Characters like `/`, `?`, `#`, and `%` in
resource names could alter the intended request target, causing
unexpected behavior.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Added 29 unit tests in `tests/unit/client/test_url_encoding.py` that
pass special-character inputs into every affected operation method and
assert the encoded form appears in the URL.
@github-actions github-actions bot requested a review from jerryshao April 17, 2026 07:20
@jerryshao jerryshao closed this Apr 17, 2026
@jerryshao jerryshao reopened this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant