feat(cli): improve Telegram connector with --allowed-user-id flag (#11256)

* feat(cli): add Telegram allowed user id flag

* fix(cli): tighten connector authorization hooks
This commit is contained in:
Saoud Rizwan
2026-06-03 17:50:07 -07:00
committed by GitHub
parent 8f00fcf3ed
commit e8e2af705d
9 changed files with 159 additions and 24 deletions
+14 -6
View File
@@ -54,24 +54,32 @@ cline connect
### Security
By default, anyone who finds your bot can message it and it will execute tasks on your machine. Lock it down with the `--hook-command` flag.
By default, anyone who finds your bot can message it and it will execute tasks on your machine. The `cline connect` wizard asks whether to restrict Telegram access and can configure this for you.
<Steps>
<Step title="Get your Telegram user ID">
Message [@userinfobot](https://t.me/userinfobot) on Telegram. It replies with your user ID immediately.
Message [@userinfobot](https://t.me/userinfobot) on Telegram. It replies with your numeric user ID immediately.
</Step>
<Step title="Start with access control">
Replace `12345` with your actual Telegram user ID:
<Step title="Use the wizard">
```bash
cline connect
```
Choose Telegram, enter the bot token, answer yes to access restriction, then enter your user ID.
</Step>
<Step title="Or pass the flag manually">
Replace `12345` with your Telegram user ID:
```bash
cline connect telegram -k <BOT-TOKEN> \
--hook-command 'jq -r ".payload.actor.participantKey" | grep -q "telegram:id:12345" && echo "{\"action\":\"allow\"}" || echo "{\"action\":\"deny\",\"message\":\"unauthorized\"}"'
--allowed-user-id 12345
```
</Step>
</Steps>
The `--hook-command` receives each incoming message with sender info via stdin. Your script returns `{"action": "allow"}` or `{"action": "deny", "message": "reason"}`. Without `--hook-command`, everything is auto-approved.
Use `--hook-command` only when you need custom access logic. The hook receives each incoming message with sender info via stdin. Your script returns `{"action": "allow"}` or `{"action": "deny", "message": "reason"}`. Without `--allowed-user-id` or `--hook-command`, everything is auto-approved, so restrict Telegram bots that can reach a running Cline instance.
## Slack
+3 -3
View File
@@ -129,14 +129,14 @@ Scan profiles control where Bumblebee looks. `baseline` checks standard global t
</Steps>
<Warning>
By default, anyone who finds your bot can message it and it will run tasks on your machine. Lock it down. Message [@userinfobot](https://t.me/userinfobot) to get your Telegram user ID, then restart the connector with an access-control hook:
By default, anyone who finds your bot can message it and it will run tasks on your machine. Lock it down before leaving the connector running. The `cline connect` wizard can guide you through Telegram user ID setup, or you can message [@userinfobot](https://t.me/userinfobot) and restart the connector with your allowed user ID:
```bash
cline connect telegram -k "<BOT-TOKEN>" --cwd ~/tools/bumblebee \
--hook-command 'jq -r ".payload.actor.participantKey" | grep -q "telegram:id:12345" && echo "{\"action\":\"allow\"}" || echo "{\"action\":\"deny\",\"message\":\"unauthorized\"}"'
--allowed-user-id 12345
```
Replace `12345` with your user ID.
Replace `12345` with your Telegram user ID.
</Warning>
## 5. Schedule the scan