Skip to content

chore(slack): retire the instance-wide Slack env credentials (TASK-151) - #1929

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/task151-slack-env-token-removal
Sep 27, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/task151-slack-env-token-removal

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Why

Sam attested on 2026-09-26, when public distribution was activated for the Slack app, that it carries no hard-coded information — conditional on the retired SLACK_BOT_TOKEN fallbacks being removed so the attestation is fully true. The env token only ever worked inside our own workspace (a customer's token is stored per install by the OAuth bind), so this is attestation hygiene, not a cross-tenant leak — but an auditor asking "is there a Slack credential configured outside the per-install path?" should get an empty answer.

Wren's scope note on TASK-151 is the spec of record (Vera 74557/74563, wren 74561), including the two items that make the attestation fully true: the signing secret's own read inside those blocks, and the injection that would otherwise keep delivering a token nothing reads.

Readers removed (four sites, whole blocks)

  • integrations/providers/slackProvider.ts — the env fallback in tokenFor. A row's own stored copy is still honoured (a pre-TASK-139 row may carry one); the process environment is not read.
  • routes/registry/helpers.ts — the entire if (type === 'slack') branch. channels.slack stays an empty array so a consumer that iterates it keeps working.
  • services/agentProvisionerService.ts and agentProvisionerServiceK8s.ts — the entire Slack block of applyOpenClawIntegrationChannels. SLACK_APP_TOKEN goes with SLACK_BOT_TOKEN.

Whole blocks, not the token lines. Each of those blocks also read SLACK_SIGNING_SECRET and created config.channels.slack when any of the three was set, so cutting only the token assignments would leave a Slack channel built from a signing secret alone, with no token — the half-true shape this row exists to prevent. The witness for that is a provisioner test with only SLACK_SIGNING_SECRET set asserting there is no channels.slack key: it reddens if only the token lines are cut (M1a/M1b below).

Plumbing removed

Wren's item 3 list, all of it: the backend deployment's SLACK_BOT_TOKEN reference, the slack-bot-token ExternalSecret key, local-secrets.yaml and its values-local.yaml entry, docker-compose.dev.yml, both .env.examples, docs-site/deployment/environment-variables.mdx.

Five files beyond that enumeration, same class, flagged for the gate rather than slipped in — the operator docs that told an operator to set a variable nothing reads any more, so they go stale in exactly the way item 3 describes: docs/slack/README.md (step 5 rewritten: signing secret stays on the instance, bot token is the per-install botTokenRef), docs/development/local-credentials.md (the two bullets become a pointer to the connector runbook), docs/deployment/KUBERNETES.md + K8S_DEPLOYMENT_CHECKLIST.md (the --from-literal=slack-bot-token='' line) and k8s/QUICK_START.md (the gcloud secrets create commonly-dev-slack-bot-token line). Each is a removal, not a rewrite.

Stays, deliberately

SLACK_SIGNING_SECRET and its live readers (webhooks/slack.ts:61/:221, slackProvider.ts:85, manifests.ts:105); the connector-secret kind SLACK_BOT_TOKEN / slack-bot-token (connectorSecretKinds.ts:46) — same name, different thing, it is the per-workspace OAuth path (installables.ts:327); and the Discord and Telegram env tokens, whose mounts are not inert because they are live instance credentials for their own connectors. Only those two connectors' moltbot-tier blocks are dead, and they retire with the tier (ADR-021/ADR-023, values-dev:167), not in an attestation row.

Runbook gap, same PR

docs/runbooks/connector-credentials-setup.md: §2.3's "what to merge" list gains features.app_home (messages_tab_enabled: true, messages_tab_read_only_enabled: false) — without both, Slack answers the app's Messages tab with "Sending messages to this app has been turned off" and no DM reaches Commonly, which is what the 2026-09-26 walk hit and fixed by hand; §2.8's acceptance now ends at "a DM from Slack lands in the pod"; §2.6/2.7 now names the toggle (Manage Distribution → Activate Public Distribution, including the "Remove Hard Coded Information" acknowledgement) instead of calling it "the step after that".

Witnesses and ledger

Mutating one site at a time, baseline committed first (d08b84b5) so every revert is git checkout --:

mutation witness control
M1a non-k8s provisioner: only the signing-secret read restored red creates no slack channel when only the signing secret is set env fallbacks green, and the k8s witness green — the two provisioners are separate arms
M1b k8s provisioner: same mutation red same test in the k8s suite env fallbacks green, non-k8s witness green
M2 helpers: only the signing-secret binding restored red hands the gateway no slack channel at all + hands the gateway no slack verification credential either instance telegram token green
M3 slackProvider: the env fallback restored red does not fall back to the instance token, which is retired legacy row from its own channel green

All nine witness/control selections are green on the clean tree before and after the ledger. No mutation survived, so there is no tripwire.

slackProvider's old "falls back to the instance token" test is inverted rather than deleted: it now asserts the row is refused (missing its bot token) and that SlackApi is never constructed with the env value. In registry.helpers.channelTokenSources.test.js the Slack cases become "no slack channel at all", keeping the env keys set in beforeEach so a restored reader shows up as a non-empty array.

Scope note on the ExternalSecret

Removing a key cannot freeze api-keys — the failure mode runbook §0.1 documents is a missing remoteRef, i.e. adding one whose Secret Manager entry does not exist. The Secret Manager entry commonly-dev-slack-bot-token itself is left in place; deleting it is an operator step, not this PR.

Verification

Six suites / 69 tests pass on Node 22 (agentProvisionerService, agentProvisionerServiceK8s, registry.helpers.channelTokenSources, registry.presets — the "manifest readiness, not the legacy bot token" case still green, slackProvider.bindingShape, discordBindingContainment). eslint: 0 errors on the four TS sources; on the two touched .js test files the counts are identical to the same files at HEAD (17 and 6), measured against baseline copies rather than assumed.

CI was red at the first head (d08b84b5) and is fixed at 5ba0fbb2. While measuring the lint baseline above I wrote two scratch copies of the touched test files into the tree (__baseline__*.test.js each), and git add -A committed them. I caught one in the diffstat and removed it, missed the other — __baseline__slackProvider.bindingShape.test.js — which then failed in CI as a stale copy of the very test this PR inverts (falls back to the instance token…), with the new source underneath it. Both are gone; the diff is 23 files. The head moved after the gate ask, so it is flagged here rather than moved silently; nothing was cleared at the old head.

Nothing changes live: agents.clawdbot has been parked since 2026-08-20, and slackProvider's legacy branch has no live caller (TASK-140).

Residual, stated rather than implied

There is no static guard against re-introducing one of these reads; the attestation is a point-in-time state of the tree, and a future reader would be caught by review, not by CI. I did not add one because the row's witness spec names the provisioner test, and a guard over "no file mentions these env keys except the connector-secret kind" would have to scope around docs and history.

Gate: Vera.

Sam attested on 2026-09-26, when public distribution was activated, that the
Slack app carries no hard-coded information, conditional on the retired
`SLACK_BOT_TOKEN` fallbacks being removed so the attestation is fully true.
Four production readers and three plumbing paths are removed; a workspace's
Slack token is stored per install by the OAuth bind (`botTokenRef` ->
`connectorSecrets`) and the webhook path keeps its own `SLACK_SIGNING_SECRET`.

Readers: `slackProvider.ts` (the legacy env fallback — a row's own stored copy
is still honoured), the whole Slack branch of
`buildOpenClawIntegrationChannels`, and the whole Slack block of
`applyOpenClawIntegrationChannels` in both provisioners. `SLACK_APP_TOKEN` goes
with `SLACK_BOT_TOKEN`.

Whole blocks, not single lines: each Slack block also read the signing secret,
so cutting only the token assignments would leave `channels.slack` created from
a signing secret alone with no token. `channels.slack` stays an empty array in
the helpers' output so a consumer that iterates it keeps working.

Plumbing: the backend deployment's `SLACK_BOT_TOKEN` reference, the
`slack-bot-token` ExternalSecret key, the local-secrets template and its
values-local entry, `docker-compose.dev.yml`, both `.env.example` files, the
docs-site variable table, and the operator docs that told an operator to create
the now-unread Secret Manager key.

In the same PR, the runbook gap the 2026-09-26 Slack walk hit:
`docs/runbooks/connector-credentials-setup.md` §2.3 now lists
`features.app_home.messages_tab_enabled: true` and
`messages_tab_read_only_enabled: false` (without them Slack answers the
Messages tab with "Sending messages to this app has been turned off" and no DM
reaches Commonly), §2.8's acceptance now ends at a DM from Slack, and §2.6/2.7
names the distribution toggle and its acknowledgement.

Discord and Telegram keep their env tokens: theirs are live instance
credentials for their own connectors, so their mounts are not inert. Only their
moltbot-tier blocks are dead, and those retire with the tier.

Nothing changes live: `agents.clawdbot` has been parked since 2026-08-20 and
`slackProvider`'s legacy branch has no live caller (TASK-140).

Gate: Vera.
@samxu01
samxu01 force-pushed the kai/task151-slack-env-token-removal branch from d08b84b to 5ba0fbb Compare September 27, 2026 00:31
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Sep 27, 2026
Merged via the queue into main with commit 4567640 Sep 27, 2026
20 of 22 checks passed
lilyshen0722 added a commit to thantiklermcirony/commonly that referenced this pull request Oct 9, 2026
…hipped (Team-Commonly#1936)

Records the live Telegram re-walk of 2026-09-27 (02:43–02:47Z): the code
typed exactly as displayed, spaced and with a capitalised group, binds on the
first try (Team-Commonly#1931, Team-Commonly#1932); a second gated pod relays its agent's line to the
chat while a typed line goes only to the active pod; C3 and C5 inbound green.
Marks the 7ccc6ac C1 red as fixed, TASK-151 as shipped (Team-Commonly#1929 on f5eb556)
and TASK-155 as shipped (Team-Commonly#1933 on 9a6253f). Open: TASK-156.


Claude-Session: https://claude.ai/code/session_01MCF2UK3EQ6z6EHdvxAkM44

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant