Skip to content

fix(client): percent-encode task and config ids in REST paths - #450

Merged
muscariello merged 1 commit into
stack/10-rest-stream-error-statusfrom
stack/11-rest-client-path-encoding
Nov 2, 2026
Merged

muscariello merged 1 commit into
stack/10-rest-stream-error-statusfrom
stack/11-rest-client-path-encoding

Conversation

@muscariello

Copy link
Copy Markdown
Member

Fixes #423. Replaces #424. Stacked on #449: review only the last commit.

Cause: RestTransport put task and config ids into the URL path unescaped, so /, ?, # and % in an id changed the request. The id ../admin?x=1 against base http://host/a2a requested /a2a/admin?x=1, and a # cut :cancel off into the fragment. RFC 3986 §3.3 requires reserved characters in a path segment to be percent-encoded.

Fix: a segment helper percent-encodes an id, keeping only the RFC 3986 unreserved characters, and is applied to the seven task and push-config paths. Ids made of unreserved characters, such as every UUID, give the same URLs as before.

Dependency: adds percent-encoding = "2" to a2a-client. The lockfile change is a single dependency edge, since percent-encoding 2.3.2 is already in Cargo.lock as a transitive dependency.

Tests: a local listener records the request line for get_task("../admin?x=1") and cancel_task("t#1 %") and expects the encoded paths.

Unproven: the failure without the encoding was not run locally. CI is the check.

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@muscariello
muscariello force-pushed the stack/11-rest-client-path-encoding branch from 66316c1 to c30413d Compare November 2, 2026 12:00
@muscariello
muscariello force-pushed the stack/11-rest-client-path-encoding branch from c30413d to 87c2e79 Compare November 2, 2026 12:02
The REST transport put `req.id` and `req.task_id` into the URL path as they
were, so `/`, `?`, `#` and `%` in an id changed the request: the id
`../admin?x=1` requested `/a2a/admin?x=1`, and `#` cut `:cancel` off into
the fragment. Every id is now one path segment with everything but the
RFC 3986 unreserved characters percent-encoded.

Signed-off-by: gulldan <[email protected]>
@muscariello
muscariello force-pushed the stack/11-rest-client-path-encoding branch from 87c2e79 to 999087e Compare November 2, 2026 14:28
@muscariello
muscariello removed this pull request from stack #442 November 2, 2026 15:00
@muscariello
muscariello added this pull request to stack #456 November 2, 2026 15:01
@muscariello
muscariello added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 011566c Nov 2, 2026
43 of 45 checks passed
@muscariello
muscariello deleted the stack/11-rest-client-path-encoding branch November 2, 2026 17:44
@github-actions github-actions Bot mentioned this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: a2a-client REST transport puts task ids into the URL path without percent-encoding

3 participants