Darwin review: another person's home is closed only if fully closed
Astra round 1, finding 4. A home counts as closed only when this user can neither list it, pass through it (a missing name answers "not found" to someone who may search it), nor open one of the files most homes have; any answer but "permission denied" is open. Symlinked homes are listed with where they lead. A /Users that cannot be read is an error: the installer stops and says so, P4 fails, and every checks profile denies all of /Users, so checks cannot run rather than run with a home missed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files changed,
+280
−77
cmd/equipo-runner/install_mac.go+8 −4cmd/equipo-runner/install_mac_test.go+2 −1docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+2 −1internal/equipo/copy.go+3 −1internal/runner/mac/account.go+58 −18internal/runner/mac/account_test.go+51 −10internal/runner/mac/probe.go+13 −12internal/runner/mac/probe_test.go+10 −6internal/runner/mac/profile.go+7 −0internal/runner/thin/mac.go+7 −3internal/runner/thin/mac_test.go+7 −0scripts/runner-reference-allowlist.json+112 −21
Intent
diff --git a/cmd/equipo-runner/install_mac.go b/cmd/equipo-runner/install_mac.go| index 49eb78ed..ce3b5f1c 100644 |
| --- a/cmd/equipo-runner/install_mac.go |
| +++ b/cmd/equipo-runner/install_mac.go |
| @@ -27,7 +27,7 @@ import ( |
| type macInstallHost struct { |
| goos, goarch, home, users, self string |
| exec mac.Exec |
| - listHome func(string) bool |
| + exposed func(string) bool |
| // tools are what srt needs on macOS (mac.SRTTools: Node first, then |
| // ripgrep), fetched with fetch and checked against their pins; npmCI |
| // installs the pinned srt into prefix with the npm beside Node. |
| @@ -49,7 +49,7 @@ func realMacInstallHost() macInstallHost { |
| return macInstallHost{goos: goos(), goarch: goarch(), home: home, users: "/Users", self: self, exec: func(ctx context.Context, name string, args ...string) (string, error) { |
| out, err := exec.CommandContext(ctx, name, args...).Output() |
| return string(out), err |
| - }, listHome: mac.CanList, tools: mac.SRTTools, fetch: fetchTool, |
| + }, exposed: mac.Exposed, tools: mac.SRTTools, fetch: fetchTool, |
| npmCI: func(ctx context.Context, npm, prefix string) error { |
| cmd := exec.CommandContext(ctx, npm, "ci", "--prefix", prefix, "--ignore-scripts", "--omit=dev", "--no-audit", "--no-fund") |
| cmd.Env = append(os.Environ(), "PATH="+filepath.Dir(npm)+":/usr/bin:/bin") |
| @@ -95,8 +95,12 @@ func installMac(ctx context.Context, args []string, h macInstallHost, out, errou |
| if h.home == "" || filepath.Base(h.home) != account.Name { |
| return fail("runner.install.destination") |
| } |
| - if readable := mac.ReadableHomes(mac.OtherHomes(h.users, h.home), h.listHome); len(readable) > 0 { |
| - return fail("runner.mac.home", strings.Join(readable, " "), strings.Join(readable, " ")) |
| + others, err := mac.OtherHomes(h.users, h.home) |
| + if err != nil { |
| + return fail("runner.mac.homes_unknown") |
| + } |
| + if exposed := mac.ExposedHomes(others, h.exposed); len(exposed) > 0 { |
| + return fail("runner.mac.home", strings.Join(exposed, " "), strings.Join(exposed, " ")) |
| } |
| lib := filepath.Join(h.home, ".local", "lib", "equipo-runner") |
| share := filepath.Join(h.home, ".local", "share", "equipo-runner") |
diff --git a/cmd/equipo-runner/install_mac_test.go b/cmd/equipo-runner/install_mac_test.go| index d653e726..a4e70a48 100644 |
| --- a/cmd/equipo-runner/install_mac_test.go |
| +++ b/cmd/equipo-runner/install_mac_test.go |
| @@ -62,7 +62,7 @@ func newMacRig(t *testing.T) *macRig { |
| } |
| return "", errors.New("unexpected " + name) |
| }, |
| - listHome: func(p string) bool { return x.readable[filepath.Base(p)] }, |
| + exposed: func(p string) bool { return x.readable[filepath.Base(p)] }, |
| fetch: func(_ context.Context, url string, _ int64) ([]byte, error) { |
| x.fetched = append(x.fetched, url) |
| if b, ok := x.archives[url]; ok { |
| @@ -138,6 +138,7 @@ func TestInstallMacRefusals(t *testing.T) { |
| "own account": {func(x *macRig) { x.ids["-un"] = "paul\n" }, "runner.mac.user"}, |
| "shared user": {func(x *macRig) { x.ids["-un"] = "equipo\n" }, "runner.mac.user"}, |
| "readable home": {func(x *macRig) { x.readable["paul"] = true }, "runner.mac.home"}, |
| + "homes unknown": {func(x *macRig) { x.h.users = filepath.Join(x.home, "missing") }, "runner.mac.homes_unknown"}, |
| "another's home": {func(x *macRig) { x.h.home = filepath.Join(filepath.Dir(x.home), "paul") }, "runner.install.destination"}, |
| } { |
| x := newMacRig(t) |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index 146638eb..3df11926 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -5808,7 +5808,8 @@ records remain unchanged. |
| | `runner.mac.root` | Run the installer as the Mac user made for Equipo, not as root. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.mac.admin` | This Mac user is an administrator. Run the installer as a Standard user named equipo-yourname. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.mac.user` | Run the installer as a Standard user named equipo-yourname, such as equipo-paul. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| -| `runner.mac.home` | This user can open another person's home folder (%s). An administrator can close it with: sudo chmod 700 %s | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `runner.mac.home` | This user can get into another person's home folder (%s). An administrator can close it with: sudo chmod 700 %s | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `runner.mac.homes_unknown` | Equipo could not check the other home folders on this Mac, so it stopped. Ask an administrator to check that /Users can be listed, then paste the command again. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.mac.no_srt` | The checks sandbox could not be downloaded and installed. Checks will run outside the sandbox and say so. Run the install command again to retry. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.mac.tap` | Open this link and add this Mac to your team: | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `runner.mac.installed` | This Mac is ready. It checks itself, then waits for work whenever this user is logged in. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index ad45e1fb..17909829 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -264,7 +264,9 @@ var pageCopy = map[string]string{ |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): runner.mac.user |
| "runner.mac.user": "Run the installer as a Standard user named equipo-yourname, such as equipo-paul.", |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): runner.mac.home |
| - "runner.mac.home": "This user can open another person's home folder (%s). An administrator can close it with: sudo chmod 700 %s", |
| + "runner.mac.home": "This user can get into another person's home folder (%s). An administrator can close it with: sudo chmod 700 %s", |
| + // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): runner.mac.homes_unknown |
| + "runner.mac.homes_unknown": "Equipo could not check the other home folders on this Mac, so it stopped. Ask an administrator to check that /Users can be listed, then paste the command again.", |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): runner.mac.no_srt |
| "runner.mac.no_srt": "The checks sandbox could not be downloaded and installed. Checks will run outside the sandbox and say so. Run the install command again to retry.", |
| // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): runner.mac.tap |
diff --git a/internal/runner/mac/account.go b/internal/runner/mac/account.go| index ade6d21c..566be781 100644 |
| --- a/internal/runner/mac/account.go |
| +++ b/internal/runner/mac/account.go |
| @@ -4,6 +4,7 @@ import ( |
| "context" |
| "errors" |
| "io" |
| + "io/fs" |
| "os" |
| "path/filepath" |
| "regexp" |
| @@ -56,43 +57,82 @@ func RefuseAccount(a Account) string { |
| } |
| // OtherHomes are the homes under users that are not home: every other |
| -// person's (and /Users/Shared), which every profile denies. |
| -func OtherHomes(users, home string) []string { |
| +// person's (and /Users/Shared), which every profile denies. A home that |
| +// is a symbolic link is listed as the link and as where it leads. An |
| +// error reading users is returned: homes that cannot be listed are not |
| +// known to be isolated. |
| +func OtherHomes(users, home string) ([]string, error) { |
| entries, err := os.ReadDir(users) |
| if err != nil { |
| - return nil |
| + return nil, err |
| } |
| var out []string |
| for _, e := range entries { |
| p := filepath.Join(users, e.Name()) |
| - if strings.HasPrefix(e.Name(), ".") || p == home || !e.IsDir() { |
| + if strings.HasPrefix(e.Name(), ".") || p == home { |
| continue |
| } |
| - out = append(out, p) |
| + switch { |
| + case e.IsDir(): |
| + out = append(out, p) |
| + case e.Type()&fs.ModeSymlink != 0: |
| + out = append(out, p) |
| + if target, err := filepath.EvalSymlinks(p); err == nil && target != home { |
| + out = append(out, target) |
| + } else if err == nil { |
| + // A link to this user's own home is not another's. |
| + out = out[:len(out)-1] |
| + } |
| + } |
| } |
| sort.Strings(out) |
| - return out |
| + return slices.Compact(out), nil |
| } |
| -// ReadableHomes are the people's homes this user can list: the installer |
| -// refuses to enrol while there is one (spec §3.5). |
| -func ReadableHomes(homes []string, list func(string) bool) []string { |
| +// ExposedHomes are the people's homes this user can get into: the |
| +// installer refuses to enrol while there is one (spec §3.5), and P4 |
| +// fails. |
| +func ExposedHomes(homes []string, exposed func(string) bool) []string { |
| var out []string |
| for _, h := range homes { |
| - if filepath.Base(h) != "Shared" && list(h) { |
| + if filepath.Base(h) != "Shared" && exposed(h) { |
| out = append(out, h) |
| } |
| } |
| return out |
| } |
| -// CanList reports whether this user can list dir. |
| -func CanList(dir string) bool { |
| - f, err := os.Open(dir) |
| - if err != nil { |
| - return false |
| +// homeSentinels are files most homes have; reading any is reading the |
| +// home. They stand in for the sentinels P4 cannot place in another |
| +// person's home. |
| +var homeSentinels = []string{".zshrc", ".zprofile", ".bash_profile", ".profile", ".gitconfig", "Library/Preferences/.GlobalPreferences.plist"} |
| + |
| +// Exposed reports whether this user can list home, pass through it, or |
| +// read a file in it. Only a refusal (permission denied) of each counts |
| +// as closed; any other answer, an error included, is exposed. |
| +func Exposed(home string) bool { |
| + closed := func(err error) bool { return errors.Is(err, fs.ErrPermission) } |
| + if f, err := os.Open(home); err == nil { |
| + _, rerr := f.Readdirnames(1) |
| + f.Close() |
| + if rerr == nil || errors.Is(rerr, io.EOF) || !closed(rerr) { |
| + return true |
| + } |
| + } else if !closed(err) { |
| + return true |
| + } |
| + // Passing through: a name that does not exist answers "not found" |
| + // to someone who may search the folder, "permission denied" otherwise. |
| + if _, err := os.Lstat(filepath.Join(home, ".equipo-traversal-probe")); !closed(err) { |
| + return true |
| + } |
| + for _, s := range homeSentinels { |
| + if f, err := os.Open(filepath.Join(home, s)); err == nil { |
| + f.Close() |
| + return true |
| + } else if !closed(err) && !errors.Is(err, fs.ErrNotExist) { |
| + return true |
| + } |
| } |
| - defer f.Close() |
| - _, err = f.Readdirnames(1) |
| - return err == nil || errors.Is(err, io.EOF) |
| + return false |
| } |
diff --git a/internal/runner/mac/account_test.go b/internal/runner/mac/account_test.go| index b66599dc..0e241123 100644 |
| --- a/internal/runner/mac/account_test.go |
| +++ b/internal/runner/mac/account_test.go |
| @@ -48,25 +48,66 @@ func TestReadAccount(t *testing.T) { |
| } |
| } |
| +// Another person's home counts as closed only when it can be neither |
| +// listed, passed through, nor read: a home this user can traverse (but |
| +// not list) is open, as is one with a readable file. Symlinked homes are |
| +// listed with where they lead; a /Users that cannot be read is an error. |
| func TestHomes(t *testing.T) { |
| + if os.Geteuid() == 0 { |
| + t.Skip("root reads every home") |
| + } |
| users := t.TempDir() |
| - for _, d := range []string{"equipo-paul", "paul", "Shared", ".localized", "tito"} { |
| + own := filepath.Join(users, "equipo-paul") |
| + elsewhere := t.TempDir() |
| + for _, d := range []string{"equipo-paul", "paul", "Shared", "tito", "ana"} { |
| if err := os.MkdirAll(filepath.Join(users, d), 0700); err != nil { |
| t.Fatal(err) |
| } |
| } |
| - others := OtherHomes(users, filepath.Join(users, "equipo-paul")) |
| - want := []string{filepath.Join(users, "Shared"), filepath.Join(users, "paul"), filepath.Join(users, "tito")} |
| - if !slices.Equal(others, want) { |
| - t.Fatalf("%v", others) |
| + if err := os.WriteFile(filepath.Join(users, ".localized"), nil, 0600); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.Symlink(elsewhere, filepath.Join(users, "linked")); err != nil { |
| + t.Fatal(err) |
| } |
| - if err := os.Chmod(filepath.Join(users, "tito"), 0); err != nil { |
| + if err := os.Symlink(own, filepath.Join(users, "me")); err != nil { |
| t.Fatal(err) |
| } |
| - defer os.Chmod(filepath.Join(users, "tito"), 0700) |
| - readable := ReadableHomes(others, CanList) |
| - if os.Geteuid() != 0 && !slices.Equal(readable, []string{filepath.Join(users, "paul")}) { |
| - t.Fatalf("readable %v", readable) |
| + others, err := OtherHomes(users, own) |
| + want := []string{elsewhere, filepath.Join(users, "Shared"), filepath.Join(users, "ana"), filepath.Join(users, "linked"), filepath.Join(users, "paul"), filepath.Join(users, "tito")} |
| + slices.Sort(want) |
| + if err != nil || !slices.Equal(others, want) { |
| + t.Fatalf("%v %v", others, err) |
| + } |
| + // paul: closed. tito: traversable only (0711). ana: closed but... a |
| + // readable file inside needs traversal, so give ana 0711 and a file. |
| + for d, mode := range map[string]os.FileMode{"paul": 0, "tito": 0o111, "ana": 0o111} { |
| + if d == "ana" { |
| + if err := os.WriteFile(filepath.Join(users, d, ".zshrc"), []byte("x"), 0644); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if err := os.Chmod(filepath.Join(users, d), mode); err != nil { |
| + t.Fatal(err) |
| + } |
| + defer os.Chmod(filepath.Join(users, d), 0700) |
| + } |
| + if err := os.Chmod(elsewhere, 0); err != nil { |
| + t.Fatal(err) |
| + } |
| + defer os.Chmod(elsewhere, 0700) |
| + got := ExposedHomes(others, Exposed) |
| + if !slices.Equal(got, []string{filepath.Join(users, "ana"), filepath.Join(users, "tito")}) { |
| + t.Fatalf("exposed %v", got) |
| + } |
| + if Exposed(filepath.Join(users, "paul")) || Exposed(elsewhere) { |
| + t.Fatal("a closed home taken as open") |
| + } |
| + if _, err := OtherHomes(filepath.Join(users, "missing"), own); err == nil { |
| + t.Fatal("an unreadable /Users taken as no homes") |
| + } |
| + if !slices.Contains(DenyList(Paths{Home: own, HomesUnknown: true}), "/Users") { |
| + t.Fatal("unknown homes not denied wholesale") |
| } |
| } |
diff --git a/internal/runner/mac/probe.go b/internal/runner/mac/probe.go| index a122a1f6..0b71c3c5 100644 |
| --- a/internal/runner/mac/probe.go |
| +++ b/internal/runner/mac/probe.go |
| @@ -44,12 +44,12 @@ type ProbeHost struct { |
| // Gate is the gate the fixture runs under: sandboxed, srt with the |
| // checks profile; or bare. |
| Gate func(sandboxed bool) *Gate |
| - // Resolve and ListHome are the same attempts made outside the |
| + // Resolve and Exposed are the same attempts made outside the |
| // sandbox, so a denial can be told from a failure; Listen opens a |
| // loopback port whose accepts are ground truth for "tcp". |
| - Resolve func(ctx context.Context, name string) bool |
| - ListHome func(path string) bool |
| - Listen func() (net.Listener, error) |
| + Resolve func(ctx context.Context, name string) bool |
| + Exposed func(path string) bool |
| + Listen func() (net.Listener, error) |
| // Wait bounds P6's wait for its test to start (8 minutes). |
| Wait time.Duration |
| } |
| @@ -261,7 +261,7 @@ func probeP2(ctx context.Context, h ProbeHost, caps wire.Capabilities) (wire.Pro |
| defer os.Remove(sentinel) |
| targets = append(targets, "state="+sentinel) |
| if home := otherHome(h.Paths.OtherHomes); home != "" { |
| - facts.Home, facts.HomeUnix = true, !h.ListHome(home) |
| + facts.Home, facts.HomeUnix = true, !h.Exposed(home) |
| targets = append(targets, "home="+home) |
| } |
| var mu sync.Mutex |
| @@ -348,19 +348,20 @@ func otherHome(homes []string) string { |
| func probeP4(ctx context.Context, h ProbeHost) wire.Probe { |
| var readable []string |
| - for _, home := range h.Paths.OtherHomes { |
| - if path.Base(home) != "Shared" && h.ListHome(home) { |
| - readable = append(readable, path.Base(home)) |
| - } |
| + for _, home := range ExposedHomes(h.Paths.OtherHomes, h.Exposed) { |
| + readable = append(readable, path.Base(home)) |
| } |
| _, err := h.Exec(ctx, "/bin/launchctl", "print", "gui/"+strconv.Itoa(h.UID)+"/"+AgentLabel) |
| loaded := err == nil |
| pm, _ := h.Exec(ctx, "/usr/bin/pmset", "-g", "custom") |
| sleep, known := ACSleep(pm) |
| var parts []string |
| - if len(readable) > 0 { |
| + switch { |
| + case h.Paths.HomesUnknown: |
| + parts = append(parts, "other homes could not be checked") |
| + case len(readable) > 0: |
| parts = append(parts, "readable homes: "+strings.Join(readable, " ")) |
| - } else { |
| + default: |
| parts = append(parts, "no other home readable") |
| } |
| parts = append(parts, map[bool]string{true: "agent loaded", false: "agent not loaded"}[loaded]) |
| @@ -373,7 +374,7 @@ func probeP4(ctx context.Context, h ProbeHost) wire.Probe { |
| parts = append(parts, fmt.Sprintf("sleeps after %d minutes on power", sleep)) |
| } |
| verdict := wire.ProbePassed |
| - if len(readable) > 0 || !loaded || !known || sleep != 0 { |
| + if h.Paths.HomesUnknown || len(readable) > 0 || !loaded || !known || sleep != 0 { |
| verdict = wire.ProbeFailed |
| } |
| return wire.Probe{ID: "P4", Verdict: verdict, Detail: clean(strings.Join(parts, "; "))} |
diff --git a/internal/runner/mac/probe_test.go b/internal/runner/mac/probe_test.go| index b8ccfafd..2c7e8294 100644 |
| --- a/internal/runner/mac/probe_test.go |
| +++ b/internal/runner/mac/probe_test.go |
| @@ -115,10 +115,10 @@ func newProbeFixture(t *testing.T, lines map[string]string, env ...string) *prob |
| } |
| return g |
| }, |
| - Resolve: func(context.Context, string) bool { return true }, |
| - ListHome: func(string) bool { return false }, |
| - Listen: func() (net.Listener, error) { return net.Listen("tcp", "127.0.0.1:0") }, |
| - Wait: 30 * time.Second, |
| + Resolve: func(context.Context, string) bool { return true }, |
| + Exposed: func(string) bool { return false }, |
| + Listen: func() (net.Listener, error) { return net.Listen("tcp", "127.0.0.1:0") }, |
| + Wait: 30 * time.Second, |
| } |
| return f |
| } |
| @@ -251,11 +251,15 @@ func TestACSleepAndNode(t *testing.T) { |
| // sleeps are each a failed P4, said in words without a path. |
| func TestP4(t *testing.T) { |
| f := newProbeFixture(t, nil) |
| - f.h.ListHome = func(p string) bool { return p == "/Users/paul" } |
| + f.h.Exposed = func(p string) bool { return p == "/Users/paul" } |
| p := probeP4(context.Background(), f.h) |
| if p.Verdict != wire.ProbeFailed || p.Detail != "readable homes: paul; agent loaded; sleep off on power" { |
| t.Fatalf("%+v", p) |
| } |
| + f.h.Paths.HomesUnknown = true |
| + if p := probeP4(context.Background(), f.h); p.Verdict != wire.ProbeFailed || !strings.Contains(p.Detail, "other homes could not be checked") { |
| + t.Fatalf("unknown homes: %+v", p) |
| + } |
| } |
| // The fixture ships whole: what P2 and P6 run is in the binary. |
| @@ -279,7 +283,7 @@ func TestFixtureShips(t *testing.T) { |
| if strings.Contains(wait, "Thread.sleep") || !strings.Contains(wait, "write(to:") || !strings.Contains(string(tests), "keychain_file") { |
| t.Fatal("P6's test must work while it is killed, and P2's must try the host keychain file from the simulator") |
| } |
| - if info, _ := os.Stat(filepath.Join(root, "project/hostile.sh")); info.Mode().Perm() != 0700 { |
| + if info, _ := os.Stat(filepath.Join(root, "project/hostile.sh")); info.Mode().Perm() != 0700 { |
| t.Fatal("hostile.sh not executable") |
| } |
| for _, f := range []string{"package/Plugins/HostilePlugin/HostilePlugin.swift", "package/Tests/HostileTests/HostileTests.swift", "project/hostile.sh"} { |
diff --git a/internal/runner/mac/profile.go b/internal/runner/mac/profile.go| index 5ff0ebd0..2377e71e 100644 |
| --- a/internal/runner/mac/profile.go |
| +++ b/internal/runner/mac/profile.go |
| @@ -26,6 +26,10 @@ type Paths struct { |
| InstallDir string |
| // OtherHomes are every home under /Users but the runner user's. |
| OtherHomes []string |
| + // HomesUnknown: /Users could not be listed. Every profile then denies |
| + // all of /Users, the runner's own home too, so no checks profile can |
| + // be made (checks cannot run) rather than one that misses a home. |
| + HomesUnknown bool |
| } |
| // Mach services a checks profile allows by default: what xcodebuild test |
| @@ -52,6 +56,9 @@ func DenyList(p Paths) []string { |
| out = append(out, filepath.Join(p.Home, rel)) |
| } |
| out = append(out, p.OtherHomes...) |
| + if p.HomesUnknown { |
| + out = append(out, "/Users") |
| + } |
| out = append(out, "/Volumes") |
| return compact(out) |
| } |
diff --git a/internal/runner/thin/mac.go b/internal/runner/thin/mac.go| index c793b0f7..bf55a458 100644 |
| --- a/internal/runner/thin/mac.go |
| +++ b/internal/runner/thin/mac.go |
| @@ -227,6 +227,9 @@ func hashFile(h io.Writer, path string) error { |
| return err |
| } |
| +// macUsers is where a Mac keeps its people's homes. |
| +var macUsers = "/Users" |
| + |
| // macHost is the Mac worker's setup: its tools, paths and gates. |
| type macHost struct { |
| // scratch is the runner's scratch root: the probes' fixture copies |
| @@ -302,7 +305,8 @@ func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHos |
| accounts = DefaultAccountsRoot() |
| } |
| h := &macHost{scratch: c.ScratchRoot} |
| - h.paths = mac.Paths{Home: home, StateDir: c.StateDir, AccountsRoot: accounts, SessionRoot: SessionRoot(c), InstallDir: filepath.Dir(c.Executable), OtherHomes: mac.OtherHomes("/Users", home)} |
| + others, err := mac.OtherHomes(macUsers, home) |
| + h.paths = mac.Paths{Home: home, StateDir: c.StateDir, AccountsRoot: accounts, SessionRoot: SessionRoot(c), InstallDir: filepath.Dir(c.Executable), OtherHomes: others, HomesUnknown: err != nil} |
| h.tools = macTools(h.paths.InstallDir, home, getenv) |
| h.env = []string{"HOME=" + home, "PATH=" + gatePath(h.tools), "CI=1", "LANG=en_US.UTF-8"} |
| ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) |
| @@ -363,8 +367,8 @@ func (h *macHost) probeHost(version string, gate func(string, string) *mac.Gate) |
| addrs, err := net.DefaultResolver.LookupHost(ctx, name) |
| return err == nil && len(addrs) > 0 |
| }, |
| - ListHome: mac.CanList, |
| - Listen: func() (net.Listener, error) { return net.Listen("tcp", "127.0.0.1:0") }, |
| + Exposed: mac.Exposed, |
| + Listen: func() (net.Listener, error) { return net.Listen("tcp", "127.0.0.1:0") }, |
| } |
| } |
diff --git a/internal/runner/thin/mac_test.go b/internal/runner/thin/mac_test.go| index 3faabfc8..573568a3 100644 |
| --- a/internal/runner/thin/mac_test.go |
| +++ b/internal/runner/thin/mac_test.go |
| @@ -265,6 +265,13 @@ func TestMacHostPaths(t *testing.T) { |
| t.Fatal(err) |
| } |
| } |
| + users := filepath.Join(root, "Users") |
| + if err := os.MkdirAll(filepath.Join(users, "paul"), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + was := macUsers |
| + macUsers = users |
| + defer func() { macUsers = was }() |
| h, err := newMacHost(c, Options{Version: "v1", AccountsRoot: filepath.Join(root, "accounts")}, func(k string) string { return tools[k] }) |
| if err != nil { |
| t.Fatal(err) |
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json| index b93f1a4c..a0aaafdc 100644 |
| --- a/scripts/runner-reference-allowlist.json |
| +++ b/scripts/runner-reference-allowlist.json |
| @@ -11591,13 +11591,6 @@ |
| "count": 1, |
| "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| }, |
| - { |
| - "path": "internal/runner/thin/mac.go", |
| - "line_sha256": "2690ddf9552ac9249e18620bc097554968a93291323f4c6f4bcd7dbfc54ca938", |
| - "match": "equipo-runner", |
| - "count": 1, |
| - "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| - }, |
| { |
| "path": "internal/runner/thin/mac.go", |
| "line_sha256": "340a15993190b36885ff9909bec83dcb249769b5491ac59f23daa12b0edf831a", |
| @@ -11647,20 +11640,6 @@ |
| "count": 1, |
| "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| }, |
| - { |
| - "path": "internal/runner/thin/mac.go", |
| - "line_sha256": "ac5494b81da437396b2131afc1394bf549e9345f206134fc6d5fbb65869ea93a", |
| - "match": "equipo-runner", |
| - "count": 1, |
| - "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| - }, |
| - { |
| - "path": "internal/runner/thin/mac.go", |
| - "line_sha256": "c3cbd862a1a2dbb1e1db96836645cc171a46e42f88932eb3529f50f4d71f5799", |
| - "match": "equipo-runner", |
| - "count": 1, |
| - "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| - }, |
| { |
| "path": "internal/runner/thin/mac_test.go", |
| "line_sha256": "16cbbe773c94fbcc2b98ab423474f2941d0a71cf418d37e690a683be0d2b84c0", |
| @@ -12178,5 +12157,117 @@ |
| "match": "node", |
| "count": 1, |
| "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "Makefile", |
| + "line_sha256": "f8d3106015bd11c2cf165c3c0e7b76b6b1c661b32b233d23a237454bebe38265", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/mac/probe.go", |
| + "line_sha256": "edaa0af02fb09255201c5a18d431d749417785b20bf84d83517d31a2b05986f9", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac.go", |
| + "line_sha256": "16e6b2b969b2570deb18b2e424c8a132c36c8e0b66547e7395c032a4a4f395b9", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac.go", |
| + "line_sha256": "6aea316dffa73a46804699080f941568c7024389481b93f2fbafa6c441c5f4c2", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac.go", |
| + "line_sha256": "6e1f2ad42eddcc392ac08a4d4499da49bae235953761346c80b9f829a071a41d", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac.go", |
| + "line_sha256": "c8b123cba7327ac08d7169929e5d843fbb08990a308102d00bbc78dd29da4c84", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac.go", |
| + "line_sha256": "cf8018bd71b2fac45dcea98e9f738fc5b20ae35a34133b27198635cd160a72c4", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac.go", |
| + "line_sha256": "dd635b2ac1346ce9a328771df08cf2c8b46c7dc4e2f5feed5b72bcbac39953dc", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "14f701ffe4ec3b557605d18f8f51f9d2a219f13b540269c6f6692640074c458c", |
| + "match": "node", |
| + "count": 2, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "15ae00a7ae97948321cee091518894d26f5bae77907f4690dea8714d377d8056", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "2f6274ddfc53bfac6a5e9e148cb6e8203c8d6f6ef0f2c042325c17c9bf1a90a9", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "64aaa2a2e81f4075b3486f9fe7db72f20c75f16cc3f5a6977ebe03bf75c87161", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "762b3810b5621dddaf710df728e7d6fb91a200b703dfcbd42d7731eed2141d11", |
| + "match": "Node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "762b3810b5621dddaf710df728e7d6fb91a200b703dfcbd42d7731eed2141d11", |
| + "match": "node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "a994d7751033c8667425479de00effbab493a07658421582c102a79f2cd067aa", |
| + "match": "node", |
| + "count": 4, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| + }, |
| + { |
| + "path": "internal/runner/thin/mac_test.go", |
| + "line_sha256": "bb24e35d06c4290bea65c10924fa031ed2d7cb83297191d613fda71c6cf2efd4", |
| + "match": "node", |
| + "count": 1, |
| + "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs." |
| } |
| ] |