Skip to content

fix(go): decode routeTemplate to a fixed point before traversal checks - #19

Closed
PhilBot402 wants to merge 2 commits into
mainfrom
philbot-go-route-template-decode-60ca
Closed

PhilBot402 wants to merge 2 commits into
mainfrom
philbot-go-route-template-decode-60ca

Conversation

@PhilBot402

Copy link
Copy Markdown
Owner

Port of x402-foundation#3213 from TypeScript to Go SDK.

Go isValidRouteTemplate decoded a routeTemplate with a single PathUnescape pass before checking for .. and ://. Because the charset regex allows %, a double-encoded payload such as %252e%252e survived one decode still percent-encoded and was accepted. That lets a client poison the facilitator catalog with an arbitrary URL. This ports the TypeScript fixed-point decode (bounded to 5 PathUnescape passes) and the matching regression tests. Related to x402-foundation#3439. TypeScript and Python are unchanged.

AI disclosure: Automated by @phdargen. Use your own judgement

Open in Web Open in Cursor 

PhilBot402 and others added 2 commits September 10, 2026 07:28
Single-pass PathUnescape lets %252e%252e slip past traversal checks.
These cases lock the intended reject behavior before the decode loop.

Co-authored-by: phdargen <phdargen@users.noreply.github.com>
isValidRouteTemplate used one PathUnescape pass, so double- and deeper-
encoded payloads stayed percent-encoded and bypassed .. and :// checks.
Decode until a fixed point or a 5-pass budget, matching TypeScript x402-foundation#3213.

Co-authored-by: phdargen <phdargen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant