Skip to content

Version 1.5.0

Latest

Choose a tag to compare

@umputun umputun released this 30 Aug 01:08
57a5309

TelegramParams.APIURL sets the bot API base. A caller passes https://proxy.example.com and requests come out as https://proxy.example.com/bot<token>/<method>, which is what Telegram itself serves and what go-pkgz/auth accepts, so an operator configuring both writes the same value twice. Leaving it empty keeps the public API.

The bot token travels in the request path, so the base is validated rather than trimmed: absolute http or https, host required, no userinfo, query, fragment or opaque part, and a path prefix is allowed. https://api.telegram.org@evil.tld is a valid URL whose host is evil.tld, and without the check every request would ship the token there. Error text is scrubbed of the token in raw and encoded forms and withheld when the token cannot be shown absent from it, and redirects are refused because following one hands the destination the token in Referer.

Full detail in #45.