@@ -209,9 +209,18 @@ async fn windows_elevated_enforces_deny_read_and_protects_setup_marker() -> anyh
209209 let exact_secret = cwd. join ( "exact-secret.txt" ) ;
210210 let public = cwd. join ( "public.txt" ) ;
211211 let setup_marker = codex_home. path ( ) . join ( ".sandbox" ) . join ( "setup_marker.json" ) ;
212+ let batch = cwd. join ( "sandbox-check.CMD" ) ;
212213 std:: fs:: write ( & glob_secret, "glob secret\n " ) ?;
213214 std:: fs:: write ( & exact_secret, "exact secret\n " ) ?;
214215 std:: fs:: write ( & public, "public ok\n " ) ?;
216+ std:: fs:: write (
217+ & batch,
218+ format ! (
219+ "@echo off\r \n (type secret.env 1>NUL 2>NUL && echo GLOB-READ || echo GLOB-DENIED) & (type exact-secret.txt 1>NUL 2>NUL && echo EXACT-READ || echo EXACT-DENIED) & (type \" {}\" 1>NUL 2>NUL && echo MARKER-READ-ALLOWED || echo MARKER-READ-DENIED) & (echo tampered > \" {}\" 2>NUL && echo MARKER-WRITE-ALLOWED || echo MARKER-WRITE-DENIED) & type public.txt\r \n " ,
220+ setup_marker. display( ) ,
221+ setup_marker. display( )
222+ ) ,
223+ ) ?;
215224
216225 let file_system_sandbox_policy = FileSystemSandboxPolicy :: restricted ( vec ! [
217226 FileSystemSandboxEntry {
@@ -243,25 +252,17 @@ async fn windows_elevated_enforces_deny_read_and_protects_setup_marker() -> anyh
243252 ) ;
244253
245254 let ExecToolCallOutput {
246- exit_code,
247- stdout,
248- ..
255+ exit_code, stdout, ..
249256 } = process_exec_tool_call (
250257 ExecParams {
251- command : vec ! [
252- "cmd.exe" . to_string( ) ,
253- "/D" . to_string( ) ,
254- "/C" . to_string( ) ,
255- format!(
256- "(type secret.env 1>NUL 2>NUL && echo GLOB-READ || echo GLOB-DENIED) & (type exact-secret.txt 1>NUL 2>NUL && echo EXACT-READ || echo EXACT-DENIED) & (type \" {}\" 1>NUL 2>NUL && echo MARKER-READ-ALLOWED || echo MARKER-READ-DENIED) & (echo tampered > \" {}\" 2>NUL && echo MARKER-WRITE-ALLOWED || echo MARKER-WRITE-DENIED) & type public.txt" ,
257- setup_marker. display( ) ,
258- setup_marker. display( )
259- ) ,
260- ] ,
258+ command : vec ! [ "sandbox-check" . to_string( ) ] ,
261259 cwd : cwd. clone ( ) ,
262260 expiration : 10_000 . into ( ) ,
263261 capture_policy : ExecCapturePolicy :: ShellTool ,
264- env : HashMap :: new ( ) ,
262+ env : HashMap :: from ( [
263+ ( "Path" . to_string ( ) , cwd. display ( ) . to_string ( ) ) ,
264+ ( "PathExt" . to_string ( ) , ".CMD" . to_string ( ) ) ,
265+ ] ) ,
265266 network : None ,
266267 network_environment_id : None ,
267268 sandbox_permissions : SandboxPermissions :: UseDefault ,
0 commit comments