mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:31:23 +00:00
fix(security): scope session tools and webhook secret fallback
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { createOpenClawTools } from "../agents/openclaw-tools.js";
|
||||
import { resolveSessionTranscriptPath } from "../config/sessions.js";
|
||||
import { emitAgentEvent } from "../infra/agent-events.js";
|
||||
import { captureEnv } from "../test-utils/env.js";
|
||||
@@ -13,6 +12,8 @@ import {
|
||||
testState,
|
||||
} from "./test-helpers.js";
|
||||
|
||||
const { createOpenClawTools } = await import("../agents/openclaw-tools.js");
|
||||
|
||||
installGatewayTestHooks({ scope: "suite" });
|
||||
|
||||
let server: Awaited<ReturnType<typeof startGatewayServer>>;
|
||||
@@ -111,6 +112,18 @@ describe("sessions_send gateway loopback", () => {
|
||||
|
||||
describe("sessions_send label lookup", () => {
|
||||
it("finds session by label and sends message", { timeout: 60_000 }, async () => {
|
||||
// This is an operator feature; enable broader session tool targeting for this test.
|
||||
const configPath = process.env.OPENCLAW_CONFIG_PATH;
|
||||
if (!configPath) {
|
||||
throw new Error("OPENCLAW_CONFIG_PATH missing in gateway test environment");
|
||||
}
|
||||
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
JSON.stringify({ tools: { sessions: { visibility: "all" } } }, null, 2) + "\n",
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
const spy = vi.mocked(agentCommand);
|
||||
spy.mockImplementation(async (opts) => {
|
||||
const params = opts as {
|
||||
|
||||
Reference in New Issue
Block a user