Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(selfhost): pass MULTICA_DINGTALK_SECRET_KEY through and guard integration keys (#8617)

Bohan Jiang53578958bc88
diff --git a/.env.example b/.env.example
index 65211abc9e..beef7cf9c1 100644
--- a/.env.example
+++ b/.env.example
@@ -623,6 +623,19 @@ MULTICA_LARK_WS_PROXY_URL=
# Generate one with: openssl rand -base64 32
MULTICA_DINGTALK_SECRET_KEY=
+# Slack bot integration (Settings → Integrations → Slack)
+# Off until MULTICA_SLACK_SECRET_KEY is set — a base64-encoded 32-byte key
+# that encrypts each installation's bot and app tokens at rest. Leave empty
+# to disable. Generate one with: openssl rand -base64 32
+MULTICA_SLACK_SECRET_KEY=
+
+# Telegram bot integration (Settings → Integrations → Telegram)
+# Off until MULTICA_TELEGRAM_SECRET_KEY is set — a base64-encoded 32-byte key
+# that encrypts each Bot's token at rest. Leave empty to disable. Keep it
+# stable: losing or rotating it makes stored Bot tokens unreadable.
+# Generate one with: openssl rand -base64 32
+MULTICA_TELEGRAM_SECRET_KEY=
+
# Frontend
# Leave empty — auto-derived from page origin in browser, set by Makefile for local dev.
# NEXT_PUBLIC_API_URL also feeds the Next.js SSR proxy when explicitly set.
diff --git a/.github/ci-paths.json b/.github/ci-paths.json
index 03368772da..4e7a6abda5 100644
--- a/.github/ci-paths.json
+++ b/.github/ci-paths.json
@@ -102,6 +102,7 @@
"Makefile",
"server/internal/handler/reserved_slugs.json",
"packages/core/paths/reserved-slugs.ts",
+ "server/cmd/server/router.go",
".github/workflows/ci.yml",
".github/ci-paths.json",
"scripts/ci-scope.mjs",
diff --git a/docker-compose.selfhost.yml b/docker-compose.selfhost.yml
index 1831b58ae1..7673974817 100644
--- a/docker-compose.selfhost.yml
+++ b/docker-compose.selfhost.yml
@@ -178,6 +178,11 @@ services:
# in the database, so this single deployment-wide key is all the operator
# needs to set here.
MULTICA_SLACK_SECRET_KEY: ${MULTICA_SLACK_SECRET_KEY:-}
+ # DingTalk bot integration. MULTICA_DINGTALK_SECRET_KEY is the opt-in:
+ # unset = integration disabled. It encrypts each installation's AppSecret
+ # at rest, so this single deployment-wide key is all the operator needs
+ # to set here.
+ MULTICA_DINGTALK_SECRET_KEY: ${MULTICA_DINGTALK_SECRET_KEY:-}
# Self-hosted Git provider integration (Forgejo / Gitea / GitLab). This
# is a self-host-only feature, so the compose file turns it on by default;
# the managed cloud leaves it unset (off). It still needs a valid
diff --git a/scripts/ci-scope.test.mjs b/scripts/ci-scope.test.mjs
index d207924b5f..3b72b29fa8 100644
--- a/scripts/ci-scope.test.mjs
+++ b/scripts/ci-scope.test.mjs
@@ -35,6 +35,7 @@ for (const [name, files, selected] of [
["performance harness", ["scripts/perf-compare.test.sh"], ["scripts"]],
["reserved slug source", ["server/internal/handler/reserved_slugs.json"], ["backend", "runtime", "scripts"]],
["reserved slug output", ["packages/core/paths/reserved-slugs.ts"], ["frontend", "quality", "scripts"]],
+ ["integration key gates", ["server/cmd/server/router.go"], ["backend", "runtime", "scripts"]],
["cross-module runtime contract", ["packages/core/runtimes/cli-version.ts"], ["frontend", "backend", "runtime", "quality"]],
["lockfile", ["pnpm-lock.yaml"], ["frontend", "quality"]],
["package patch", ["patches/example.patch"], ["frontend", "quality"]],
diff --git a/scripts/selfhost-config.test.sh b/scripts/selfhost-config.test.sh
index d8d7051080..ca0161f271 100755
--- a/scripts/selfhost-config.test.sh
+++ b/scripts/selfhost-config.test.sh
@@ -88,6 +88,32 @@ while IFS= read -r llm_var; do
fi
done < <(grep -oE '^MULTICA_LLM_[A-Z_]+' .env.example)
+# The same drift for integration encryption keys, keyed on the server rather
+# than on .env.example: each secretbox.LoadKey() gates an integration that
+# stays silently disabled when its key never reaches the container. Telegram's
+# key was once missing from both files, so a check that trusted the
+# documentation alone would not have caught it.
+secret_keys="$(
+ grep -rhoE --include='*.go' --exclude='*_test.go' 'secretbox\.LoadKey\("[A-Z0-9_]+"\)' server |
+ sed -E 's/.*"([A-Z0-9_]+)".*/\1/' | sort -u
+)" || true
+if [ -z "$secret_keys" ]; then
+ echo "Found no secretbox.LoadKey(\"...\") calls under server/; this check no longer"
+ echo "sees the integration keys and needs updating."
+ exit 1
+fi
+while IFS= read -r secret_key; do
+ if ! grep -Eq "^[[:space:]]+${secret_key}: \\\$\{${secret_key}:-" docker-compose.selfhost.yml; then
+ echo "$secret_key is loaded by the server but not mapped into the backend service"
+ echo "in docker-compose.selfhost.yml, so self-hosted deployments cannot enable it."
+ exit 1
+ fi
+ if ! grep -Eq "^${secret_key}=" .env.example; then
+ echo "$secret_key is loaded by the server but missing from .env.example."
+ exit 1
+ fi
+done <<<"$secret_keys"
+
for script in scripts/dev.sh scripts/check.sh; do
if ! grep -Fq '. scripts/local-env.sh' "$script"; then
echo "$script must source scripts/local-env.sh for shared local env derivation."