fix(slack): use SLACK_USER_TOKEN when connecting to Slack#28103
fix(slack): use SLACK_USER_TOKEN when connecting to Slack#28103Takhoffman merged 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryRefactored Slack user token handling to centralize resolution at account level (supporting SLACK_USER_TOKEN env var) and extended Google provider schema sanitization to all google-* providers.
Issue: The Slack extension plugin ( Confidence Score: 3/5
Last reviewed commit: ba6d3b9 |
Additional Comments (2)
Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/slack/src/channel.ts
Line: 42
Comment:
inconsistent with core changes - should use `account.userToken` instead of accessing `account.config.userToken` directly (this won't work with SLACK_USER_TOKEN env var)
How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/slack/src/channel.ts
Line: 207
Comment:
inconsistent with core changes - should use `account.userToken` instead of accessing `account.config.userToken` directly (this won't work with SLACK_USER_TOKEN env var)
How can I resolve this? If you propose a fix, please make it concise. |
|
The |
|
The |
🔒 Aisle Security AnalysisWe found 2 potential security issue(s) in this PR:
1. 🟡 Slack action reads now implicitly use env-sourced user token (SLACK_USER_TOKEN), expanding data access beyond bot token
DescriptionThe Slack actions tool now uses This creates an implicit privilege expansion:
Vulnerable code: const account = resolveSlackAccount({ cfg, accountId });
// ...
const userToken = account.userToken;
const getTokenForOperation = (operation: "read" | "write") => {
if (operation === "read") {
return userToken ?? botToken; // user token is preferred for reads
}
// ...
};Related enabling change (env user token resolution): const envUser = allowEnv ? resolveSlackUserToken(process.env.SLACK_USER_TOKEN) : undefined;
const userToken = configUser ?? envUser;Even though RecommendationRequire explicit opt-in before using an environment-provided Slack user token for tool operations. Options:
// Use config-provided token only (explicit opt-in)
const userToken = account.config.userToken?.trim() || undefined;
const userToken = account.config.allowEnvUserToken
? account.userToken
: account.config.userToken?.trim() || undefined;
Additionally, document clearly that setting 2. 🔵 Implicit SLACK_USER_TOKEN env var enables user-token Slack API usage in monitor provider (least-privilege regression)
DescriptionThe Slack monitor provider now prefers Because Impact:
Vulnerable change (token selection): const resolveToken = account.userToken || botToken;Example sinks using await resolveSlackChannelAllowlist({ token: resolveToken, entries });
await resolveSlackUserAllowlist({ token: resolveToken, entries: allowEntries });RecommendationRequire explicit opt-in before using a user token (especially if sourced from environment), and default to bot token for monitor operations. Options:
const resolveToken = slackCfg.userToken?.trim() || botToken;
const allowUserToken = slackCfg.useUserTokenForLookups === true;
const resolveToken = allowUserToken && account.userToken ? account.userToken : botToken;
Analyzed PR: #28103 at commit Last updated on: 2026-03-01T17:47:44Z |
|
Merged via squash in 6dbbc58. Thanks for the contribution. I pushed a small follow-up fix commit (
Verification run on the merged head:
All three passed. |
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…8103) * fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes openclaw#26480) * test(slack): fix account fixture typing for user token source --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
fix(slack): use SLACK_USER_TOKEN when connecting to Slack (closes #26480)
fix(providers): extend sanitizeToolsForGoogle to cover google-generative-ai provider (closes #20197)
Diff: 12 files changed, 42 insertions(+), 16 deletions(-)
Fixes #26480
🤖 Generated with Claude Code