fix: harden Discord native command auth (#70711) (thanks @vincentkoc) · openclaw/openclaw@bfcae63
steipete
·
2026-04-24
·
via Recent Commits to openclaw:main
File tree
extensions/discord/src/monitor
| Original file line number | Diff line number | Diff line change |
|---|
@@ -291,6 +291,27 @@ describe("Discord native slash commands with commands.allowFrom", () => {
|
291 | 291 | expectUnauthorizedReply(interaction); |
292 | 292 | }); |
293 | 293 | |
| 294 | +it("rejects guild slash commands when owner restrictions are configured and the sender is not allowlisted", async () => { |
| 295 | +const { dispatchSpy, interaction } = await runGuildSlashCommand({ |
| 296 | +userId: "999999999999999999", |
| 297 | +mutateConfig: (cfg) => { |
| 298 | +cfg.commands = { |
| 299 | + ...cfg.commands, |
| 300 | +allowFrom: undefined, |
| 301 | +}; |
| 302 | +cfg.channels = { |
| 303 | + ...cfg.channels, |
| 304 | +discord: { |
| 305 | + ...cfg.channels?.discord, |
| 306 | +allowFrom: ["user:123456789012345678"], |
| 307 | +}, |
| 308 | +}; |
| 309 | +}, |
| 310 | +}); |
| 311 | +expect(dispatchSpy).not.toHaveBeenCalled(); |
| 312 | +expectUnauthorizedReply(interaction); |
| 313 | +}); |
| 314 | + |
294 | 315 | it("rejects guild slash commands outside the Discord allowlist when commands.useAccessGroups is false and commands.allowFrom is not configured", async () => { |
295 | 316 | const { dispatchSpy, interaction } = await runGuildSlashCommand({ |
296 | 317 | mutateConfig: (cfg) => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。