Security
telectl’s security posture and the operational checklist for deploying it safely.
Threat Model
- The bot token is the crown jewel — anyone with it can act as the bot. It lives in a Kubernetes Secret, never in the image or in plaintext config.
- The bot’s ServiceAccount is a cluster credential. It should have the
least privilege needed: read + impersonate the mapped identities. It must
not have
cluster-adminby default. - Telegram users are scoped by impersonation → their mapped k8s identity → RBAC. A read-only user cannot mutate, even if the bot’s own SA could.
Secrets Handling (Helm)
flowchart LR
Secret[Secret: telectl] -->|botToken| Pod
Secret -->|allowedUserIds| Pod
CM[ConfigMap: telectl.yaml] -->|non-secret config| Pod
Pod[telectl pod]
telegram.botTokenis injected as a Secret (stringData), mounted into the pod.- The Secret is kept on
helm uninstall(helm.sh/resource-policy: keep) so a reinstall does not lose the token. - Non-secret config (namespaces, impersonation mapping, logging) goes in the ConfigMap.
Least-Privilege Checklist
- Impersonation on — never run with everyone mapped to
cluster-admin. - Scoped impersonator role —
resourceNamesshould list exactly the identities inimpersonation.userMapping. - Read-only group binding — bind the view role to the
viewersgroup, not to a ServiceAccount the bot never impersonates. - Dry-run mode for unsafe environments —
kubernetes.dryRun: truelogs mutations without applying them. allowedUserIds— restrict who can talk to the bot at all.- Pod security — the chart ships
runAsNonRoot, dropped capabilities, read-only rootfs. - Rate limiting —
bot.rateLimitbounds per-user request volume.
Audit Trail
Every mutating action is logged with:
telegram_user_id — who (Telegram user id)
impersonate_user — the k8s identity acted as
impersonate_groups— the groups carried
action + resource + namespace + name
Example:
{"level":"info","msg":"User action: scale resource",
"telegram_user_id": YOUR_READONLY_TELEGRAM_ID,
"resource_type":"deployments","namespace":"production","name":"frontend",
"replicas":10}
logging.level: info (or debug) shows these in the pod logs.
Reporting a Vulnerability
See the repository’s SECURITY.md — please report privately to the maintainers (email in the file) rather than opening a public issue.
Next: Impersonation & RBAC · Troubleshooting