On this page

0099: Process plugins: exec_hash pinning, --dev PATH, one-shot codec framing

Status: Accepted (default; pending owner confirmation)

Amends ADR-0072.

Context

Trusted compiled-in natives do not support independently packaged executable extensions. Process plugins provide that boundary, but the executable must be pinned to the fetched package and run under the process sandbox.

Decision

A process plugin declares [plugin] kind = "process" and process metadata: an executable path within the package, max_output (default 16 MiB), timeout_ms (default 10,000), filesystem access of none or read-only package, and net = false. Fetch records an additive exec_hash = "sha256:<hex>" lock key for the executable for every source kind, including path dependencies. This is an intentional exception to ADR-0072's unhashed path sources; lock_version remains 1.

At runtime, open the executable read-only with close-on-exec and validate its resolved source path against the canonical package root. The package root is a validation witness even when filesystem access is none; it is not itself a sandbox grant. On Linux, hash the opened descriptor, compare it with the lock, and execute that descriptor with fexecve.

Darwin cannot execute the verified descriptor. For a locked plugin, copy the opened, contained executable into a private 0700 temporary directory, make the image read-only, hash the copied image against exec_hash, and execute that exact snapshot pathname under deny-default Seatbelt. The profile grants the snapshot executable as a literal file, not its containing directory. For fs = "package", the canonical package root receives its declared read-only grant; for fs = "none", no package-root read grant is emitted. Snapshot creation, verification, launch, and execution share the plugin's one deadline. The parent closes the snapshot descriptor and removes the image and directory on completion or failure, including late replies after bounded process-group cleanup. Optional toolchain subpaths are not added to this exact-file profile. This protects against path replacement between verification and execution; the private directory is not a boundary against another process with the same host identity.

The Darwin executable name retains the source basename, but argv[0] names the staged snapshot path. Mach-O dependencies resolved through @executable_path or @loader_path can therefore behave differently after relocation; plugins that depend on package-relative dynamic libraries are not covered by the snapshot contract. Support is intended for standalone or system-linked images; some relocated Apple platform binaries may also be rejected by the operating system. Shebang scripts are rejected with guidance to ship a binary.

Each call starts one process: request bytes are stdin through EOF, response bytes are stdout through EOF, and exit status zero is required. Request and response types use the codec plugin's derive Binary schema. call_plugin names a locked process-plugin dependency with a string literal. A slash-free command found on PATH is allowed only with --dev, is unhashed, and emits W0995; without --dev it is rejected. Darwin's PATH-based development command remains an explicit unpinned path and does not gain the locked snapshot guarantee.

Alternatives considered

Consequences

Process plugins are one-shot, bounded, sandboxed executable dependencies. Changing a command after fetch invalidates its pin. Linux retains descriptor execution; Darwin uses a private verified snapshot with the relocation limits above. Older toolchains may reject the additive lock key. PATH-based development commands are explicitly unreproducible and cannot be used without --dev.