mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
refactor(gateway): centralize node.invoke param sanitization
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
verifyNodeToken,
|
||||
} from "../../infra/node-pairing.js";
|
||||
import { isNodeCommandAllowed, resolveNodeCommandAllowlist } from "../node-command-policy.js";
|
||||
import { sanitizeSystemRunParamsForForwarding } from "../node-invoke-system-run-approval.js";
|
||||
import { sanitizeNodeInvokeParamsForForwarding } from "../node-invoke-sanitize.js";
|
||||
import {
|
||||
ErrorCodes,
|
||||
errorShape,
|
||||
@@ -418,14 +418,12 @@ export const nodeHandlers: GatewayRequestHandlers = {
|
||||
);
|
||||
return;
|
||||
}
|
||||
const forwardedParams =
|
||||
command === "system.run"
|
||||
? sanitizeSystemRunParamsForForwarding({
|
||||
rawParams: p.params,
|
||||
client,
|
||||
execApprovalManager: context.execApprovalManager,
|
||||
})
|
||||
: ({ ok: true, params: p.params } as const);
|
||||
const forwardedParams = sanitizeNodeInvokeParamsForForwarding({
|
||||
command,
|
||||
rawParams: p.params,
|
||||
client,
|
||||
execApprovalManager: context.execApprovalManager,
|
||||
});
|
||||
if (!forwardedParams.ok) {
|
||||
respond(
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user