tdlight-team / tdlight-telegram-bot-api

The TDLight Telegram Bot API is an actively enhanced fork of the original Bot API, featuring experimental user support, proxies, unlimited files size, and more.
https://t.me/TDLight
Boost Software License 1.0
128 stars 27 forks source link

Phone numbers are exposed in the userbot tokens #48

Open luckydonald opened 3 years ago

luckydonald commented 3 years ago

First of all it does it differently from the bots, where the id of the bot is everything in front of the colon :.

Additionally it exposes the phone number at several places which is not needed, or even a security concern.

One example is the stats page, where it now incorrectly gets listed as id of the account. Additionally it is included in every request where probably the anonymous user id would be a perfectly fine replacement.

andrew-ld commented 3 years ago

close?

luckydonald commented 3 years ago

@andrew-ld the underlying issue of exposing the phone numbers for tokens isn't solved.

penn5 commented 3 years ago

I suggest generating a random number 2^32 > n >= 2^31 (so it's not a valid tg id) and using that as the id part of the token, and then putting the phone number in the bot token. To ensure there is no confusion, the first of the 2 version bytes can be set to a magic number for tdlight.

luckydonald commented 3 years ago

@penn5 That would be a good compromise.

luckydonald commented 3 years ago

@spontanurlaub Thoughts?

spontanurlaub commented 3 years ago

I first tried to create a token with the user_id after the login, but I couldnt get it to work "moving" the tdlib instance to a new token after it was created. We could of course use a random number in the id part, but I actually like the phone number there cause I have to work with a bunch of tokens and without it it is hard to tell which token belongs to which account without calling getMe.

The token should be kept secret anyway, so having the phone number there is not a problem. Apart from the stats page (what is fixed now) I'm not aware of any place where the bot token or a part of it are displayed.