mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 02:24:31 +00:00
fix: harden sandbox media reads against TOCTOU escapes
This commit is contained in:
@@ -8,6 +8,16 @@ export type SandboxedBridgeMediaPathConfig = {
|
||||
workspaceOnly?: boolean;
|
||||
};
|
||||
|
||||
export function createSandboxBridgeReadFile(params: {
|
||||
sandbox: Pick<SandboxedBridgeMediaPathConfig, "root" | "bridge">;
|
||||
}): (filePath: string) => Promise<Buffer> {
|
||||
return async (filePath: string) =>
|
||||
await params.sandbox.bridge.readFile({
|
||||
filePath,
|
||||
cwd: params.sandbox.root,
|
||||
});
|
||||
}
|
||||
|
||||
export async function resolveSandboxedBridgeMediaPath(params: {
|
||||
sandbox: SandboxedBridgeMediaPathConfig;
|
||||
mediaPath: string;
|
||||
|
||||
Reference in New Issue
Block a user