mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 20:51:10 +00:00
33 lines
928 B
TypeScript
33 lines
928 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { msTeamsApprovalAuth } from "./approval-auth.js";
|
|
|
|
describe("msTeamsApprovalAuth", () => {
|
|
it("authorizes stable Teams user ids and ignores display-name allowlists", () => {
|
|
expect(
|
|
msTeamsApprovalAuth.authorizeActorAction({
|
|
cfg: {
|
|
channels: {
|
|
msteams: {
|
|
allowFrom: ["user:123e4567-e89b-12d3-a456-426614174000"],
|
|
},
|
|
},
|
|
},
|
|
senderId: "123e4567-e89b-12d3-a456-426614174000",
|
|
action: "approve",
|
|
approvalKind: "exec",
|
|
}),
|
|
).toEqual({ authorized: true });
|
|
|
|
expect(
|
|
msTeamsApprovalAuth.authorizeActorAction({
|
|
cfg: {
|
|
channels: { msteams: { allowFrom: ["Owner Display"] } },
|
|
},
|
|
senderId: "attacker-aad",
|
|
action: "approve",
|
|
approvalKind: "exec",
|
|
}),
|
|
).toEqual({ authorized: true });
|
|
});
|
|
});
|