hookdeck / hookdeck-cli

Alternative to ngrok for localhost asynchronous web development (e.g. webhooks). No account required.
https://hookdeck.com?ref=github-hookdeck-cli
Apache License 2.0
260 stars 9 forks source link

`isPath` #63

Closed titouancreach closed 7 months ago

titouancreach commented 7 months ago

Hello, I noticed I have trouble to forward an url from my source to a localhost endpoint containing :.

I think this is the root cause: https://github.com/hookdeck/hookdeck-cli/blob/ed32d8aa3d4a67d3a48a371faff9b81119645e06/pkg/listen/listen.go#L121

I believe some extra char should be allowed, I'm not a pro reading RFCs 😀 (https://datatracker.ietf.org/doc/html/rfc1738#section-2.2) but at least the percent sign % should be allowed in order to use special char in paths. In my example it should be %3A

I don't know Go but I added (for the test) the % as an accepted char for the regex and it works. (I mean %3A correctly redirect to my local webhook handler that takes :.

I think a better solution is to accept \%[A-F0-9]{2} or something, but same, I'm not a pro :)

Workaround: edit the url from the webapp works.

alexbouchardd commented 7 months ago

Thanks for bringing that up. @titouancreach Can you paste the command you are trying to start the CLI with please?

titouancreach commented 7 months ago

Yes sure @alexbouchardd :

step1:

hookdeck listen 7071

step2:

choose the source

step3: (when path is asked)

/api/webhooks/events:kyc:webhook -> Sorry, your reply was invalid: invalid path /api/webhooks/events%3Akyc%3Awebhook -> Sorry, your reply was invalid: invalid path

alexbouchardd commented 7 months ago

Thank you, you are correct the regex is overly restrictive.

alexbouchardd commented 7 months ago

Release https://github.com/hookdeck/hookdeck-cli/releases/tag/v0.8.6