On this page

Security and reliability review, November 2026

Scope: crates/tenon-compiler/src/{sandbox_launcher,net_host,manifest}.rs, crates/tenon-compiler/src/cgen/secret.rs, crates/tenon-compiler/src/packages/{mod,lock,git,resolve}.rs, crates/tenon-compiler/src/interp/process.rs, crates/tenon/src/plugins.rs, runtime/*.h, plugins/cli/native/trt_{sandbox,proc,proc_run,proc_plugin,proc_spawn,io,io_cap,io_fs,io_read,app_scope}.h, and plugins/agent/native/trt_{agent,tools}.h.

Originally reviewed against main at 3d25e914 and reconciled in Track B against the current tenon / trt_* layout and P1–P9 mitigations.

Severity: High means exploitable by untrusted input with real impact. Medium needs an attacker-controlled repository or a granted capability. Low needs local write access, races or unusual configuration. Info means no defect, but worth knowing.

Fixed in initial review (3d25e914)

# Severity Where Finding Fix and regression test
F1 Medium crates/tenon-compiler/src/packages/lock.rs (originally packages.rs:1171) tenon fetch wrote the lockfile with std::fs::write, which follows a symlink. A repository could commit tenon.lock as a dangling symlink so fetch wrote attacker-chosen lock text to an arbitrary writable target; truncate-then-write also let concurrent readers see an empty lock (E0944). Atomic lock writer creates a create_new staging file beside tenon.lock and renames it over the lockfile, replacing any symlink and preventing torn reads.
F2 Low (flaky test) scripts/test_native_test_cc.py::test_termination_reaches_cache_process_group About 1 run in 10 failed under load due to re-entrant stdout writes from a SIGTERM handler and a lost-wakeup window around signal.pause(). SIGTERM is blocked before fork and consumed with signal.sigwait. Passed 200/200 runs under 12-way load.
F3 Low (flaky test) deps_tests.rs::corpus_resolved_references_are_covered Read tests/programs/edition-{args,codec-show} in place before deps were materialized, causing E0936 on fresh checkouts or concurrent-fetch races. Copies edition/git test programs into a private temp dir, fetches there, and analyzes the copy.

Track B P1–P9 findings and mitigation status

# Severity Live path Original finding Track B mitigation status
P1 Medium plugins/cli/native/trt_sandbox.h With network granted, Linux seccomp allowed every socket() call including AF_UNIX, letting sandboxed children reach path/abstract UNIX sockets (/var/run/docker.sock, D-Bus). Mitigated (Track B): When network=1, the Linux BPF seccomp filter checks socket() args[0] to allow only AF_INET/AF_INET6 (returning EACCES for AF_UNIX and other families) and adds LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET when Landlock ABI >= 6.
P2 Medium plugins/cli/native/trt_sandbox.h Sandboxed children could kill() same-UID processes (including the runner or sibling agents) because Landlock ABI 6 signal scoping was not requested. Mitigated (Track B): Linux Landlock ruleset requests LANDLOCK_SCOPE_SIGNAL (alongside LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET) with exact ABI-aware struct sizing when Landlock ABI >= 6, preserving ABI < 6 compatibility.
P3 Medium plugins/agent/native/trt_tools.h; ADR-0118 On platforms other than Linux/macOS (#else), shared tool servers spawned via plain posix_spawn with no filesystem or network confinement, unlike all other sandboxed spawns which fail closed. Mitigated (Track B): Replaced the #else unconfined posix_spawn fallback in trt_tools_spawn with fail-closed EACCES, matching trt_proc_spawn.h and sandbox_launcher.rs.
P4 Low plugins/agent/native/trt_agent.h, plugins/cli/native/trt_proc_run.h, crates/tenon-compiler/src/cgen/secret.rs Secret redaction was best-effort: secret buffers were not zeroed on free, and unsandboxed Process.run inherited raw environ containing secret env vars. Mitigated (Track B, defense-in-depth): Added volatile zero-wipe on cleanup/free in trt_agent.h and default scrubbing of registered secret env keys in unsandboxed Process.run (trt_proc_run.h). Substring-only stdout/stderr redaction remains best-effort by design.
P5 Low plugins/cli/native/trt_proc_plugin.h Hashing and fexecve-ing the same descriptor closed path-swap races, but a same-user writer with write access to the inode could still modify bytes between hash and exec. Mitigated (Track B): Linux copies the plugin binary into a memfd_create(MFD_CLOEXEC|MFD_ALLOW_SEALING) descriptor, applies F_SEAL_WRITE|F_SEAL_SHRINK|F_SEAL_GROW|F_SEAL_SEAL, hashes the sealed fd, and executes via fexecve; macOS executes a 0500 private snapshot.
P6 Low plugins/cli/native/trt_io_cap.h, plugins/cli/native/trt_io_fs.h Fs capability checks relied on realpath + prefix check; trt_cap_fs_resolve lacked the defensive cap.denied guard present in trt_cap_fs_resolve_lstat, and symlink-following opens remained possible unless no_follow() was enabled. Hardened (Track B): Added defensive if (cap.denied) return cap.denied; guard to trt_cap_fs_resolve and Fs.no_follow() enforcement for symlink-free capability roots. Same-user concurrent TOCTOU remains outside D6's capability-discipline threat model.
P7 Low crates/tenon-compiler/src/packages/git.rs GIT_ALLOW_PROTOCOL=https:ssh:file allowed transitive dependency manifests to clone arbitrary local git repositories readable by the user into .tenon/deps. Mitigated (Track B): Restricted file in GIT_ALLOW_PROTOCOL in packages/git.rs to root packages or explicit --dev usage; transitive dependencies are restricted to https:ssh.
P8 Low runtime/trt_map.h Default map hash seed 0 (ADR-0053) is deterministic, allowing attacker-chosen string keys to induce hash collisions on hostile inputs. Mitigated (Track B, opt-in): Added opt-in TRT_MAP_RANDOM_SEED initialized once via getrandom (Linux) / arc4random_buf (macOS/BSD) before first pthread; default seed remains 0 for determinism per ADR-0053.
P9 Low (reliability) crates/tenon-compiler/src/packages/git.rs Re-acquiring a dependency tree renamed the old tree away before moving the new one into place, causing concurrent offline builds in that window to fail with E0936. Mitigated (Track B): Serialized and locked atomic dependency swap in packages/git.rs so concurrent offline builds no longer observe missing dependency trees during re-acquisition.

Reviewed, no defect found

Pre-existing flaky tests and compiler warnings (initial review)