Repository navigation
feat(discord): allow DM access groups from channel audiences - #75813
Conversation
|
Codex review: needs changes before merge. What this changes: This PR adds top-level Required change before merge: A narrow automated repair is available: make the PR's Discord channel-audience permission helper owner-aware and add focused coverage. Because the source branch is not maintainer-modifiable, the repair lane may need a replacement branch. Security review: Security review cleared: The diff touches access-control runtime and config surfaces, but I found no concrete supply-chain, CI, dependency, secret-handling, or unauthorized-access regression; the remaining defect is a false block for guild owners. Review findings:
Review detailsBest possible solution: Keep the feature in review, add owner-aware Discord channel permission resolution using the guild owner field before role/admin/overwrite evaluation, add focused owner coverage, and rerun the targeted Discord/config/SDK checks plus the changed gate before merge. Do we have a high-confidence way to reproduce the issue? Yes. A focused test can mock a guild channel that denies Is this the best way to solve the issue? No. The feature direction is maintainable, but the current implementation is not the best fix until the Discord permission helper matches owner/admin/overwrite semantics; the narrow safer repair is an owner short circuit before role and overwrite calculations. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 8043923910e9. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 503d254614
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (params.member.roles?.includes(overwrite.id)) { | ||
| permissions = removePermissionBits(permissions, overwrite.deny ?? "0"); | ||
| permissions = addPermissionBits(permissions, overwrite.allow ?? "0"); | ||
| } |
There was a problem hiding this comment.
Aggregate role overwrites before applying channel permissions
The new DM access-group path calls canViewDiscordGuildChannel, which relies on this role-overwrite loop to decide ViewChannel; however, the code applies each matching role overwrite in sequence, so the final permission depends on the API order of permission_overwrites. Discord’s permission algorithm requires aggregating all matching role denies first and then all allows, so members with conflicting role overwrites can be misclassified (false allow/block), causing accessGroup:<name> DM authorization to be incorrect for real guild setups.
Useful? React with 👍 / 👎.
503d254 to
47922a4
Compare
47922a4 to
88902a0
Compare
88902a0 to
180675d
Compare
180675d to
ff8a482
Compare
ff8a482 to
6c95613
Compare
6c95613 to
a90e8ce
Compare
a90e8ce to
d4c3fe1
Compare
|
Landed, thanks @clawsweeper. Source head: Verification before merge:
|
Summary
accessGroupsconfig with DiscordchannelAudiencegroupsaccessGroup:<name>and authorize by effectiveViewChannelpermissionVerification
pnpm exec vitest run extensions/discord/src/monitor/dm-command-auth.test.ts extensions/discord/src/send.sends-basic-channel-messages.test.ts src/config/config-misc.test.tspnpm tsgo:prodpnpm checkpnpm buildpnpm check:docspnpm test:unitpnpm exec oxfmt --check --threads=1 docs/channels/discord.md extensions/discord/src/monitor/agent-components-dm-auth.ts extensions/discord/src/monitor/access-groups.ts extensions/discord/src/monitor/dm-command-auth.test.ts extensions/discord/src/monitor/dm-command-auth.ts extensions/discord/src/monitor/message-handler.dm-preflight.ts extensions/discord/src/monitor/native-command-auth.ts extensions/discord/src/monitor/native-command.ts extensions/discord/src/send.permissions.ts extensions/discord/src/send.sends-basic-channel-messages.test.ts extensions/discord/src/send.ts src/config/config-misc.test.ts src/config/types.access-groups.ts src/config/types.openclaw.ts src/config/types.ts src/config/zod-schema.tsNote: full repo
pnpm format:checkcurrently reports pre-existing formatter drift in unrelated Feishu/Line/gateway/test files on latest main, so this PR verified formatting on its touched files.