carlos / platform Public

gvisor demos: task 3 fix round 2 (host.env trust as systemd)

Apply the approved EnvironmentFile trust ruling, preserve strict executable verification and control configuration refusals, and skip nested resolver builds under -short.
Co-Authored-By: Astra (gpt-6-astra) via codex
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b5374dbcfb25495d4836de90454a265b9536ac96 parent 3151473
10 files changed, +184 −29
  • docs/superpowers/notes/census-proposal-gvisor-demos.md +4 −3
  • internal/execsandbox/config.go +6 −5
  • internal/execsandbox/config_fix1_test.go +15 −6
  • internal/host/execsandboxfix1_test.go +110 −7
  • internal/host/execsandboxfloor.go +5 −2
  • internal/host/execsandboxresolver_test.go +4 −0
  • internal/host/sandboxenv_linux.go +22 −0
  • internal/host/sandboxenv_other.go +10 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv +7 −5

CI failed — run details

diff --git a/docs/superpowers/notes/census-proposal-gvisor-demos.md b/docs/superpowers/notes/census-proposal-gvisor-demos.md
index 66f3064c4..615ee3b43 100644
--- a/docs/superpowers/notes/census-proposal-gvisor-demos.md
+++ b/docs/superpowers/notes/census-proposal-gvisor-demos.md
@@ -1,6 +1,6 @@
# Census approval: gvisor-demos
-Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or rejects every change below, 22 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-gvisor-demos`. The independent reviewer approves or rejects every change below, 23 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
@@ -61,7 +61,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/host/execsandbox.go:sandboxExecGate`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
- new `internal/host/execsandbox.go:sandboxRouteGate`: reads +registry:Runtime, +whole:Route ×2; written legacy, accepted-legacy, frozen
- new `internal/host/execsandboxfloor.go:checkExecSandboxBaselineAt`: reads +file:Lstat ×2, +file:ReadFile; written legacy, accepted-legacy, frozen
-- new `internal/host/execsandboxfloor.go:sandboxHostEnvironment`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
+- new `internal/host/execsandboxfloor.go:sandboxHostEnvironmentAt`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
- new `internal/host/execsandboxfloor.go:verifiedSandboxCandidate`: reads +file:Read; written legacy, accepted-legacy, frozen
- new `internal/host/runscensure.go:installRunscSet`: reads +file:Lstat, +file:Open; written legacy, accepted-legacy, frozen
- new `internal/host/runscensure.go:pruneRunscSets`: reads +file:ReadDir; written legacy, accepted-legacy, frozen
@@ -69,12 +69,13 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/host/runscensure.go:runscSystemctl`: reads +file:CommandContext; written legacy, accepted-legacy, frozen
- new `internal/host/runscensure.go:wireSandboxReadiness`: reads +file:ReadFile; written legacy, accepted-legacy, frozen
- new `internal/host/runscset_linux.go:openRunscLock`: reads +file:Fstat, +file:Open; written legacy, accepted-legacy, frozen
+- new `internal/host/sandboxenv_linux.go:openSandboxHostEnvironment`: reads +file:Openat2; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-demo-build-gvisor@.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-instance-gvisor-probe.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-instance-gvisor@.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/host/units/carlos-runsc.service:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/instanceexec/sandbox_linux.go:gvisorProbeChecks`: reads +data-literal, +file:ReadFile; written legacy, accepted-legacy, frozen
-Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `8ed02e85fcb1c633e77408ec2ca92dc4f2fd88bad9876754530d2356d4c943e3`.
+Seal: `b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c` → `d7c4a8744939baea632787d8c6bd527a27e74d167011e68655c8aecaefa3b66e`.
Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/execsandbox/config.go b/internal/execsandbox/config.go
index 6e86bfd37..cf0e25cf5 100644
--- a/internal/execsandbox/config.go
+++ b/internal/execsandbox/config.go
@@ -16,11 +16,9 @@ func resolveFromEnv(getenv func(string) string, autoDemoGVisor bool) (Configured
if err != nil {
return configured, EffectiveGVisor, err
}
- cfg, err := demo.BoxConfig(getenv)
- if err != nil {
- return configured, EffectiveGVisor, err
- }
- return configured, resolve(configured, cfg.BoxMode(), autoDemoGVisor), nil
+ cfg, demoErr := demo.BoxConfig(getenv)
+ // Invalid demo configuration is not a request to raise the executable floor.
+ return configured, resolve(configured, demoErr == nil && cfg.BoxMode(), autoDemoGVisor), nil
}
// Configure adds launch admission to the shared mode decision.
@@ -29,6 +27,9 @@ func Configure(getenv func(string) string) (Configured, Effective, error) {
if err != nil {
return configured, effective, err
}
+ if _, err := demo.BoxConfig(getenv); err != nil {
+ return configured, effective, err
+ }
if effective == EffectiveGVisor && hostwrite.Enabled(getenv) {
return configured, effective, ErrClaims
}
diff --git a/internal/execsandbox/config_fix1_test.go b/internal/execsandbox/config_fix1_test.go
index 87f28ba3f..8d7595803 100644
--- a/internal/execsandbox/config_fix1_test.go
+++ b/internal/execsandbox/config_fix1_test.go
@@ -15,12 +15,21 @@ func TestExecSandboxSharedResolver(t *testing.T) {
t.Fatalf("auto=%v: %s %v", on, got, err)
}
}
- for _, bad := range []string{"invalid", "1"} {
- broken := map[string]string{"CARLOS_DEMO_BOX": bad, "CARLOS_EXEC_SANDBOX": "auto"}
- _, mode, err := resolveFromEnv(func(k string) string { return broken[k] }, true)
- if err == nil || mode != EffectiveGVisor {
- t.Fatalf("invalid demo configuration: %s %v", mode, err)
+ for _, bad := range []string{"0", "invalid", "1"} {
+ for _, configured := range []string{"", "auto", "systemd", "gvisor", "invalid"} {
+ broken := map[string]string{"CARLOS_DEMO_BOX": bad, "CARLOS_EXEC_SANDBOX": configured}
+ get := func(k string) string { return broken[k] }
+ _, mode, err := resolveFromEnv(get, true)
+ want := EffectiveSystemd
+ if configured == "gvisor" || configured == "invalid" {
+ want = EffectiveGVisor
+ }
+ if mode != want || (err != nil) != (configured == "invalid") {
+ t.Fatalf("demo %q sandbox %q: %s %v", bad, configured, mode, err)
+ }
+ if _, _, err := Configure(get); err == nil {
+ t.Fatalf("control allowed invalid demo %q", bad)
+ }
}
}
-
}
diff --git a/internal/host/execsandboxfix1_test.go b/internal/host/execsandboxfix1_test.go
index d39d1d0ec..b15b9a2e9 100644
--- a/internal/host/execsandboxfix1_test.go
+++ b/internal/host/execsandboxfix1_test.go
@@ -9,6 +9,7 @@ import (
"io"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
@@ -17,6 +18,9 @@ import (
func fixtureSandboxEnvironment(t *testing.T, f *applyFixture, raw string) {
t.Helper()
+ if runtime.GOOS != "linux" {
+ t.Skip("host.env no-follow opener is Linux-only")
+ }
path := filepath.Join(f.a.etcDir, "carlos", "host.env")
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
t.Fatal(err)
@@ -24,12 +28,24 @@ func fixtureSandboxEnvironment(t *testing.T, f *applyFixture, raw string) {
if err := os.WriteFile(path, []byte(raw), 0600); err != nil {
t.Fatal(err)
}
- // The existing apply fixture uses a non-root box. Only its file-opening seam
- // differs; both floor parsing and unit rendering read this hand-edited file.
- f.a.sandboxEnvironment = func() (func(string) string, error) {
- body, err := os.ReadFile(path)
- return sandboxEnvironmentValues(body), err
+ // Match a file systemd accepts: non-root owner, group write, two links,
+ // and a group-writable parent. Exercise the real production opener.
+ if err := os.Chmod(path, 0660); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Chmod(filepath.Dir(path), 0770); err != nil {
+ t.Fatal(err)
+ }
+ if os.Geteuid() == 0 {
+ if err := os.Chown(path, 65534, -1); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := os.Link(path, path+".alias"); err != nil {
+ t.Fatal(err)
}
+ f.a.sandboxEnvironment = func() (func(string) string, error) { return sandboxHostEnvironmentAt(path) }
+
}
func TestExecSandboxEnvironmentSyntax(t *testing.T) {
@@ -75,7 +91,20 @@ func TestExecSandboxHandEditedEnvironment(t *testing.T) {
} else if r == nil || !strings.Contains(r.Reason, "exec-sandbox floor") {
t.Fatalf("gvisor apply: %+v", r)
}
+ getenv, readErr := f.a.sandboxEnvironment()
+ if readErr != nil {
+ t.Fatal(readErr)
+ }
+ if mode == "systemd" {
+ if err := ensureRunsc(context.Background(), getenv, nil, nil); err != nil {
+ t.Fatalf("installer did not exit successfully: %v", err)
+ }
+ }
os.WriteFile(systemPrevPath(f.a.optDir), []byte("#!/bin/sh\necho carlos v1\n"), 0755)
+ gateErr := sandboxAllowsPrev(f.a.sandboxEnvironment, systemPrevPath(f.a.optDir))
+ if (gateErr != nil) != (mode == "gvisor") {
+ t.Fatalf("recovery gate: %v", gateErr)
+ }
writeJSONDurable(f.a.file("journal.json"), systemJournal{Phase: systemPhaseUnits, Target: "v2", PrevBuild: "v1", StartedAt: f.now}, 0600)
f.edgeStartedThisBoot = false
err := f.a.Run(context.Background(), true)
@@ -86,6 +115,10 @@ func TestExecSandboxHandEditedEnvironment(t *testing.T) {
if j, _ := readSystemJournal(f.a.optDir); j != nil {
t.Fatal("journal remains")
}
+ current, err := os.ReadFile(systemBinaryPath(f.a.optDir))
+ if err != nil || string(current) != "#!/bin/sh\necho carlos v1\n" {
+ t.Fatalf("unaware prev not restored: %q %v", current, err)
+ }
} else {
if err == nil || !strings.Contains(err.Error(), "exec-sandbox floor") {
t.Fatalf("gvisor recovery: %v", err)
@@ -95,8 +128,8 @@ func TestExecSandboxHandEditedEnvironment(t *testing.T) {
}
}
-func TestExecSandboxUntrustedEnvironmentRecovery(t *testing.T) {
- for _, problem := range []string{"unreadable", "untrusted", "invalid"} {
+func TestExecSandboxUnreadableEnvironmentRecovery(t *testing.T) {
+ for _, problem := range []string{"unreadable", "invalid"} {
t.Run(problem, func(t *testing.T) {
f, _ := applyHappy(t)
f.a.sandboxEnvironment = func() (func(string) string, error) {
@@ -149,3 +182,73 @@ func TestExecSandboxCandidateSize(t *testing.T) {
type errorReader struct{}
func (errorReader) Read([]byte) (int, error) { return 0, errors.New("reader failed") }
+
+func TestExecSandboxHostEnvironmentNoFollowAndCap(t *testing.T) {
+ if runtime.GOOS != "linux" {
+ t.Skip("Linux opener")
+ }
+ dir := t.TempDir()
+ path := filepath.Join(dir, "host.env")
+ if err := os.WriteFile(path, []byte("CARLOS_EXEC_SANDBOX=systemd\n"), 0660); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink(path, filepath.Join(dir, "link.env")); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := sandboxHostEnvironmentAt(filepath.Join(dir, "link.env")); err == nil {
+ t.Fatal("leaf symlink followed")
+ }
+ parent := filepath.Join(dir, "parent")
+ if err := os.Symlink(dir, parent); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := sandboxHostEnvironmentAt(filepath.Join(parent, "host.env")); err == nil {
+ t.Fatal("ancestor symlink followed")
+ }
+ if err := os.WriteFile(path, bytes.Repeat([]byte{'x'}, (1<<20)+1), 0600); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := sandboxHostEnvironmentAt(path); err == nil {
+ t.Fatal("oversize env accepted")
+ }
+}
+
+func TestExecSandboxInvalidDemoEnvironment(t *testing.T) {
+ for _, setting := range []string{"", "auto", "systemd", "gvisor", "invalid"} {
+ t.Run(setting, func(t *testing.T) {
+ f, _ := applyHappy(t)
+ fixtureSandboxEnvironment(t, f, "CARLOS_DEMO_BOX=0\nCARLOS_EXEC_SANDBOX="+setting+"\n")
+ mode, err := f.a.sandboxMode()
+ want := execsandbox.EffectiveSystemd
+ if setting == "gvisor" || setting == "invalid" {
+ want = execsandbox.EffectiveGVisor
+ }
+ if mode != want || (err != nil) != (setting == "invalid") {
+ t.Fatalf("floor: %s %v", mode, err)
+ }
+ getenv, err := f.a.sandboxEnvironment()
+ if err != nil {
+ t.Fatal(err)
+ }
+ required, err := runscRequired(getenv)
+ if required != (want == execsandbox.EffectiveGVisor) || (err != nil) != (setting == "invalid") {
+ t.Fatalf("installer: %v %v", required, err)
+ }
+ if _, _, err := execSandboxConfig(getenv); err == nil {
+ t.Fatal("control/agent accepted invalid demo box")
+ }
+ if want == execsandbox.EffectiveSystemd {
+ if err := ensureRunsc(context.Background(), getenv, nil, nil); err != nil {
+ t.Fatal(err)
+ }
+ if err := sandboxAllowsPrev(f.a.sandboxEnvironment, systemPrevPath(f.a.optDir)); err != nil {
+ t.Fatalf("floor blocked prev: %v", err)
+ }
+ body := []byte("unaware candidate")
+ if _, err := verifiedSandboxCandidate(bytes.NewReader(body), int64(len(body)), fmt.Sprintf("%x", sha256.Sum256(body)), mode); err != nil {
+ t.Fatalf("candidate floor: %v", err)
+ }
+ }
+ })
+ }
+}
diff --git a/internal/host/execsandboxfloor.go b/internal/host/execsandboxfloor.go
index 78500947e..7dea38b3d 100644
--- a/internal/host/execsandboxfloor.go
+++ b/internal/host/execsandboxfloor.go
@@ -16,8 +16,11 @@ import (
var errExecSandboxFloor = fmt.Errorf("%w: exec-sandbox floor", errSystemRefused)
func sandboxHostEnvironment() (func(string) string, error) {
- const path = "/etc/carlos/host.env"
- f, err := execsandbox.OpenRootFile(path)
+ return sandboxHostEnvironmentAt("/etc/carlos/host.env")
+}
+
+func sandboxHostEnvironmentAt(path string) (func(string) string, error) {
+ f, err := openSandboxHostEnvironment(path)
if errors.Is(err, os.ErrNotExist) {
return func(string) string { return "" }, nil
}
diff --git a/internal/host/execsandboxresolver_test.go b/internal/host/execsandboxresolver_test.go
index 86427f8e4..62f633a60 100644
--- a/internal/host/execsandboxresolver_test.go
+++ b/internal/host/execsandboxresolver_test.go
@@ -110,6 +110,10 @@ func TestExecSandboxResolverCallers(t *testing.T) {
t.Fatalf("%s: %s no longer calls %s", binding.file, binding.caller, binding.callee)
}
}
+ if testing.Short() {
+ t.Log("short mode: skipping nested resolver go test")
+ return
+ }
// Rebuild only the test dependency through the resolver's private rollout
// argument. Neither the shipped constant nor the checkout is edited.
config := filepath.Join(root, "internal/execsandbox/config.go")
diff --git a/internal/host/sandboxenv_linux.go b/internal/host/sandboxenv_linux.go
new file mode 100644
index 000000000..8cc25d67e
--- /dev/null
+++ b/internal/host/sandboxenv_linux.go
@@ -0,0 +1,22 @@
+//go:build linux
+
+package host
+
+import (
+ "os"
+
+ "golang.org/x/sys/unix"
+)
+
+// EnvironmentFile authority does not depend on file ownership, permissions or
+// link count. Keep no-follow at every component; the caller bounds the read.
+func openSandboxHostEnvironment(path string) (*os.File, error) {
+ fd, err := unix.Openat2(unix.AT_FDCWD, path, &unix.OpenHow{
+ Flags: unix.O_RDONLY | unix.O_NOFOLLOW | unix.O_NONBLOCK | unix.O_CLOEXEC,
+ Resolve: unix.RESOLVE_NO_SYMLINKS,
+ })
+ if err != nil {
+ return nil, &os.PathError{Op: "open", Path: path, Err: err}
+ }
+ return os.NewFile(uintptr(fd), path), nil
+}
diff --git a/internal/host/sandboxenv_other.go b/internal/host/sandboxenv_other.go
new file mode 100644
index 000000000..b9ac1d0ce
--- /dev/null
+++ b/internal/host/sandboxenv_other.go
@@ -0,0 +1,10 @@
+//go:build !linux
+
+package host
+
+import (
+ "github.com/carlosframework/platform/internal/execsandbox"
+ "os"
+)
+
+func openSandboxHostEnvironment(string) (*os.File, error) { return nil, execsandbox.ErrUnsupported }
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 3d6ba2ef9..20e774e7d 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -128,4 +128,4 @@ plan14-root-reads-fix-activator-backoff-flake.tsv feba66806ddfcbdfaf369d72413bb1
plan14-root-reads-region-ha-dr5.tsv f19eb78c1da1475cbf8e11a3d6c394d828aa1c8f88ae24469fe8d473581b934b
plan14-root-reads-instance-syscall-filter.tsv b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c
plan14-root-reads-instance-restore-658-cli.tsv b970bb28c5a633d2572a1da549030e9258cfdabb6322ddffdd0ebf41b56c464c
-plan14-root-reads-gvisor-demos.tsv 8ed02e85fcb1c633e77408ec2ca92dc4f2fd88bad9876754530d2356d4c943e3
+plan14-root-reads-gvisor-demos.tsv d7c4a8744939baea632787d8c6bd527a27e74d167011e68655c8aecaefa3b66e
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
index 28a143b53..a7cc59b06 100644
--- a/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
+++ b/internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv
@@ -1,6 +1,6 @@
# Census overlay gvisor-demos, written by census-propose (#369). census-ruling-gvisor-demos, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-gvisor-demos.md.
# 18 body, 1 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 22 new dispositions: 0 reads re-frozen at their disposition with the claim, 22 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+# 23 new dispositions: 0 reads re-frozen at their disposition with the claim, 23 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy 4ef93c4470151048cf05dc69a2c0c2375a4f25b65e6af8c33ab740705a6b33b5 internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-gvisor-demos;basis=Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed. file:Command@12057,file:ReadFile@564,file:ReadFile@7111 2710b4ae0c444e7742e91dfffc6c136a698927eb62c42eae7cfc4eb1b06d2453
@legacy ef8c8c20a6fd6daec8dc2c84b454a0cb05e9fc604300a1d3098f843ae5b6b67a internal/host/systemapply.go systemApplier.installUnits legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.;rev3=census-ruling-gvisor-demos;basis=Create rootfs/runtime parent directories before controller restart. Existing staged unit and root-owned host.env reads unchanged. file:ReadDir@1509,file:ReadFile@1060,file:ReadFile@2100,file:ReadFile@5135,file:Stat@2758,file:Stat@4051 f20ce9ef05e19ccb08e68d7c7935aaf20175892fa2616c794ac6adad5303a8a8
@legacy 396d3405311b55e3a1a748760a780bf8688577abacc3317cda791764969f5d74 internal/host/systemapply.go systemApplier.stagePlan legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Require groupExecutable before staged bootstrap execution, matching the authorized old/new artifact through existing no-follow slot checks. New indirect marker/permit reads are root-protected; staged path still subject to existing release verification, direct read site unchanged.;rev3=census-ruling-gvisor-demos;basis=Require sandbox awareness before clearing or creating staged unit plan and invoking bootstrap. No added direct read. file:ReadDir@710 29ad3b5339fafc83341b78d5d9542c36c7919e9258aa7ac2df6a723f2c888241
@@ -18,7 +18,7 @@
@legacy ee7a88073c08baf804220709c6e2d7778d7d277054f413be0443d2ac431643ef internal/host/execsandbox.go sandboxExecGate legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the existing registry route through injected lookup only for gVisor; require the same route admission before BeforeExec. No new path; lookup is the existing registry handle. whole:Route@493,whole:Route@587 e66292565a6718b38622cfbd0747888356fb66fca161d782399067a0db23a1f5
@legacy 8d2537e489c6d9c5782c1548a3cdabe421f20a9d4eae4b71d008d089c071a43c internal/host/execsandbox.go sandboxRouteGate legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read existing route layout, demo marker and runtime to refuse unsupported or direct gVisor launches before the next config gate. No new path; layout inputs are the backend's existing ones. registry:Runtime@700,whole:Route@432,whole:Route@802 6d3b45864d6e551a523e37dbec39f6d7befd414d02ce6751531ac312c7ec1d67
@legacy 8b1d8ef0abb6f01ce57096673c47b69b9a48b6922da8f8760e18f126108b2235 internal/host/execsandboxfloor.go checkExecSandboxBaselineAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Lstat journal and guard executable/census/moves paths for absence on every readiness call; compare installed recovery bytes with exact embedded unit. No guard execution or state alteration. file:Lstat@289,file:Lstat@488,file:ReadFile@617 f7e75448f38d25a703aedef82e102da70f8e9e84ce8e6aed98ecfc8a7f86b0c2
-@legacy 38062d55b0755b5d88a0704a042530cbf1de66c1a052ea50f1cefacd98e80bb5 internal/host/execsandboxfloor.go sandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Reopen fixed root-owned host.env with unchanged no-follow/owner/link/mode checks and 1 MiB bound. Extract only requested EnvironmentFile values with last-assignment-wins quoting/continuation semantics; unrelated comments, bare lines and duplicate assignments do not reject the file. Shared resolution requests sandbox and demo identity settings; installer may also request its store settings. No inherited values used as authority. file:ReadAll@296 797680ede1326b2f98f4765d78b8bf9c897ec1590319886e818d18ce77510353
+@legacy b3af337ffdee606896478263d218efb516323b37b296343a7c7188f7c2d5d456 internal/host/execsandboxfloor.go sandboxHostEnvironmentAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit host.env trust ruling: read at most 1 MiB plus overflow byte from the no-follow descriptor; parse requested values with unchanged systemd EnvironmentFile grammar. Production wrapper supplies only /etc/carlos/host.env. No owner, permission-mode or link-count validation; systemd already trusts the writer of this file. Other root/executable readers retain their checks. file:ReadAll@274 3e8f42e21bea50217d7deef915106951a7a9cafd0d7cc372e22a146234d9c19a
@legacy b5364535673f179cbb1113345c807a896dcba245ff98542f00e7c2fcb7da923c internal/host/execsandboxfloor.go verifiedSandboxCandidate legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the same untrusted candidate stream into one fstat-sized allocation capped at 96 MiB using io.ReadFull, then use one-byte Read to require EOF. Signed pointer hash and marker are checked over those exact bytes. Scanner sites change ReadAll to Read; ReadFull also consumes that already-open stream. No new file/path or execution authority. file:Read@401 c9ac211fe09e49e7e239a694614b920814735ef2de96cd479b82035e24c0e731
@legacy c5c7ce8e96666643370f65654423c247b19a4d2862e1c3d1caf890f13bb5285a internal/host/runscensure.go installRunscSet legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Check root-owned destination parent; fetch five compiled-pin object keys into exclusive temporary set, bounded hashes and fsync, verify complete set, publish by atomic directory rename/exchange. No unverified executable published. file:Lstat@431,file:Open@1395 5d1264fd744af58eb38a236203fd93b2bfeca2c8fa618fe37089ccbd1b865e14
@legacy 0f982a9b20cd4e766747e1d410ef8565645a5562c1532e4f61a30b369f4379d6 internal/host/runscensure.go pruneRunscSets legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read runtime directory only after complete command inventory; retain current/referenced sets and everything on inventory failure; remove only unreferenced 64-hex root-owned set directories. file:ReadDir@232 164a94ccd333048342691664b7a30e8b0f34b7a67d2d0f717498b5cabe41f96b
@@ -26,6 +26,7 @@
@legacy 162c1096b241d3681b0a32f8a50b9f13beccb7ea6a15c1121a309bbc6e2cce29 internal/host/runscensure.go runscSystemctl legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Execute systemctl with fixed enumeration/start verbs and root-generated unit names, context bounded. No shell or request-provided executable. file:CommandContext@88 16614091a159f92b0575ac6980a90e468c50936662d6f1016425b4080951468e
@legacy 89850dae525cb323ac5284d111ad6b2a490e170d07c67145ea2944da427f9fc8 internal/host/runscensure.go wireSandboxReadiness legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read exact embedded recovery unit and bind host baseline plus compiled-pin verification callbacks. No installed unit data enters instancectl imports. file:ReadFile@85 e46e312a601c7e91da51d537c8ebb580c2c59630f8608d5a65da5a4352245c0e
@legacy 35a5420f20da576cdf58faa3263996e80ee6626aa488ce7ebcd1e9c6957a4306 internal/host/runscset_linux.go openRunscLock legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Open fixed installer lock under checked root runtime directory with O_NOFOLLOW; fstat root owner, single-link regular and private mode before flock. file:Fstat@264,file:Open@64 d44bfa3ce6f1e0bc68c2671ed5604044412de4e6f82b488436d119ee71b81d68
+@legacy cc38e6f633e162e87204491353a29cf019b1b3716c9e082ddfd83b1e51d7ab3e internal/host/sandboxenv_linux.go openSandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit user ruling: open the fixed production host.env path with Openat2 O_RDONLY/O_NOFOLLOW/O_NONBLOCK/O_CLOEXEC and RESOLVE_NO_SYMLINKS for all ancestors. No owner, permission-mode or link-count check; caller enforces 1 MiB cap. This exception is confined to EnvironmentFile authority, not executable/runtime verification. file:Openat2@77 a57adab592aaaf247971a7556724f6e7cfb56090dcbb8ca9173bc21248c03f4d
@legacy 7ce6741a7508b1a64de66d58ea342ff1ac4f4093c73a94e8e211949a574fca23 internal/host/units/carlos-demo-build-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor build skeleton with empty ExecStart, all twelve measured properties, control-group termination and fixed physical budgets. Host LimitFSIZE is omitted by ruling; guest OCI limit remains 33554432 and passed EFBIG measurement. Root prepares validated per-job writable paths, append diagnostics and runtime commands later; template output defaults remain null. file:external@0 8b6f939424c554aaf1e5ed38111ebd0bf67fdcbaaa5bc6415df55affb64ba17a
@legacy 1cb2a2b1f667f42c1b24eb4997c20b5ecc00a9571d92060dedfada948e8a0f5d internal/host/units/carlos-instance-gvisor-probe.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor probe skeleton with empty ExecStart, all twelve measured properties, fixed probe data/run paths, append output and mixed kill with SIGCONT. Root command preparation must reset output and bind a fresh nonce before start; full readiness consumer remains a later task. file:external@0 b05d264190ef2172e87e5b2667164f2051e83016695595e32ccbcdce9186eb6b
@legacy 4de04c1583d5fa335adadb7227f9ce1ec35e28280744d6571ebe92c72b4442f2 internal/host/units/carlos-instance-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor run skeleton with empty ExecStart and all twelve measured host properties. Defines per-instance data/run writable paths and socket output, root runtime directory, mixed kill with SIGCONT, and the existing bounded stop. A root-prepared validated command drop-in is required before it can start; no command or pin placeholder is installed here. file:external@0 914a3c0486d83b6b87ce14c473aab9005ff7bc004cb984040a81ddc60087a5c1
@@ -59,7 +60,7 @@ internal/execsandbox/verifier.go RunscVerifier.verify legacy accepted-legacy acc
internal/host/execsandbox.go sandboxExecGate legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the existing registry route through injected lookup only for gVisor; require the same route admission before BeforeExec. No new path; lookup is the existing registry handle. whole:Route@493,whole:Route@587 e66292565a6718b38622cfbd0747888356fb66fca161d782399067a0db23a1f5
internal/host/execsandbox.go sandboxRouteGate legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read existing route layout, demo marker and runtime to refuse unsupported or direct gVisor launches before the next config gate. No new path; layout inputs are the backend's existing ones. registry:Runtime@700,whole:Route@432,whole:Route@802 6d3b45864d6e551a523e37dbec39f6d7befd414d02ce6751531ac312c7ec1d67
internal/host/execsandboxfloor.go checkExecSandboxBaselineAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Lstat journal and guard executable/census/moves paths for absence on every readiness call; compare installed recovery bytes with exact embedded unit. No guard execution or state alteration. file:Lstat@289,file:Lstat@488,file:ReadFile@617 f7e75448f38d25a703aedef82e102da70f8e9e84ce8e6aed98ecfc8a7f86b0c2
-internal/host/execsandboxfloor.go sandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Reopen fixed root-owned host.env with unchanged no-follow/owner/link/mode checks and 1 MiB bound. Extract only requested EnvironmentFile values with last-assignment-wins quoting/continuation semantics; unrelated comments, bare lines and duplicate assignments do not reject the file. Shared resolution requests sandbox and demo identity settings; installer may also request its store settings. No inherited values used as authority. file:ReadAll@296 797680ede1326b2f98f4765d78b8bf9c897ec1590319886e818d18ce77510353
+internal/host/execsandboxfloor.go sandboxHostEnvironmentAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit host.env trust ruling: read at most 1 MiB plus overflow byte from the no-follow descriptor; parse requested values with unchanged systemd EnvironmentFile grammar. Production wrapper supplies only /etc/carlos/host.env. No owner, permission-mode or link-count validation; systemd already trusts the writer of this file. Other root/executable readers retain their checks. file:ReadAll@274 3e8f42e21bea50217d7deef915106951a7a9cafd0d7cc372e22a146234d9c19a
internal/host/execsandboxfloor.go verifiedSandboxCandidate legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read the same untrusted candidate stream into one fstat-sized allocation capped at 96 MiB using io.ReadFull, then use one-byte Read to require EOF. Signed pointer hash and marker are checked over those exact bytes. Scanner sites change ReadAll to Read; ReadFull also consumes that already-open stream. No new file/path or execution authority. file:Read@401 c9ac211fe09e49e7e239a694614b920814735ef2de96cd479b82035e24c0e731
internal/host/runscensure.go installRunscSet legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Check root-owned destination parent; fetch five compiled-pin object keys into exclusive temporary set, bounded hashes and fsync, verify complete set, publish by atomic directory rename/exchange. No unverified executable published. file:Lstat@431,file:Open@1395 5d1264fd744af58eb38a236203fd93b2bfeca2c8fa618fe37089ccbd1b865e14
internal/host/runscensure.go pruneRunscSets legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read runtime directory only after complete command inventory; retain current/referenced sets and everything on inventory failure; remove only unreferenced 64-hex root-owned set directories. file:ReadDir@232 164a94ccd333048342691664b7a30e8b0f34b7a67d2d0f717498b5cabe41f96b
@@ -67,6 +68,7 @@ internal/host/runscensure.go runscCommandInventory legacy accepted-legacy accept
internal/host/runscensure.go runscSystemctl legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Execute systemctl with fixed enumeration/start verbs and root-generated unit names, context bounded. No shell or request-provided executable. file:CommandContext@88 16614091a159f92b0575ac6980a90e468c50936662d6f1016425b4080951468e
internal/host/runscensure.go wireSandboxReadiness legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Read exact embedded recovery unit and bind host baseline plus compiled-pin verification callbacks. No installed unit data enters instancectl imports. file:ReadFile@85 e46e312a601c7e91da51d537c8ebb580c2c59630f8608d5a65da5a4352245c0e
internal/host/runscset_linux.go openRunscLock legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Open fixed installer lock under checked root runtime directory with O_NOFOLLOW; fstat root owner, single-link regular and private mode before flock. file:Fstat@264,file:Open@64 d44bfa3ce6f1e0bc68c2671ed5604044412de4e6f82b488436d119ee71b81d68
+internal/host/sandboxenv_linux.go openSandboxHostEnvironment legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 3 fix round 2, explicit user ruling: open the fixed production host.env path with Openat2 O_RDONLY/O_NOFOLLOW/O_NONBLOCK/O_CLOEXEC and RESOLVE_NO_SYMLINKS for all ancestors. No owner, permission-mode or link-count check; caller enforces 1 MiB cap. This exception is confined to EnvironmentFile authority, not executable/runtime verification. file:Openat2@77 a57adab592aaaf247971a7556724f6e7cfb56090dcbb8ca9173bc21248c03f4d
internal/host/units/carlos-demo-build-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor build skeleton with empty ExecStart, all twelve measured properties, control-group termination and fixed physical budgets. Host LimitFSIZE is omitted by ruling; guest OCI limit remains 33554432 and passed EFBIG measurement. Root prepares validated per-job writable paths, append diagnostics and runtime commands later; template output defaults remain null. file:external@0 8b6f939424c554aaf1e5ed38111ebd0bf67fdcbaaa5bc6415df55affb64ba17a
internal/host/units/carlos-instance-gvisor-probe.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor probe skeleton with empty ExecStart, all twelve measured properties, fixed probe data/run paths, append output and mixed kill with SIGCONT. Root command preparation must reset output and bind a fresh nonce before start; full readiness consumer remains a later task. file:external@0 b05d264190ef2172e87e5b2667164f2051e83016695595e32ccbcdce9186eb6b
internal/host/units/carlos-instance-gvisor@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Add the unarmed root gVisor run skeleton with empty ExecStart and all twelve measured host properties. Defines per-instance data/run writable paths and socket output, root runtime directory, mixed kill with SIGCONT, and the existing bounded stop. A root-prepared validated command drop-in is required before it can start; no command or pin placeholder is installed here. file:external@0 914a3c0486d83b6b87ce14c473aab9005ff7bc004cb984040a81ddc60087a5c1
@@ -74,8 +76,8 @@ internal/host/units/carlos-runsc.service external legacy accepted-legacy accepte
internal/instanceexec/sandbox_linux.go gvisorProbeChecks legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Preliminary guest-only probe reads the fixed /proc/self/status to check empty capability sets and NoNewPrivs, and SelfCheck opens the fixed own /data/instances/_probe directory with unchanged safe-open flags. Runs as the guest carlos identity; reports readiness incomplete until the later root challenges exist. No tenant-selected host path or root authority is added. Echo CARLOS_GVISOR_PROBE_NONCE from the initial guest environment in the additive omitempty report field; root supplies the challenge in the OCI environment. No new filesystem read or readiness grant. data-literal@696,file:ReadFile@202 b201174cac395aea50cbe7c306859c47a120d1a954d988a43e9746a1386f658a
internal/host/systemapply.go systemApplier.stageCandidate legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Require groupStageDigest before staging/candidate execution; action and new digest come from root-owned operator permit bound to boot marker. Existing signed pointer/artifact verification and two direct read sites remain.;rev3=census-ruling-gvisor-demos;basis=Pass the already-open regular file fstat size to bounded preflight. Allocate payload once at exactly that size, use ReadFull then confirm EOF; hash and scan those same bytes before staging. Root-owned staged target is still checked before execution. Preserve staging on floor refusal for apply/install-channel. file:Stat@694 ea8c519d19786af346500c289fc768bd7047639d90154af6ec6ecefdfb41d57f
@coverage . e359ebe397bac9cf64ba77fb85322e55c3409dc5ca63c9a7c1dc51348ca0ade0
-@coverage internal/execsandbox 99bcd711051dfb53d8c9b2e36c059271b47a940779777f6734d49fc102617465
-@coverage internal/host 4afed13ce7dc29d1f8e0d58ea174010846c71273a80b7475a7390e33501f96cf
+@coverage internal/execsandbox ca4033868fb993ce99b6be31d75086de280f2e9e4415bd3b3a1b9e1438864ff7
+@coverage internal/host ac30199a6dab2d9e57234bbfd8a6f9d377115cdf16cbdd0ef612fa0418e9fb1d
@coverage internal/host/units 93402572d2fc9c32b563820a36d565afa2ed951637bde9561fe2e845137a6524
@coverage internal/instancectl 540d394b34894c830106f093152a449f152a51f6fd422ab9a9595c96a9beef7f
@coverage internal/instanceexec 451a4cb9a8fc078f883afab1c361678185c332a1e294c24420ab4ae2fb3face9