Skip to content

Commit 9520630

Browse files
committed
fix(orchestrate): treat whitespace Slack tokens as unset
slackTokenConfigured() already trimmed ORCHESTRATE_SLACK_BOT_TOKEN, but createSlackWebClient() used the raw env value, so a spaces-only token skipped channel guards while still initializing an unusable WebClient. Share one trimmed reader so both helpers agree.
1 parent bb783a1 commit 9520630

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • orchestrate/skills/orchestrate/scripts/adapters/slack

orchestrate/skills/orchestrate/scripts/adapters/slack/client.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ export const SLACK_TOKEN_ENV = "ORCHESTRATE_SLACK_BOT_TOKEN";
55

66
const LEGACY_SLACK_TOKEN_ENV = "SLACK_BOT_TOKEN";
77

8+
function readSlackToken(): string | undefined {
9+
const token = process.env[SLACK_TOKEN_ENV]?.trim();
10+
return token || undefined;
11+
}
12+
813
export function slackTokenConfigured(): boolean {
9-
return Boolean(process.env[SLACK_TOKEN_ENV]?.trim());
14+
return Boolean(readSlackToken());
1015
}
1116

1217
export function createSlackWebClient(): WebClient | undefined {
13-
const token = process.env[SLACK_TOKEN_ENV];
18+
const token = readSlackToken();
1419
if (!token) {
1520
// Losing Slack silently after the rename would look like an outage, so
1621
// name the old variable when it's the only one set.

0 commit comments

Comments
 (0)