diff --git a/extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts b/extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts index d62ba6995cb..efa09626b50 100644 --- a/extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts +++ b/extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts @@ -291,6 +291,27 @@ describe("Discord native slash commands with commands.allowFrom", () => { expectUnauthorizedReply(interaction); }); + it("rejects guild slash commands when owner restrictions are configured and the sender is not allowlisted", async () => { + const { dispatchSpy, interaction } = await runGuildSlashCommand({ + userId: "999999999999999999", + mutateConfig: (cfg) => { + cfg.commands = { + ...cfg.commands, + allowFrom: undefined, + }; + cfg.channels = { + ...cfg.channels, + discord: { + ...cfg.channels?.discord, + allowFrom: ["user:123456789012345678"], + }, + }; + }, + }); + expect(dispatchSpy).not.toHaveBeenCalled(); + expectUnauthorizedReply(interaction); + }); + it("rejects guild slash commands outside the Discord allowlist when commands.useAccessGroups is false and commands.allowFrom is not configured", async () => { const { dispatchSpy, interaction } = await runGuildSlashCommand({ mutateConfig: (cfg) => {