@@ -290,9 +290,8 @@ func TestCodexEngineRenderMCPConfig(t *testing.T) {
290
290
"[history]" ,
291
291
"persistence = \" none\" " ,
292
292
"" ,
293
- "[sandbox]" ,
294
- "# Network access enabled by default" ,
295
- "network = true" ,
293
+ "# Default sandbox mode with network access enabled" ,
294
+ "sandbox_mode = \" danger-full-access\" " ,
296
295
"" ,
297
296
"[mcp_servers.github]" ,
298
297
"user_agent = \" test-workflow\" " ,
@@ -653,15 +652,12 @@ func TestCodexEngineNetworkConfigGeneration(t *testing.T) {
653
652
engine .renderNetworkConfig (& yaml , nil )
654
653
output := yaml .String ()
655
654
656
- if ! strings .Contains (output , "network = true " ) {
657
- t .Error ("Expected config.toml to contain 'network = true ' for nil permissions" )
655
+ if ! strings .Contains (output , "sandbox_mode = \" danger-full-access \" " ) {
656
+ t .Error ("Expected config.toml to contain 'sandbox_mode = \" danger-full-access \" ' for nil permissions" )
658
657
}
659
- if ! strings .Contains (output , "Network access enabled by default " ) {
658
+ if ! strings .Contains (output , "Default sandbox mode with network access enabled " ) {
660
659
t .Error ("Expected comment about default access" )
661
660
}
662
- if ! strings .Contains (output , "[sandbox]" ) {
663
- t .Error ("Expected config.toml to contain '[sandbox]' section" )
664
- }
665
661
})
666
662
667
663
t .Run ("renderNetworkConfig - empty allowed list" , func (t * testing.T ) {
@@ -672,14 +668,14 @@ func TestCodexEngineNetworkConfigGeneration(t *testing.T) {
672
668
engine .renderNetworkConfig (& yaml , permissions )
673
669
output := yaml .String ()
674
670
675
- if ! strings .Contains (output , "network = false " ) {
676
- t .Error ("Expected config.toml to contain 'network = false ' for empty allowed list" )
671
+ if ! strings .Contains (output , "sandbox_mode = \" workspace-write \" " ) {
672
+ t .Error ("Expected config.toml to contain 'sandbox_mode = \" workspace-write \" ' for empty allowed list" )
677
673
}
678
- if ! strings .Contains (output , "Network access disabled " ) {
679
- t .Error ("Expected comment about disabled access " )
674
+ if ! strings .Contains (output , "network_access = false " ) {
675
+ t .Error ("Expected config.toml to contain 'network_access = false' for empty allowed list " )
680
676
}
681
- if ! strings .Contains (output , "[sandbox] " ) {
682
- t .Error ("Expected config.toml to contain '[sandbox]' section " )
677
+ if ! strings .Contains (output , "Workspace-write mode with no network access " ) {
678
+ t .Error ("Expected comment about workspace-write mode " )
683
679
}
684
680
})
685
681
@@ -691,14 +687,11 @@ func TestCodexEngineNetworkConfigGeneration(t *testing.T) {
691
687
engine .renderNetworkConfig (& yaml , permissions )
692
688
output := yaml .String ()
693
689
694
- if ! strings .Contains (output , "network = true" ) {
695
- t .Error ("Expected config.toml to contain 'network = true' for wildcard" )
696
- }
697
- if ! strings .Contains (output , "Network access enabled" ) {
698
- t .Error ("Expected comment about enabled access" )
690
+ if ! strings .Contains (output , "sandbox_mode = \" danger-full-access\" " ) {
691
+ t .Error ("Expected config.toml to contain 'sandbox_mode = \" danger-full-access\" ' for wildcard" )
699
692
}
700
- if ! strings .Contains (output , "[sandbox] " ) {
701
- t .Error ("Expected config.toml to contain '[sandbox]' section " )
693
+ if ! strings .Contains (output , "Full access mode (danger) " ) {
694
+ t .Error ("Expected comment about full access mode " )
702
695
}
703
696
})
704
697
}
@@ -720,3 +713,37 @@ func TestCodexEngineGetDefaultNetworkPermissions(t *testing.T) {
720
713
t .Errorf ("Expected Codex default to have empty mode, got: %s" , defaults .Mode )
721
714
}
722
715
}
716
+
717
+ func TestCodexEngineGetSandboxParam (t * testing.T ) {
718
+ engine := NewCodexEngine ()
719
+
720
+ t .Run ("getSandboxParam - nil permissions" , func (t * testing.T ) {
721
+ param := engine .getSandboxParam (nil )
722
+ expected := "--sandbox danger-full-access "
723
+ if param != expected {
724
+ t .Errorf ("Expected '%s', got '%s'" , expected , param )
725
+ }
726
+ })
727
+
728
+ t .Run ("getSandboxParam - empty allowed list" , func (t * testing.T ) {
729
+ permissions := & NetworkPermissions {
730
+ Allowed : []string {},
731
+ }
732
+ param := engine .getSandboxParam (permissions )
733
+ expected := "--sandbox workspace-write "
734
+ if param != expected {
735
+ t .Errorf ("Expected '%s', got '%s'" , expected , param )
736
+ }
737
+ })
738
+
739
+ t .Run ("getSandboxParam - wildcard allowed" , func (t * testing.T ) {
740
+ permissions := & NetworkPermissions {
741
+ Allowed : []string {"*" },
742
+ }
743
+ param := engine .getSandboxParam (permissions )
744
+ expected := "--sandbox danger-full-access "
745
+ if param != expected {
746
+ t .Errorf ("Expected '%s', got '%s'" , expected , param )
747
+ }
748
+ })
749
+ }
0 commit comments