





















@@ -606,6 +606,98 @@ describe("msteams monitor handler authz", () => {
606606expect(runtimeApiMockState.dispatchReplyFromConfigWithSettledDispatcher).not.toHaveBeenCalled();
607607});
608608609+it("marks skipped channel message system events as non-owner", async () => {
610+resetThreadMocks();
611+const { deps, enqueueSystemEvent } = createDeps({
612+channels: {
613+msteams: {
614+groupPolicy: "open",
615+requireMention: true,
616+},
617+},
618+} as OpenClawConfig);
619+620+const handler = createMSTeamsMessageHandler(deps);
621+await handler(
622+createMessageActivity({
623+id: "msg-skip-mention",
624+text: "please run the deployment",
625+from: {
626+id: "member-id",
627+aadObjectId: "member-aad",
628+name: "Member",
629+},
630+conversation: {
631+id: "19:channel@thread.tacv2",
632+conversationType: "channel",
633+},
634+channelData: {
635+team: { id: "team123", name: "Team 123" },
636+channel: { name: "General" },
637+},
638+}),
639+);
640+641+expect(runtimeApiMockState.dispatchReplyFromConfigWithSettledDispatcher).not.toHaveBeenCalled();
642+const systemEventCall = enqueueSystemEvent.mock.calls.find(
643+([text]) => typeof text === "string" && text.includes("please run the deployment"),
644+);
645+if (!systemEventCall) {
646+throw new Error("expected skipped Teams message system event");
647+}
648+expect(systemEventCall[1]).toMatchObject({
649+forceSenderIsOwnerFalse: true,
650+trusted: false,
651+});
652+});
653+654+it("keeps dispatched primary message system events owner-neutral", async () => {
655+resetThreadMocks();
656+const { deps, enqueueSystemEvent } = createDeps({
657+channels: {
658+msteams: {
659+groupPolicy: "open",
660+requireMention: false,
661+},
662+},
663+} as OpenClawConfig);
664+665+const handler = createMSTeamsMessageHandler(deps);
666+await handler(
667+createMessageActivity({
668+id: "msg-active",
669+text: "please check the build",
670+from: {
671+id: "member-id",
672+aadObjectId: "member-aad",
673+name: "Member",
674+},
675+conversation: {
676+id: "19:channel@thread.tacv2",
677+conversationType: "channel",
678+},
679+channelData: {
680+team: { id: "team123", name: "Team 123" },
681+channel: { name: "General" },
682+},
683+}),
684+);
685+686+expect(runtimeApiMockState.dispatchReplyFromConfigWithSettledDispatcher).toHaveBeenCalled();
687+const systemEventCall = enqueueSystemEvent.mock.calls.find(
688+([text]) => typeof text === "string" && text.includes("please check the build"),
689+);
690+if (!systemEventCall) {
691+throw new Error("expected active Teams message system event");
692+}
693+expect(systemEventCall[1]).not.toMatchObject({
694+forceSenderIsOwnerFalse: true,
695+});
696+expect(systemEventCall[1]).not.toMatchObject({
697+trusted: false,
698+});
699+});
700+609701it("authorizes text control commands from static access groups", async () => {
610702resetThreadMocks();
611703const hasControlCommand = vi.fn(() => true);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。