Skip to content

fix(slack): allowlisted users for channel mentions#3752

Merged
ericksoa merged 2 commits into
mainfrom
fix/slack-channel-mention-allowlist
May 18, 2026
Merged

fix(slack): allowlisted users for channel mentions#3752
ericksoa merged 2 commits into
mainfrom
fix/slack-channel-mention-allowlist

Conversation

@ericksoa

@ericksoa ericksoa commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reuse Slack allowed IDs for both DM allowlisting and wildcard channel @mention gating
  • document that SLACK_ALLOWED_USERS covers Slack DMs and channel mentions where the app is present
  • extend messaging-provider E2E coverage with fake Slack chat.postMessage capture and allowed/denied channel mention proof

Fixes #3729.

Validation

  • npm test -- test/generate-openclaw-config.test.ts test/e2e/scenario-framework-tests/e2e-coverage-report.test.ts
  • npm test -- test/e2e/scenario-framework-tests/e2e-convention-lint.test.ts
  • npm test -- test/cli.test.ts test/nemoclaw-start.test.ts src/lib/status-command-deps.test.ts
  • npm run build:cli
  • npm run typecheck:cli
  • bash -n test/e2e/test-messaging-providers.sh test/e2e/lib/slack-api-proof.sh
  • node --check test/e2e/lib/fake-slack-api.cjs
  • python3 -m py_compile scripts/generate-openclaw-config.py
  • npx tsx scripts/e2e/check-parity-map.ts --strict
  • commit and push hooks passed

Runtime E2E

  • test/e2e/test-messaging-providers.sh built the sandbox image with the updated Slack config and the generated image contains dmPolicy: allowlist, allowFrom, groupPolicy: allowlist, and wildcard channel requireMention plus users for the configured Slack IDs.
  • The run did not complete sandbox startup on this host: OpenShell returned exec: "/opt/openshell/bin/openshell-sandbox": is a directory: permission denied after image build, before the in-sandbox Slack proof could execute.

Summary by CodeRabbit

  • New Features

    • Slack allowlist support: restrict direct messages and channel @mention events to configured Slack user IDs; wildcard channel mention policy now enforces require-mention behavior.
  • Documentation

    • Messaging docs updated with new Slack allowed-users setting and environment variable example.
  • Tests

    • Expanded end-to-end and unit tests to validate Slack allowlist behavior, mention handling, and message-capture proofs.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 43066487-cd16-4444-b7ab-26628ea44912

📥 Commits

Reviewing files that changed from the base of the PR and between 4620f84 and 1f066b0.

📒 Files selected for processing (6)
  • docs/manage-sandboxes/messaging-channels.md
  • test/e2e/docs/parity-inventory.generated.json
  • test/e2e/docs/parity-map.yaml
  • test/e2e/lib/fake-slack-api.cjs
  • test/e2e/lib/slack-api-proof.sh
  • test/e2e/test-messaging-providers.sh
✅ Files skipped from review due to trivial changes (1)
  • docs/manage-sandboxes/messaging-channels.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/e2e/docs/parity-map.yaml
  • test/e2e/docs/parity-inventory.generated.json
  • test/e2e/lib/fake-slack-api.cjs
  • test/e2e/lib/slack-api-proof.sh
  • test/e2e/test-messaging-providers.sh

📝 Walkthrough

Walkthrough

Adds Slack channel @mention allowlisting: docs and docstrings updated, config generator emits Slack channel allowlist fields (groupPolicy and channels["*"] with requireMention/users), fake Slack API and an in-sandbox proof helper added, E2E tests extended, and parity fixtures regenerated.

Changes

Slack channel @mention allowlisting

Layer / File(s) Summary
Documentation and configuration schema
Dockerfile, docs/manage-sandboxes/messaging-channels.md, scripts/generate-openclaw-config.py
Document SLACK_ALLOWED_USERS and adjust NEMOCLAW_MESSAGING_ALLOWED_IDS_B64 docstring to mention Slack DM and channel @mention coverage.
Config generation and unit test
scripts/generate-openclaw-config.py, test/generate-openclaw-config.test.ts
Generator now emits groupPolicy: allowlist and a channels["*"] stanza with requireMention: true and users populated from allowed IDs when present; unit test asserts these fields.
Fake Slack API enhancements
test/e2e/lib/fake-slack-api.cjs
Form parsing unified via URLSearchParams; /api/chat.postMessage captures message fields and returns Slack-style success/error JSON while other endpoints keep prior behavior.
Slack @mention allowlist proof helper
test/e2e/lib/slack-api-proof.sh
New run_fake_slack_channel_mention_proof(port, allowed_user, denied_user) builds an isolated Node.js proof workspace, dynamically imports Slack test helpers, validates config, and exercises prepare/send flows for allowed and denied users.
E2E test integration
test/e2e/test-messaging-providers.sh
Document/export SLACK_ALLOWED_USERSSLACK_IDS; log configured count; verify dmPolicy/groupPolicy: allowlist, wildcard channel requireMention and users; add check_fake_slack_capture_message and M-S17 in-sandbox mention-allowlist proof that validates accept/deny and reply metadata.
Generated test assertion fixtures
test/e2e/docs/parity-map.yaml, test/e2e/docs/parity-inventory.generated.json
Add deferred Slack config assertions (M11fM11h) and mention-proof assertions (M-S17 family); update generated assertion totals (top-level assertions increased to 2010).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

fix, enhancement: messaging, Integration: OpenClaw, E2E

Suggested reviewers

  • cv

Poem

🐰 I hopped through configs, tests, and code,
I nudged the Slack allowlist down the road.
Mentions now find their rightful place,
Proofs run tidy in sandboxed space.
Hooray — no more pairing chase!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: extending Slack to support allowlisted users for channel mentions, which is the core fix for the linked issue.
Linked Issues check ✅ Passed The PR successfully implements option A from issue #3729: extends DM allowFrom to cover channel @mentions by configuring groupPolicy/channels allowlist from the same SLACK_ALLOWED_USERS, enabling configured users to be accepted for both DMs and channel mentions.
Out of Scope Changes check ✅ Passed All changes directly support the primary objective of implementing Slack channel mention allowlisting: config generation, documentation, fake API simulation, proof execution, and E2E test coverage are all in scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/slack-channel-mention-allowlist

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Docs preview ready!

https://NVIDIA.github.io/NemoClaw/pr-preview/pr-3752/

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: messaging-providers-e2e
Optional E2E: channels-stop-start-e2e, token-rotation-e2e

Dispatch hint: messaging-providers-e2e

Auto-dispatched E2E: messaging-providers-e2e via nightly-e2e.yaml at 1f066b010bbd583b22aa6f5dd4e4d3737259d271nightly run

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • messaging-providers-e2e (~45 min): Directly validates Telegram/Discord/Slack messaging provider creation, generated openclaw.json channel config, credential isolation, OpenShell/L7 token rewriting, fake Slack API proof, and the newly added Slack channel @mention allowlist behavior.

Optional E2E

  • channels-stop-start-e2e (~120 min): Useful adjacent confidence for Slack channel lifecycle across add/stop/start/remove and rebuild flows, since the changed generated Slack config is consumed when channel settings are rebuilt into sandbox images.
  • token-rotation-e2e (~45 min): Optional credential propagation regression check for messaging providers including Slack; helps confirm the changed Slack channel config does not interfere with provider credential refresh/re-onboard behavior.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: nightly-e2e.yaml
  • jobs input: messaging-providers-e2e

@ericksoa ericksoa changed the title Fix Slack allowlist for channel mentions fix(slack): allowlisted users for channel mentions May 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/manage-sandboxes/messaging-channels.md`:
- Around line 66-67: Update the Slack row in the channel requirements table to
reflect the new SLACK_ALLOWED_USERS setting: replace the current "None"/optional
note with a brief description like "SLACK_ALLOWED_USERS — comma-separated Slack
member IDs to authorize users for DMs and for channel `@mention` events (channel
messages still require explicit bot mention)"; ensure the wording matches the
paragraph that introduced SLACK_ALLOWED_USERS so the table and the explanatory
text are consistent.

In `@test/e2e/lib/fake-slack-api.cjs`:
- Around line 104-129: The handler for pathname "/api/chat.postMessage"
currently sets the HTTP status based on authAccepted (using
res.writeHead(authAccepted ? 200 : 401)); change it to always return HTTP 200
and keep the existing JSON error payload when authAccepted is false so responses
match Slack (ok: false with error "bad_auth"); update the res.writeHead call to
use 200 unconditionally and leave the JSON body logic that branches on
authAccepted unchanged (refer to variables pathname, authAccepted, res.writeHead
and the JSON branch that produces ok: true vs ok: false).

In `@test/e2e/test-messaging-providers.sh`:
- Line 127: The test currently forces a default when SLACK_ALLOWED_USERS is
empty by using the ":-" expansion in the SLACK_IDS assignment; change it to the
"–" (single dash) expansion so explicit empty SLACK_ALLOWED_USERS="" is honored
(i.e., update the SLACK_IDS assignment that references SLACK_ALLOWED_USERS to
use the `${SLACK_ALLOWED_USERS-...}` form instead of
`${SLACK_ALLOWED_USERS:-...}`).
- Line 220: The test currently logs raw Slack user IDs via the info call
referencing SLACK_IDS; stop exposing these identifiers by changing the info
invocation to log only non-sensitive metadata (e.g., the number of entries or a
redacted form). Update the usage of SLACK_IDS in the info call so it either logs
"Slack allowed users: N" (where N is the count) or maps each ID to a masked
representation (e.g., replace all but last 4 chars or produce a deterministic
hash) before passing to info; modify the code that builds the message where
SLACK_IDS is referenced to perform the redaction so other references remain
unchanged.
- Around line 901-935: The test currently treats an enabled Slack wildcard
channel with requireMention=true but an empty users list as a skip; change the
logic so that when sl_channel_users is empty yet the wildcard config is present
and enabled (i.e., the code path that produced sl_channel_users), the test fails
instead of skipping. Concretely, update the conditional around
sl_channel_users/skip: if sl_channel_users is empty while the wildcard config is
enabled and requireMention is true (use the existing sl_channel_users variable
produced by the Python extractor and the expected_slack_ids/SLACK_IDS
comparison), call fail with a descriptive message (e.g., "M11h: Slack wildcard
channel users is empty but should contain IDs") instead of executing the skip
branch. Ensure the check runs before treating missing or unset configs as skip.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 546a6359-e0f8-41b0-b7dc-96e3713f0328

📥 Commits

Reviewing files that changed from the base of the PR and between d7bae57 and 4620f84.

📒 Files selected for processing (9)
  • Dockerfile
  • docs/manage-sandboxes/messaging-channels.md
  • scripts/generate-openclaw-config.py
  • test/e2e/docs/parity-inventory.generated.json
  • test/e2e/docs/parity-map.yaml
  • test/e2e/lib/fake-slack-api.cjs
  • test/e2e/lib/slack-api-proof.sh
  • test/e2e/test-messaging-providers.sh
  • test/generate-openclaw-config.test.ts

Comment thread docs/manage-sandboxes/messaging-channels.md
Comment thread test/e2e/lib/fake-slack-api.cjs
Comment thread test/e2e/test-messaging-providers.sh Outdated
Comment thread test/e2e/test-messaging-providers.sh Outdated
Comment thread test/e2e/test-messaging-providers.sh
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 26052929804
Target ref: 4620f84953a48bca3c43eb4289cf0e9470adda7a
Workflow ref: main
Requested jobs: messaging-providers-e2e
Summary: 0 passed, 1 failed, 0 skipped

Job Result
messaging-providers-e2e ❌ failure

Failed jobs: messaging-providers-e2e. Check run artifacts for logs.

@ericksoa ericksoa self-assigned this May 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26054248099
Target ref: 1f066b010bbd583b22aa6f5dd4e4d3737259d271
Workflow ref: main
Requested jobs: messaging-providers-e2e
Summary: 1 passed, 0 failed, 0 skipped

Job Result
messaging-providers-e2e ✅ success

@ericksoa ericksoa requested a review from jyaunches May 18, 2026 19:20
@ericksoa ericksoa added v0.0.45 bug Something fails against expected or documented behavior platform: macos Affects macOS, including Apple Silicon NV QA Bugs found by the NVIDIA QA Team integration: slack Slack integration or channel behavior UAT Issues flagged for User Acceptance Testing. v0.0.46 Release target and removed v0.0.45 labels May 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26055880552
Target ref: 1f066b010bbd583b22aa6f5dd4e4d3737259d271
Workflow ref: main
Requested jobs: all (no filter)
Summary: 41 passed, 0 failed, 2 skipped

Job Result
brave-search-e2e ✅ success
channels-stop-start-e2e ✅ success
cloud-e2e ✅ success
cloud-inference-e2e ✅ success
cloud-onboard-e2e ✅ success
credential-migration-e2e ✅ success
credential-sanitization-e2e ✅ success
device-auth-health-e2e ✅ success
diagnostics-e2e ✅ success
docs-validation-e2e ✅ success
double-onboard-e2e ✅ success
gpu-double-onboard-e2e ⏭️ skipped
gpu-e2e ⏭️ skipped
hermes-discord-e2e ✅ success
hermes-e2e ✅ success
hermes-inference-switch-e2e ✅ success
hermes-slack-e2e ✅ success
inference-routing-e2e ✅ success
issue-2478-crash-loop-recovery-e2e ✅ success
kimi-inference-compat-e2e ✅ success
launchable-smoke-e2e ✅ success
messaging-compatible-endpoint-e2e ✅ success
messaging-providers-e2e ✅ success
network-policy-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success
openclaw-inference-switch-e2e ✅ success
openshell-gateway-upgrade-e2e ✅ success
overlayfs-autofix-e2e ✅ success
rebuild-hermes-e2e ✅ success
rebuild-hermes-stale-base-e2e ✅ success
rebuild-openclaw-e2e ✅ success
runtime-overrides-e2e ✅ success
sandbox-operations-e2e ✅ success
sandbox-survival-e2e ✅ success
shields-config-e2e ✅ success
skill-agent-e2e ✅ success
snapshot-commands-e2e ✅ success
state-backup-restore-e2e ✅ success
telegram-injection-e2e ✅ success
token-rotation-e2e ✅ success
tunnel-lifecycle-e2e ✅ success
upgrade-stale-sandbox-e2e ✅ success

@ericksoa ericksoa merged commit 5a03166 into main May 18, 2026
29 checks passed
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression and removed E2E bug Something fails against expected or documented behavior labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression integration: slack Slack integration or channel behavior NV QA Bugs found by the NVIDIA QA Team platform: macos Affects macOS, including Apple Silicon UAT Issues flagged for User Acceptance Testing. v0.0.46 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS][Agent&Skills] Slack channel @mention not covered by DM allowFrom; no allowlist path

3 participants