mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:18:28 +00:00
fix(security): harden channel auth path checks and exec approval routing
This commit is contained in:
@@ -20,6 +20,7 @@ import { parseDurationMs } from "../../cli/parse-duration.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { formatExecCommand } from "../../infra/system-run-command.js";
|
||||
import { imageMimeFromFormat } from "../../media/mime.js";
|
||||
import type { GatewayMessageChannel } from "../../utils/message-channel.js";
|
||||
import { resolveSessionAgentId } from "../agent-scope.js";
|
||||
import { resolveImageSanitizationLimits } from "../image-sanitization.js";
|
||||
import { optionalStringEnum, stringEnum } from "../schema/typebox.js";
|
||||
@@ -128,9 +129,17 @@ const NodesToolSchema = Type.Object({
|
||||
|
||||
export function createNodesTool(options?: {
|
||||
agentSessionKey?: string;
|
||||
agentChannel?: GatewayMessageChannel;
|
||||
agentAccountId?: string;
|
||||
currentChannelId?: string;
|
||||
currentThreadTs?: string | number;
|
||||
config?: OpenClawConfig;
|
||||
}): AnyAgentTool {
|
||||
const sessionKey = options?.agentSessionKey?.trim() || undefined;
|
||||
const turnSourceChannel = options?.agentChannel?.trim() || undefined;
|
||||
const turnSourceTo = options?.currentChannelId?.trim() || undefined;
|
||||
const turnSourceAccountId = options?.agentAccountId?.trim() || undefined;
|
||||
const turnSourceThreadId = options?.currentThreadTs;
|
||||
const agentId = resolveSessionAgentId({
|
||||
sessionKey: options?.agentSessionKey,
|
||||
config: options?.config,
|
||||
@@ -512,6 +521,10 @@ export function createNodesTool(options?: {
|
||||
host: "node",
|
||||
agentId,
|
||||
sessionKey,
|
||||
turnSourceChannel,
|
||||
turnSourceTo,
|
||||
turnSourceAccountId,
|
||||
turnSourceThreadId,
|
||||
timeoutMs: APPROVAL_TIMEOUT_MS,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user