mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 15:31:46 +00:00
fix: harden ACP secret handling and exec preflight boundaries
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||
import type {
|
||||
ExecElevatedDefaults,
|
||||
ExecToolDefaults,
|
||||
ExecToolDetails,
|
||||
} from "./bash-tools.exec-types.js";
|
||||
import { type ExecHost, maxAsk, minSecurity, resolveSafeBins } from "../infra/exec-approvals.js";
|
||||
import { getTrustedSafeBinDirs } from "../infra/exec-safe-bin-trust.js";
|
||||
import {
|
||||
@@ -28,11 +33,6 @@ import {
|
||||
execSchema,
|
||||
validateHostEnv,
|
||||
} from "./bash-tools.exec-runtime.js";
|
||||
import type {
|
||||
ExecElevatedDefaults,
|
||||
ExecToolDefaults,
|
||||
ExecToolDetails,
|
||||
} from "./bash-tools.exec-types.js";
|
||||
import {
|
||||
buildSandboxEnv,
|
||||
clampWithDefault,
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
resolveWorkdir,
|
||||
truncateMiddle,
|
||||
} from "./bash-tools.shared.js";
|
||||
import { assertSandboxPath } from "./sandbox-paths.js";
|
||||
|
||||
export type { BashSandboxConfig } from "./bash-tools.shared.js";
|
||||
export type {
|
||||
@@ -91,6 +92,11 @@ async function validateScriptFileForShellBleed(params: {
|
||||
// Best-effort: only validate if file exists and is reasonably small.
|
||||
let stat: { isFile(): boolean; size: number };
|
||||
try {
|
||||
await assertSandboxPath({
|
||||
filePath: absPath,
|
||||
cwd: params.workdir,
|
||||
root: params.workdir,
|
||||
});
|
||||
stat = await fs.stat(absPath);
|
||||
} catch {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user