security(feishu): bind doc create grants to trusted requester context (#31184)

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Tak Hoffman
2026-03-01 20:51:45 -06:00
committed by GitHub
parent e482da6682
commit bbab94c1fe
9 changed files with 142 additions and 91 deletions

View File

@@ -0,0 +1,28 @@
import { describe, expect, it, vi } from "vitest";
const resolvePluginToolsMock = vi.fn(() => []);
vi.mock("../plugins/tools.js", () => ({
resolvePluginTools: (params: unknown) => resolvePluginToolsMock(params),
}));
import { createOpenClawTools } from "./openclaw-tools.js";
describe("createOpenClawTools plugin context", () => {
it("forwards trusted requester sender identity to plugin tool context", () => {
createOpenClawTools({
config: {} as never,
requesterSenderId: "trusted-sender",
senderIsOwner: true,
});
expect(resolvePluginToolsMock).toHaveBeenCalledWith(
expect.objectContaining({
context: expect.objectContaining({
requesterSenderId: "trusted-sender",
senderIsOwner: true,
}),
}),
);
});
});