Run telegram as its own account in a runtime of its own, keep its offset per update, and keep no copy of a secret on the desk (hq ADR 0259 §8)
This commit is contained in:
@@ -354,8 +354,8 @@ func (c *Channel) Poll(wait time.Duration) error {
|
||||
if u.UpdateID >= offset {
|
||||
offset = u.UpdateID + 1
|
||||
}
|
||||
}
|
||||
if len(updates) > 0 {
|
||||
// Kept after each update, not after the batch: a restart in the middle takes again only the one it
|
||||
// was handling (the review of 2026-10-08), and the router acts on an answer once by its id anyway.
|
||||
if err := c.Store.SetOffset(offset); err != nil {
|
||||
c.Logf("[telegram] the update offset could not be kept; a restart may take some updates again: %v", err)
|
||||
}
|
||||
@@ -447,7 +447,7 @@ func (c *Channel) Status() map[string]any {
|
||||
"up to 4096 characters arrive whole; longer is cut and the cut said",
|
||||
"warnings and clearings arrive without sound; urgent messages and questions ring",
|
||||
"a rate limit is waited out; a refusal is said to the router as permanent; an edit to the same text is a success",
|
||||
"it runs as its own account, which alone reads the bot token",
|
||||
"it runs as its own account, in a runtime of its own on a bus account of its own, never the machine's runtime; that account alone reads the bot token",
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ func TestItRunsAsItsOwnAccountWhichAloneHoldsTheToken(t *testing.T) {
|
||||
}
|
||||
Own map[string]string `json:"own-secrets"`
|
||||
Owner string `json:"secrets-owner"`
|
||||
RunsAs string `json:"runs-as"`
|
||||
Resources []map[string]any
|
||||
Build struct {
|
||||
Artifacts []struct {
|
||||
@@ -44,8 +45,9 @@ func TestItRunsAsItsOwnAccountWhichAloneHoldsTheToken(t *testing.T) {
|
||||
}
|
||||
}
|
||||
env := m.Build.Artifacts[0].Env
|
||||
if env["MESH_RUN_AS"] != "telegram" || env["MESH_TELEGRAM_TOKEN_FILE"] != m.Own["telegram-token"] || m.Owner != "telegram" {
|
||||
t.Fatalf("env %v, secret %v, owner %q", env, m.Own, m.Owner)
|
||||
if m.RunsAs != "telegram" || env["MESH_TELEGRAM_TOKEN_FILE"] != m.Own["telegram-token"] || m.Owner != "telegram" ||
|
||||
m.Own["broker"] == "" {
|
||||
t.Fatalf("runs as %q, env %v, secrets %v, owner %q", m.RunsAs, env, m.Own, m.Owner)
|
||||
}
|
||||
var account, state bool
|
||||
for _, r := range m.Resources {
|
||||
|
||||
Reference in New Issue
Block a user