mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:28:27 +00:00
fix(security): harden root file guards and host writes
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
codingTools,
|
||||
createEditTool,
|
||||
createReadTool,
|
||||
createWriteTool,
|
||||
readTool,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
import { codingTools, createReadTool, readTool } from "@mariozechner/pi-coding-agent";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { ToolLoopDetectionConfig } from "../config/types.tools.js";
|
||||
import { resolveMergedSafeBinProfileFixtures } from "../infra/exec-safe-bin-runtime-policy.js";
|
||||
@@ -34,7 +28,8 @@ import {
|
||||
} from "./pi-tools.policy.js";
|
||||
import {
|
||||
assertRequiredParams,
|
||||
CLAUDE_PARAM_GROUPS,
|
||||
createHostWorkspaceEditTool,
|
||||
createHostWorkspaceWriteTool,
|
||||
createOpenClawReadTool,
|
||||
createSandboxedEditTool,
|
||||
createSandboxedReadTool,
|
||||
@@ -364,22 +359,14 @@ export function createOpenClawCodingTools(options?: {
|
||||
if (sandboxRoot) {
|
||||
return [];
|
||||
}
|
||||
// Wrap with param normalization for Claude Code compatibility
|
||||
const wrapped = wrapToolParamNormalization(
|
||||
createWriteTool(workspaceRoot),
|
||||
CLAUDE_PARAM_GROUPS.write,
|
||||
);
|
||||
const wrapped = createHostWorkspaceWriteTool(workspaceRoot);
|
||||
return [workspaceOnly ? wrapToolWorkspaceRootGuard(wrapped, workspaceRoot) : wrapped];
|
||||
}
|
||||
if (tool.name === "edit") {
|
||||
if (sandboxRoot) {
|
||||
return [];
|
||||
}
|
||||
// Wrap with param normalization for Claude Code compatibility
|
||||
const wrapped = wrapToolParamNormalization(
|
||||
createEditTool(workspaceRoot),
|
||||
CLAUDE_PARAM_GROUPS.edit,
|
||||
);
|
||||
const wrapped = createHostWorkspaceEditTool(workspaceRoot);
|
||||
return [workspaceOnly ? wrapToolWorkspaceRootGuard(wrapped, workspaceRoot) : wrapped];
|
||||
}
|
||||
return [tool];
|
||||
|
||||
Reference in New Issue
Block a user