fix(slack): allowlisted users for channel mentions#3752
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughAdds Slack channel ChangesSlack channel
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
|
🚀 Docs preview ready! |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
There was a problem hiding this comment.
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
📒 Files selected for processing (9)
Dockerfiledocs/manage-sandboxes/messaging-channels.mdscripts/generate-openclaw-config.pytest/e2e/docs/parity-inventory.generated.jsontest/e2e/docs/parity-map.yamltest/e2e/lib/fake-slack-api.cjstest/e2e/lib/slack-api-proof.shtest/e2e/test-messaging-providers.shtest/generate-openclaw-config.test.ts
Selective E2E Results — ❌ Some jobs failedRun: 26052929804
|
Selective E2E Results — ✅ All requested jobs passedRun: 26054248099
|
Selective E2E Results — ✅ All requested jobs passedRun: 26055880552
|
Summary
@mentiongatingSLACK_ALLOWED_USERScovers Slack DMs and channel mentions where the app is presentchat.postMessagecapture and allowed/denied channel mention proofFixes #3729.
Validation
npm test -- test/generate-openclaw-config.test.ts test/e2e/scenario-framework-tests/e2e-coverage-report.test.tsnpm test -- test/e2e/scenario-framework-tests/e2e-convention-lint.test.tsnpm test -- test/cli.test.ts test/nemoclaw-start.test.ts src/lib/status-command-deps.test.tsnpm run build:clinpm run typecheck:clibash -n test/e2e/test-messaging-providers.sh test/e2e/lib/slack-api-proof.shnode --check test/e2e/lib/fake-slack-api.cjspython3 -m py_compile scripts/generate-openclaw-config.pynpx tsx scripts/e2e/check-parity-map.ts --strictRuntime E2E
test/e2e/test-messaging-providers.shbuilt the sandbox image with the updated Slack config and the generated image containsdmPolicy: allowlist,allowFrom,groupPolicy: allowlist, and wildcard channelrequireMentionplususersfor the configured Slack IDs.exec: "/opt/openshell/bin/openshell-sandbox": is a directory: permission deniedafter image build, before the in-sandbox Slack proof could execute.Summary by CodeRabbit
New Features
@mentionevents to configured Slack user IDs; wildcard channel mention policy now enforces require-mention behavior.Documentation
Tests