diff --git a/internal/sandbox/manager_test.go b/internal/sandbox/manager_test.go index ee93d11e2..5dc754acf 100644 --- a/internal/sandbox/manager_test.go +++ b/internal/sandbox/manager_test.go @@ -72,6 +72,9 @@ func TestPermissionProfileFromPolicyIncludesDefaultTempWriteRoots(t *testing.T) if !writeRootsContain(profile.FileSystem.WriteRoots, tmpdir) { t.Fatalf("write roots = %#v, want temp root %q", profile.FileSystem.WriteRoots, tmpdir) } + // /tmp is a default temp write root on POSIX only (see + // defaultTempWriteRootCandidatesForGOOS); on Windows the bare path resolves + // against the current drive, so a stray C:\tmp must not turn this on. if runtime.GOOS != "windows" && pathExists("/tmp") && !writeRootsContain(profile.FileSystem.WriteRoots, "/tmp") { t.Fatalf("write roots = %#v, want /tmp", profile.FileSystem.WriteRoots) } diff --git a/internal/sandbox/scope_test.go b/internal/sandbox/scope_test.go index 6dc7a146b..3714c75f2 100644 --- a/internal/sandbox/scope_test.go +++ b/internal/sandbox/scope_test.go @@ -129,6 +129,9 @@ func TestNewScopeNormalizesAndValidatesExtraRoots(t *testing.T) { if !stringSliceContains(roots, normalizeWorkspaceRootBestEffort(extra)) { t.Fatalf("Roots()=%v want extra root %q", roots, normalizeWorkspaceRootBestEffort(extra)) } + // /tmp is a default temp write root on POSIX only (see + // defaultTempWriteRootCandidatesForGOOS); on Windows the bare path resolves + // against the current drive, so a stray C:\tmp must not turn this on. if runtime.GOOS != "windows" && pathExists("/tmp") && !stringSliceContains(roots, normalizeWorkspaceRootBestEffort("/tmp")) { t.Fatalf("Roots()=%v want default /tmp write root", roots) }