Repository navigation
fix(go): match HTTP routes on escaped and decoded paths - #27
Closed
PhilBot402 wants to merge 1 commit into
Closed
PhilBot402 wants to merge 1 commit into
PhilBot402 wants to merge 1 commit into
Conversation
Port Python x402-foundation#3502. getRouteConfig now requires payment if either the escaped path or the framework decoded routing view matches a protected route, so a literal route such as GET /api/premium cannot be reached unpaid via /api%2Fpremium. Co-authored-by: phdargen <phdargen@users.noreply.github.com>
Owner
Author
|
Closing this fork-targeted PR. The port is opened against upstream at x402-foundation#3543. |
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.
Port of x402-foundation#3502 from Python to Go SDK.
Go HTTP resource servers matched protected routes against
pathonly. Python now also matchesdecoded_path, so a literal route such asGET /api/premiumcannot be reached unpaid when the framework dispatches/api%2Fpremiumas/api/premium. This port adds optionalHTTPRequestContext.DecodedPathandnormalizeDecodedPath, andgetRouteConfigrequires payment if either representation matches. Gin, Echo, and net/http pass that decoded view fromURL.Path. See tracking issue x402-foundation#3541. This PR does not close it because the TypeScript SDK is handled separately at x402-foundation#3542.AI disclosure: Automated by @phdargen. Use your own judgement