mirror of
https://github.com/Twigpine/zero.git
synced 2026-11-10 13:11:31 -10:00
* feat(sandbox): unify command execution and enforcement * test(sandbox): make platform contracts portable * fix(sandbox): close execution lifecycle races Bound retained interactive output, preserve interruption state, and start workspace observation before process launch. Protect active runtime roots with cross-platform leases, capture transient protected-path creation events, and restore process attributes after PTY fallback. * fix(sandbox): restore strict macOS isolation Remove Seatbelt host-local network allowances after native validation showed localhost filters can reach host interfaces. Track process reap completion so retained sessions cannot signal a stale numeric PID.
26 lines
687 B
Go
26 lines
687 B
Go
//go:build linux
|
|
|
|
package execution
|
|
|
|
import (
|
|
"os/exec"
|
|
"syscall"
|
|
"testing"
|
|
)
|
|
|
|
func TestPTYFallbackRestoresOriginalProcessAttributes(t *testing.T) {
|
|
original := &syscall.SysProcAttr{Setpgid: true}
|
|
command := exec.Command("/bin/true")
|
|
command.SysProcAttr = original
|
|
saved := cloneSysProcAttr(command.SysProcAttr)
|
|
hardenPTYProcess(command)
|
|
resetCommandAfterPTYFallback(command, saved)
|
|
|
|
if command.SysProcAttr == nil || !command.SysProcAttr.Setpgid {
|
|
t.Fatalf("fallback attributes = %#v, want original Setpgid", command.SysProcAttr)
|
|
}
|
|
if command.SysProcAttr.Setsid || command.SysProcAttr.Setctty {
|
|
t.Fatalf("fallback retained PTY attributes: %#v", command.SysProcAttr)
|
|
}
|
|
}
|