fix(core): implement __read and __write commands in sandbox managers (#24283)

This commit is contained in:
Gal Zahavi
2026-03-31 12:39:51 -07:00
committed by GitHub
parent 7e117ac0ac
commit 554a5a36a3
7 changed files with 112 additions and 12 deletions
@@ -236,6 +236,12 @@ export class WindowsSandboxManager implements SandboxManager {
false,
};
if (req.command === '__read' && req.args[0]) {
mergedAdditional.fileSystem!.read!.push(req.args[0]);
} else if (req.command === '__write' && req.args[0]) {
mergedAdditional.fileSystem!.write!.push(req.args[0]);
}
const defaultNetwork =
this.options.modeConfig?.network || req.policy?.networkAccess || false;
const networkAccess = defaultNetwork || mergedAdditional.network;
@@ -72,6 +72,8 @@ export function isKnownSafeCommand(args: string[]): boolean {
// Native Windows/PowerShell safe commands
const safeCommands = new Set([
'__read',
'__write',
'dir',
'type',
'echo',