host: carlos-app@ is operator-trusted; syscall/IPC floor; fd chmod
Paul 2026-11-16: unit backing (carlos-app@) is for operator-trusted tenants only. The unit header, registry.Backing/SetBacking and the README now say so. The unit gains the controls that cannot break a tenant: SystemCallArchitectures=native, SystemCallFilter=@system-service minus keyring/io_uring/userfaultfd (ENOSYS), ProtectControlGroups, PrivateIPC with a private /dev/mqueue. No PrivatePIDs (#528) and no loopback/VPC deny (the edge dials unit tenants on loopback). The doc_engine capability resets the syscall filter so Chromium keeps today's behaviour. demobuild: the build-cache chmod goes through OpenDirBeneath fds instead of a path after a symlink check. From the 2026-11-16 security review (discussion 1096). Reviewed by Astra; census approved on #280. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from sec-unit-app-demobuild into main.
12 files changed,
+282
−12
README.md+4 −0docs/superpowers/notes/census-proposal-sec-unit-app-demobuild.md+26 −0internal/caps/render.go+12 −0internal/caps/render_test.go+45 −0internal/caps/testdata/gotenberg.service.conf+2 −0internal/demobuild/unit.go+39 −12internal/demobuild/unit_cache_chmod_test.go+75 −0internal/host/units/carlos-app@.service+28 −0internal/host/units_isolation_test.go+29 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-sec-unit-app-demobuild.tsv+14 −0internal/registry/registry.go+7 −0
CI failed — run details
diff --git a/README.md b/README.md| index 6c448fc4d..df7f03104 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -1381,6 +1381,10 @@ design's §5 migration steps). Stamping it arms the **hourly** |
| `carlos-adopt.timer`, and `carlos adopt` for a `daemon` route enables and |
| STARTS the service — so the data copy comes before the stamp, not after it. |
| +**Unit backing is for operator-trusted tenants only.** A `carlos-app@<host>` |
| +tenant can reach loopback, the VPC and abstract unix sockets, so never set |
| +`--backing unit` for a tenant you would not give a shell on the box. |
| + |
| A declared-but-ungranted capability does not fail the app or fail adoption: |
| the drop-in simply is not written, and the hourly adopt pass logs one line |
| naming the route, the capability, and the exact grant command. The mirror |
diff --git a/docs/superpowers/notes/census-proposal-sec-unit-app-demobuild.md b/docs/superpowers/notes/census-proposal-sec-unit-app-demobuild.md| new file mode 100644 |
| index 000000000..21559822a |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-sec-unit-app-demobuild.md |
| @@ -0,0 +1,26 @@ |
| +# Census approval: sec-unit-app-demobuild |
| + |
| +Ruling `census-ruling-sec-unit-app-demobuild`. The independent reviewer approves or rejects every change below, 2 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/caps/render.go` `RenderService` | body | unchanged (2) | sec-review 2026-11-16 D1: a granted doc_engine block also emits the constant lines SystemCallFilter= and SystemCallErrorNumber=, clearing the template's new tenant syscall filter for that tenant only, so a conversion engine keeps the syscall surface it had before this branch. Constant strings, no input reaches them; no other capability changes; no read added. | |
| +| `internal/host/units/carlos-app@.service` `external` | body | unchanged (1) | sec-review 2026-11-16 D1: the header states unit backing is for operator-trusted tenants only (Paul, 2026-11-16) and set only by box root; the [Service] section gains PrivateIPC=yes, TemporaryFileSystem=/dev/mqueue:ro, ProtectControlGroups=yes, SystemCallArchitectures=native, SystemCallFilter=@system-service, SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd and SystemCallErrorNumber=ENOSYS, copied from carlos-instance@ (a comment notes that a granted doc_engine drop-in clears the filter). ExecStart, EnvironmentFile, StateDirectory, the /opt binds and IPAddressDeny are unchanged; it only narrows the tenant sandbox. No root read added. | |
| + |
| +Envelopes re-pinned: `internal/caps`, `internal/demobuild`, `internal/host/units`, `internal/registry`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/caps/render.go` `RenderService`: authority, task E4,J1,J4. Basis: root-input |
| +- `internal/host/units/carlos-app@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input |
| + |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/demobuild/unit.go:chmodCacheDirs`: reads +file:WalkDir; written legacy, accepted-legacy, frozen |
| +- quiet `internal/demobuild/unit.go:Worker.prepareUnit`: reads nothing now; retired while it reads nothing (or its row keeps no sites) |
| + |
| +Seal: `4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b` → `fea6bec1f00dace47aa6006bf8606602efda4cecfa4fe3c3890136c0fb27720c`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-sec-unit-app-demobuild.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/caps/render.go b/internal/caps/render.go| index 1e2c58b2a..a780167c3 100644 |
| --- a/internal/caps/render.go |
| +++ b/internal/caps/render.go |
| @@ -213,6 +213,18 @@ func RenderService(app string, s *Set, g Grants) ([]byte, error) { |
| "TasksMax="+docEngineTasksMax, |
| ) |
| + // The template's tenant syscall filter (sec review 2026-11-16) may |
| + // add only what cannot break a tenant, and no conversion engine has |
| + // been run under it: Chromium and V8 reach for calls outside |
| + // @system-service (pkey_*, ptrace, seccomp). An empty assignment |
| + // clears the list, allow and deny halves alike, so an engine keeps |
| + // exactly the syscall surface it had before the filter; the error |
| + // number goes back to its default with it. PrivateIPC=, |
| + // ProtectControlGroups= and SystemCallArchitectures= stay: headless |
| + // Chromium and LibreOffice use neither SysV/POSIX IPC across units |
| + // nor cgroupfs writes, and run native. |
| + lines = append(lines, "SystemCallFilter=", "SystemCallErrorNumber=") |
| + |
| // The fence that pays for all of the above. Empty assignment first |
| // resets the list — same documented systemd pattern the ExecStart |
| // reset uses — so these bytes are self-contained and do not depend on |
diff --git a/internal/caps/render_test.go b/internal/caps/render_test.go| index 2e583c8ec..3cd8da47f 100644 |
| --- a/internal/caps/render_test.go |
| +++ b/internal/caps/render_test.go |
| @@ -560,3 +560,48 @@ func TestCommandIdenticalToTemplateDefaultStillEmitsReset(t *testing.T) { |
| t.Fatalf("got %q, want %q", got, want) |
| } |
| } |
| + |
| +// TestOnlyDocEngineResetsTheSyscallFilter: carlos-app@ carries the tenant |
| +// syscall filter (sec review 2026-11-16), which may only add what cannot |
| +// break a tenant. A conversion engine (Chromium, LibreOffice) has not been |
| +// run under it, so a granted doc_engine clears it and keeps the behaviour |
| +// it had before the filter; no other capability touches it. |
| +func TestOnlyDocEngineResetsTheSyscallFilter(t *testing.T) { |
| + syscallLines := func(b []byte) []string { |
| + var out []string |
| + for _, line := range strings.Split(string(b), "\n") { |
| + if strings.HasPrefix(line, "SystemCall") { |
| + out = append(out, line) |
| + } |
| + } |
| + return out |
| + } |
| + engine, err := RenderService("gotenberg", gotenbergSet(t), gotenbergGrants()) |
| + if err != nil { |
| + t.Fatalf("RenderService(gotenberg): %v", err) |
| + } |
| + if got, want := strings.Join(syscallLines(engine), "|"), "SystemCallFilter=|SystemCallErrorNumber="; got != want { |
| + t.Errorf("doc_engine drop-in syscall lines = %q, want %q:\n%s", got, want, engine) |
| + } |
| + |
| + others := map[string]func() ([]byte, error){ |
| + "keymail": func() ([]byte, error) { return RenderService("keymail", keymailSet(t), keymailGrants()) }, |
| + "console": func() ([]byte, error) { return RenderService("console", consoleSet(t), consoleGrants()) }, |
| + "engine ungranted": func() ([]byte, error) { return RenderService("gotenberg", gotenbergSet(t), Grants{}) }, |
| + "children only": func() ([]byte, error) { return RenderService("app", &Set{V: 1, Children: true}, Grants{}) }, |
| + "runtime_dir only": func() ([]byte, error) { return RenderService("app", &Set{V: 1, RuntimeDir: "app"}, Grants{}) }, |
| + "engine grant alone": func() ([]byte, error) { |
| + return RenderService("app", &Set{V: 1, Command: "serve"}, Grants{DocEngine: true}) |
| + }, |
| + "socket": func() ([]byte, error) { return RenderSocket(keymailSet(t), keymailGrants()) }, |
| + } |
| + for name, render := range others { |
| + b, err := render() |
| + if err != nil { |
| + t.Fatalf("%s: %v", name, err) |
| + } |
| + if l := syscallLines(b); len(l) != 0 { |
| + t.Errorf("%s renders %q; only a granted doc_engine resets the syscall filter", name, l) |
| + } |
| + } |
| +} |
diff --git a/internal/caps/testdata/gotenberg.service.conf b/internal/caps/testdata/gotenberg.service.conf| index 9f3d48bc6..fbbb744ab 100644 |
| --- a/internal/caps/testdata/gotenberg.service.conf |
| +++ b/internal/caps/testdata/gotenberg.service.conf |
| @@ -7,5 +7,7 @@ MemoryDenyWriteExecute=no |
| MemoryMax=4G |
| MemoryHigh=3680M |
| TasksMax=2048 |
| +SystemCallFilter= |
| +SystemCallErrorNumber= |
| IPAddressDeny= |
| IPAddressDeny=0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 169.254.0.0/16 169.254.169.254/32 172.16.0.0/12 192.0.0.0/24 192.168.0.0/16 198.18.0.0/15 224.0.0.0/4 240.0.0.0/4 64:ff9b::/96 fc00::/7 fd00:ec2::254/128 fe80::/10 fec0::/10 ff00::/8 |
diff --git a/internal/demobuild/unit.go b/internal/demobuild/unit.go| index 55705913a..ebecd28d9 100644 |
| --- a/internal/demobuild/unit.go |
| +++ b/internal/demobuild/unit.go |
| @@ -225,18 +225,7 @@ func (w *Worker) prepareUnit(ctx context.Context, dir string, src Source) (clean |
| if err != nil { |
| return cleanup, err |
| } |
| - } else if err = filepath.WalkDir(l.cache, func(p string, de fs.DirEntry, e error) error { |
| - if e != nil { |
| - return e |
| - } |
| - if de.Type()&os.ModeSymlink != 0 { |
| - return ErrBuild |
| - } |
| - if de.IsDir() { |
| - return os.Chmod(p, 0777) |
| - } |
| - return nil |
| - }); err != nil { |
| + } else if err = chmodCacheDirs(l.cache, 0777); err != nil { |
| return cleanup, err |
| } |
| step = "open-unit-root" |
| @@ -707,3 +696,41 @@ func buildFailure(step string, err error) error { |
| log.Printf("demo-build: %s: %v", step, err) |
| return ErrBuild |
| } |
| + |
| +// beforeCacheChmod is a test seam: where a directory swapped for a link |
| +// after the walk listed it would race a chmod by path. |
| +var beforeCacheChmod = func(path string) {} |
| + |
| +// chmodCacheDirs sets mode on every directory of the build cache. The walk |
| +// refuses a link it lists, as before, but a listing is not the chmod: the |
| +// previous build's tenant wrote this tree, and a directory it swaps for a |
| +// link after the listing would take a chmod by path, as root, to wherever |
| +// the link points. So each directory is opened beneath the cache with no |
| +// link at any component (instancefs.OpenDirBeneath, as ownBuildDirectories |
| +// does for the gVisor family) and chmodded through that descriptor. Linux |
| +// only, like the systemd family that calls it; elsewhere OpenDirBeneath |
| +// answers ErrUnsupported. |
| +func chmodCacheDirs(cache string, mode os.FileMode) error { |
| + return filepath.WalkDir(cache, func(p string, de fs.DirEntry, e error) error { |
| + if e != nil { |
| + return e |
| + } |
| + if de.Type()&os.ModeSymlink != 0 { |
| + return ErrBuild |
| + } |
| + if !de.IsDir() { |
| + return nil |
| + } |
| + rel, err := filepath.Rel(cache, p) |
| + if err != nil { |
| + return err |
| + } |
| + beforeCacheChmod(p) |
| + f, err := instancefs.OpenDirBeneath(cache, rel) |
| + if err != nil { |
| + return err |
| + } |
| + defer f.Close() |
| + return f.Chmod(mode) |
| + }) |
| +} |
diff --git a/internal/demobuild/unit_cache_chmod_test.go b/internal/demobuild/unit_cache_chmod_test.go| new file mode 100644 |
| index 000000000..66213905a |
| --- /dev/null |
| +++ b/internal/demobuild/unit_cache_chmod_test.go |
| @@ -0,0 +1,75 @@ |
| +//go:build linux |
| + |
| +package demobuild |
| + |
| +import ( |
| + "os" |
| + "path/filepath" |
| + "testing" |
| +) |
| + |
| +// The systemd-family build cache is made world-writable directory by |
| +// directory, as root, on a tree the previous build's tenant wrote. A |
| +// directory swapped for a link to somewhere else between the walk listing |
| +// it and the chmod must not hand that somewhere else mode 0777: the chmod |
| +// goes through a descriptor opened beneath the cache with no link at any |
| +// component, so the swap is refused, and ordinary directories still end |
| +// 0777. |
| +func TestCacheDirsChmodThroughFD(t *testing.T) { |
| + root := t.TempDir() |
| + cache := filepath.Join(root, "cache") |
| + outside := filepath.Join(root, "outside") |
| + for _, d := range []string{filepath.Join(cache, "a", "deep"), filepath.Join(cache, "swap"), outside} { |
| + if err := os.MkdirAll(d, 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if err := os.WriteFile(filepath.Join(cache, "a", "file"), []byte("x"), 0600); err != nil { |
| + t.Fatal(err) |
| + } |
| + |
| + if err := chmodCacheDirs(cache, 0777); err != nil { |
| + t.Fatalf("ordinary tree: %v", err) |
| + } |
| + for _, d := range []string{cache, filepath.Join(cache, "a"), filepath.Join(cache, "a", "deep"), filepath.Join(cache, "swap")} { |
| + if m := cachePerm(t, d); m != 0777 { |
| + t.Errorf("%s is %v, want 0777", d, m) |
| + } |
| + } |
| + if m := cachePerm(t, filepath.Join(cache, "a", "file")); m != 0600 { |
| + t.Errorf("a file was chmodded: %v", m) |
| + } |
| + |
| + if err := os.Chmod(filepath.Join(cache, "swap"), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + swap := filepath.Join(cache, "swap") |
| + prev := beforeCacheChmod |
| + t.Cleanup(func() { beforeCacheChmod = prev }) |
| + beforeCacheChmod = func(p string) { |
| + if p != swap { |
| + return |
| + } |
| + if err := os.Remove(swap); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.Symlink(outside, swap); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if err := chmodCacheDirs(cache, 0777); err == nil { |
| + t.Error("a directory swapped for a link was chmodded without an error") |
| + } |
| + if m := cachePerm(t, outside); m != 0700 { |
| + t.Errorf("the link's target is %v after the walk, want 0700: the chmod followed the swapped-in link", m) |
| + } |
| +} |
| + |
| +func cachePerm(t *testing.T, p string) os.FileMode { |
| + t.Helper() |
| + fi, err := os.Lstat(p) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return fi.Mode().Perm() |
| +} |
diff --git a/internal/host/units/carlos-app@.service b/internal/host/units/carlos-app@.service| index 3b79b44bf..b50546f1d 100644 |
| --- a/internal/host/units/carlos-app@.service |
| +++ b/internal/host/units/carlos-app@.service |
| @@ -2,6 +2,17 @@ |
| # is also the live/<host> symlink the adopt pass repoints and the unit |
| # the agent's restartRoute try-restarts). |
| # |
| +# Trust: unit backing is for operator-trusted tenants only (Paul, |
| +# 2026-11-16). It is set only by box root through |
| +# `carlos route --backing unit` / `carlos add --backing unit`, never by |
| +# the console. It does not carry the instance sandbox's network fence or |
| +# abstract-socket scoping: a unit tenant can reach loopback, the VPC and |
| +# abstract unix sockets. Never set it for a tenant you would not give a |
| +# shell on the box. The hardening below is only what cannot break such a |
| +# tenant: no PrivatePIDs= (#528), and no loopback or private-range |
| +# IPAddressDeny (the edge dials Addr tenants on loopback, and the box's |
| +# resolver may sit in the VPC). |
| +# |
| # DynamicUser: systemd mints an ephemeral uid per service at start — apps |
| # share no identity with each other or the platform, and nobody manages |
| # user accounts. State lives in /var/lib/carlos-app/<host> (chowned to |
| @@ -61,6 +72,14 @@ ProtectKernelLogs=yes |
| ProtectClock=yes |
| ProtectHostname=yes |
| RemoveIPC=yes |
| +# Each unit gets its own SysV and POSIX IPC namespace (#178). PrivateDevices= |
| +# carries the host's /dev/mqueue into the private /dev, and that mount would |
| +# still reach the host namespace's queues, so it is replaced. |
| +PrivateIPC=yes |
| +TemporaryFileSystem=/dev/mqueue:ro |
| +# /sys/fs/cgroup read-only: no write to another unit's cgroup.kill or |
| +# cgroup.freeze. |
| +ProtectControlGroups=yes |
| LockPersonality=yes |
| RestrictRealtime=yes |
| RestrictNamespaces=yes |
| @@ -68,6 +87,15 @@ CapabilityBoundingSet= |
| RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX |
| IPAddressDeny=169.254.169.254/32 fd00:ec2::254/128 |
| MemoryDenyWriteExecute=yes |
| +SystemCallArchitectures=native |
| +# The tenant syscall surface (#527 Q5), as on carlos-instance@: systemd's |
| +# baseline for an ordinary service, less io_uring, the kernel keyring and |
| +# userfaultfd. A refused call answers ENOSYS, so runtimes take the fallback |
| +# they already have rather than being killed. A granted doc_engine's |
| +# drop-in clears it (internal/caps/render.go): no engine has run under it. |
| +SystemCallFilter=@system-service |
| +SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd |
| +SystemCallErrorNumber=ENOSYS |
| MemoryMax=512M |
| # Throttle-and-reclaim before the kill — the same band the exec path's |
| # memory.high gives (internal/cgroup applyLimit, 90% of max). |
diff --git a/internal/host/units_isolation_test.go b/internal/host/units_isolation_test.go| index 9deda0edd..c1b745a1f 100644 |
| --- a/internal/host/units_isolation_test.go |
| +++ b/internal/host/units_isolation_test.go |
| @@ -824,3 +824,32 @@ func TestMailerUnitShape(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// carlos-app@ is for operator-trusted tenants only (Paul, 2026-11-16): it |
| +// keeps loopback, the VPC and abstract sockets open, so it gets only the |
| +// hardening that cannot break such a tenant. The syscall floor and private |
| +// IPC come from the instance template; PrivatePIDs= (#528's stop race) and |
| +// a loopback or RFC 1918 fence (the edge dials Addr tenants on loopback, |
| +// and the box's DNS may sit in the VPC) do not. The IMDS pair stays exact: |
| +// widening it to 169.254.0.0/16 would cut the VPC resolver at .253. |
| +func TestAppUnitHardeningFloor(t *testing.T) { |
| + u := readUnit(t, "carlos-app@.service") |
| + for _, want := range append(slices.Clone(syscallBlock), |
| + "ProtectControlGroups=yes", "PrivateIPC=yes", "TemporaryFileSystem=/dev/mqueue:ro", |
| + "IPAddressDeny=169.254.169.254/32 fd00:ec2::254/128") { |
| + if !hasDirective(u, want) { |
| + t.Errorf("carlos-app@.service lacks %q", want) |
| + } |
| + } |
| + for _, d := range directives(u) { |
| + if strings.HasPrefix(d, "PrivatePIDs=") { |
| + t.Errorf("carlos-app@.service carries %q (#528)", d) |
| + } |
| + if strings.HasPrefix(d, "IPAddressDeny=") && d != "IPAddressDeny=169.254.169.254/32 fd00:ec2::254/128" { |
| + t.Errorf("carlos-app@.service carries %q; only the IMDS pair is fenced here", d) |
| + } |
| + } |
| + if !strings.Contains(u, "operator-trusted tenants only") { |
| + t.Error("carlos-app@.service does not state that unit backing is for operator-trusted tenants only") |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index cf4ca8783..c6b70708e 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -233,3 +233,4 @@ plan14-root-reads-fleet-first-reconcile-speed.tsv 9206205b2a3bf27b8b85310f4a44f9 |
| plan14-root-reads-free-storage-250.tsv 9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11 |
| plan14-root-reads-fleet-first-reconcile-speed-4.tsv 4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b |
| plan14-root-reads-sec-edge-redirect-linklocal.tsv 4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b |
| +plan14-root-reads-sec-unit-app-demobuild.tsv fea6bec1f00dace47aa6006bf8606602efda4cecfa4fe3c3890136c0fb27720c |
diff --git a/internal/provision/testdata/plan14-root-reads-sec-unit-app-demobuild.tsv b/internal/provision/testdata/plan14-root-reads-sec-unit-app-demobuild.tsv| new file mode 100644 |
| index 000000000..fb0c6e60a |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-sec-unit-app-demobuild.tsv |
| @@ -0,0 +1,14 @@ |
| +# Census overlay sec-unit-app-demobuild, written by census-propose (#369). census-ruling-sec-unit-app-demobuild, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-sec-unit-app-demobuild.md. |
| +# 2 body, 0 sites, 4 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 2 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other. |
| +@legacy a7ce64ca5d18a4206b3c734fc5e19cb19e822f8530e49cd554402b32bf2ffe43 internal/host/units/carlos-app@.service external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sec-unit-app-demobuild;basis=sec-review 2026-11-16 D1: the header states unit backing is for operator-trusted tenants only (Paul, 2026-11-16) and set only by box root; the [Service] section gains PrivateIPC=yes, TemporaryFileSystem=/dev/mqueue:ro, ProtectControlGroups=yes, SystemCallArchitectures=native, SystemCallFilter=@system-service, SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd and SystemCallErrorNumber=ENOSYS, copied from carlos-instance@ (a comment notes that a granted doc_engine drop-in clears the filter). ExecStart, EnvironmentFile, StateDirectory, the /opt binds and IPAddressDeny are unchanged; it only narrows the tenant sandbox. No root read added. file:external@0 b6fcd5eebb2c268734597d44e3f066bdffdbea97d1c1a24884e3c31e571cb4a8 |
| +@legacy 0357359d139f60ef4d8716abaf6baa78faeb313cfb6697111134bd8224f34b1d internal/demobuild/unit.go chmodCacheDirs legacy accepted-legacy accepted-legacy;rev3=census-ruling-sec-unit-app-demobuild;basis=sec-review 2026-11-16 D2: the systemd-family cache chmod, extracted from Worker.prepareUnit. Root walks the build cache (filepath.WalkDir, the same read as before) and still refuses a listed link with ErrBuild; each directory is now opened with instancefs.OpenDirBeneath(cache, rel) (openat2, no link at any component, fstat must be a directory) and chmodded 0777 through that descriptor instead of os.Chmod(path). A directory the previous tenant swaps for a link after the listing is refused, not followed. Reads nothing new; follows less. file:WalkDir@68 a4c07d2bb742a04658e1bd0f851eb02a477569db90f7f68f3f9b45b11d0794ca |
| +internal/caps/render.go RenderService authority E4,J1,J4 root-input;rev3=census-ruling-sec-unit-app-demobuild;basis=sec-review 2026-11-16 D1: a granted doc_engine block also emits the constant lines SystemCallFilter= and SystemCallErrorNumber=, clearing the template's new tenant syscall filter for that tenant only, so a conversion engine keeps the syscall surface it had before this branch. Constant strings, no input reaches them; no other capability changes; no read added. file:Command@201,file:Command@486 1e7c91e75bc043b352c8ac87f3370d5bc545506e49cd214da8cab8ee01042314 |
| +internal/host/units/carlos-app@.service external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-sec-unit-app-demobuild;basis=sec-review 2026-11-16 D1: the header states unit backing is for operator-trusted tenants only (Paul, 2026-11-16) and set only by box root; the [Service] section gains PrivateIPC=yes, TemporaryFileSystem=/dev/mqueue:ro, ProtectControlGroups=yes, SystemCallArchitectures=native, SystemCallFilter=@system-service, SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd and SystemCallErrorNumber=ENOSYS, copied from carlos-instance@ (a comment notes that a granted doc_engine drop-in clears the filter). ExecStart, EnvironmentFile, StateDirectory, the /opt binds and IPAddressDeny are unchanged; it only narrows the tenant sandbox. No root read added. file:external@0 b6fcd5eebb2c268734597d44e3f066bdffdbea97d1c1a24884e3c31e571cb4a8 |
| +internal/demobuild/unit.go chmodCacheDirs legacy accepted-legacy accepted-legacy;rev3=census-ruling-sec-unit-app-demobuild;basis=sec-review 2026-11-16 D2: the systemd-family cache chmod, extracted from Worker.prepareUnit. Root walks the build cache (filepath.WalkDir, the same read as before) and still refuses a listed link with ErrBuild; each directory is now opened with instancefs.OpenDirBeneath(cache, rel) (openat2, no link at any component, fstat must be a directory) and chmodded 0777 through that descriptor instead of os.Chmod(path). A directory the previous tenant swaps for a link after the listing is refused, not followed. Reads nothing new; follows less. file:WalkDir@68 a4c07d2bb742a04658e1bd0f851eb02a477569db90f7f68f3f9b45b11d0794ca |
| +@remove internal/demobuild/unit.go Worker.prepareUnit |
| +@removed internal/demobuild/unit.go Worker.prepareUnit H3 census-ruling-sec-unit-app-demobuild;basis=sec-review 2026-11-16 D2: its cache WalkDir moved into chmodCacheDirs, which it calls for the systemd family with mode 0777; nothing else changes. |
| +@coverage internal/caps 72918a59045a8573edd814c086a1814e51e7273cdbad6108ced14b74ee57d94e |
| +@coverage internal/demobuild bb7a3cd592cb9f21b62ebb1722e29b93ca6f44661405d6ce7d7261f0dbe8e144 |
| +@coverage internal/host/units fe8840568777278f27cca03af72ba97f2a975f0d7df1cf45f71fad24d29c8fa8 |
| +@coverage internal/registry 1a542542fc8e8e1683fde0f8309b47ceecfec05ee41108bc85e25aa1b5a0bd4d |
diff --git a/internal/registry/registry.go b/internal/registry/registry.go| index 05b31ad4c..cf2f74a73 100644 |
| --- a/internal/registry/registry.go |
| +++ b/internal/registry/registry.go |
| @@ -307,6 +307,8 @@ type Route struct { |
| // agent (the activator spawns live/<host> itself — the Eleven shape), or |
| // BackingUnit = a carlos-app@<host> systemd unit (whole-app tenants: |
| // DynamicUser, StateDirectory) that the activator drives via systemctl. |
| + // Unit backing is for operator-trusted tenants only: the unit has no |
| + // network fence or abstract-socket scoping (carlos-app@.service). |
| Backing string |
| // Unit is the systemd unit that owns this route's process when it is |
| @@ -2343,6 +2345,11 @@ func (r *Registry) SetInstancePaths(host, fromDB, fromSock, toDB, toSock string) |
| // merges into (SetCaps's case) and not a value an hourly pass rewrites |
| // (SetDBPath's): it is one operator, at one step of a documented migration, |
| // naming the value they want. |
| +// |
| +// BackingUnit is for operator-trusted tenants only: a carlos-app@ tenant |
| +// can reach loopback, the VPC and abstract unix sockets |
| +// (carlos-app@.service's header), so never stamp it for a tenant you would |
| +// not give a shell on the box. |
| func (r *Registry) SetBacking(host, backing string) error { |
| if r.remote != nil { |
| _, err := r.remote.call(nil, remoteRequest{Method: "SetBacking", Host: host, Backing: backing}, nil) |