Execution isolation and provenance
Tirith treats execution as a controlled local process. It first freezes the policy decision and the identity of the requested action. It then permits a trusted launch boundary to run the target and records evidence that shows what actually happened. This model keeps isolation, provenance, and trust decisions linked without storing sensitive command data in durable records.
Execution lifecycle
Decision identity
An execution draft is the short-lived identity of one launch decision. It binds the session, command digest, caller, shell, policy basis, verdict basis, approval state, warning acknowledgement, and expiry into one object. The raw command and full policy remain in memory. Durable state keeps a digest and a short redacted preview instead.
The draft is checked again against the current session generation before launch. A stale draft cannot use an earlier decision after another action has changed the session. This prevents a prompt or delayed caller from authorizing a command under old policy state.
The draft also keeps approval and warning acknowledgement separate. Each proof must match the requirement that was frozen for that exact decision. A decision becomes authorizable only when all required interaction proofs are present and the bypass facts still match the decision.
References: crates/…/execution_state.rs• L183-239 crates/…/execution_state.rs• L267-350 crates/…/execution_state.rs• L569-600 crates/…/execution_state.rs• L1815-1862
Trusted launch boundary
A trusted launch boundary is the point where Tirith has rechecked the decision and can connect it to real process execution. The boundary owns the final state check and the evidence that promotes the decision into execution history. Code outside this boundary can inspect a prepared decision but cannot create a valid execution record by supplying its own evidence identity.
The launch path uses a trusted executable identity for security-sensitive helpers. Tirith resolves the executable, checks its ownership and path, and revalidates it immediately before spawn. On Linux, callers that must survive a longer gap can bind the exact executable content before the gap. A path or executable that changes during this period is rejected.
This separation matters because analysis and execution occur at different times. A clean analysis result is not proof that the same file will run later. The trusted boundary repeats the checks that must hold at launch.
References: crates/…/execution_state.rs• L1000-1116 crates/…/execution_state.rs• L1607-1656 crates/…/trusted_child.rs• L420-521 crates/…/trusted_child.rs• L608-689 crates/…/trusted_child.rs• L722-852
Execution evidence
Tirith separates confirmed execution from an unresolved observation. Kernel execution proof and an exact gateway completion can become confirmed. A shell boundary or a gateway forward without a verified completion remains unresolved. Unresolved history can make a later policy decision more cautious, but it never becomes confirmed history without the required proof.
The lifecycle is the same across direct and gateway execution. The gateway records a forward before transport, then upgrades that same execution only when a complete success response matches the request identity. Linux direct execution uses a stopped target so the parent can record the observed boundary and authorize resumption in order.
The result is a local evidence trail rather than a claim based only on intent:
flowchart LR
A[Command and caller] --> B[Policy verdict]
B --> C[Immutable execution draft]
C --> D{Trusted boundary}
D --> E[Observed execution evidence]
E --> F[Confirmed ledger history]
E --> G[Unresolved ledger history]
G --> H[Conservative later decisions]
References: crates/…/execution_state.rs• L56-85 crates/…/execution_state.rs• L378-465 crates/…/execution_state.rs• L1126-1167 crates/…/execution_state.rs• L1196-1266 crates/…/execution_state.rs• L1710-1754
Isolation boundaries
Isolation capsules
An isolation capsule is Tirith's per-invocation OS boundary for a process that Tirith launches. It applies to live runs, gateway upstreams, package installs, and selected temporary runs. It does not turn arbitrary commands already running in a user's shell into contained processes.
A capsule describes the access the child needs. The description covers filesystem reads and writes, network use, environment variables, inherited handles, and resource limits. The platform backend reports the controls it actually achieved. Tirith compares that result with the requested coverage before launch.
The normal contract is fail closed. An enforcing surface refuses to start when the host cannot provide the requested coverage. A best-effort analysis surface may run with reduced coverage only when it marks the result as degraded. A missing backend therefore cannot look like a successful sandbox.
See Cross-platform execution capsules for the child page on capsule policy and platform behavior.
References: crates/…/mod.rs• L24-33 crates/…/mod.rs• L124-179 crates/…/mod.rs• L262-293 crates/…/mod.rs• L547-583 crates/…/mod.rs• L759-816 crates/…/capsule.rs• L19-49 docs/capsule.md• L3-25
Project copy boundary
The untrusted-project preset adds a project boundary around the capsule. It copies the requested project into a temporary directory and gives the contained child write access to that copy. The operator's working tree is not the child’s write target, so the run can measure changes without allowing direct edits to the source tree.
The copy is faithful or refused. Tirith rejects links, special files, hard-linked files, unsafe names, cross-device entries, unstable entries, and resource limits instead of silently omitting them. It takes a complete stable inventory before launch. After the child exits, it takes a bounded inventory that can report an incomplete result when the child changes the tree while it is being read.
This flow shows how the source tree becomes an isolated input and then a bounded output record:
flowchart LR
A[Requested project] --> B[Stable copy and input digest]
B --> C[Contained child]
C --> D[Output inventory]
D --> E[Bounded project diff]
E --> F[Capsule run receipt]
References: crates/…/capsule_project.rs• L149-191 crates/…/capsule_project.rs• L320-380 crates/…/capsule_project.rs• L2129-2180 crates/…/capsule_project.rs• L2201-2235 crates/…/capsule_project.rs• L2314-2334
Platform enforcement
Each supported platform maps the same capsule intent to a native boundary. Linux uses filesystem and system-call controls. macOS uses a deny-by-default system sandbox. Windows creates the process inside an AppContainer and controls its resources and path access. The common result is an honest coverage record rather than a promise that every host provides the same controls.
The child launch sequence also protects the boundary itself. The launcher applies containment before the target starts. Windows creates the child suspended and resumes it only after its container and process limits are ready. Linux applies containment in a single-threaded launcher. Any setup failure stops the launch instead of falling back to an uncontained child.
References: crates/…/mod.rs• L51-83 crates/…/capsule_child.rs• L13-39 crates/…/capsule_child.rs• L1163-1208 crates/…/capsule_windows.rs• L1-41 crates/…/capsule_windows.rs• L233-245
Network boundary
The loopback egress broker is a traffic filter, not the isolation boundary. The OS backend must first block raw outbound sockets. Only then can the broker be the sole path for a child that has an allow-listed domain policy.
For each connection, the broker checks the per-run token and the domain and port policy. It resolves the host once. It rejects private and cloud metadata addresses. It connects to the approved address without resolving again and checks TLS SNI against the requested host. Connection count, bytes, and idle time are bounded. The audit event records the decision without the token or tunnel data.
The distinction prevents a common false claim. If raw socket blocking is absent, a child can bypass the broker. In that state Tirith does not claim domain egress enforcement, and an enforcing surface refuses the allow-listed network plan.
References: crates/…/mod.rs• L35-43 crates/…/mod.rs• L210-233 crates/…/capsule_proxy.rs• L1-41 crates/…/capsule_proxy.rs• L242-314 crates/…/capsule_proxy.rs• L567-749 docs/capsule.md• L90-103
Provenance records
Execution provenance
Execution provenance is the record that connects a decision to a local execution event. Its purpose is to answer whether the command that was analyzed is the command that crossed the trusted boundary, which caller requested it, and what proof supports the claim.
The strict session ledger stores bounded, privacy-aware records. It keeps command and decision digests, evidence identity, evidence grade, session generation, and selected warning or event data. It does not persist the raw command, the full policy, credentials, or unredacted findings. Confirmed and unresolved records use separate histories so uncertainty remains visible.
The ledger is also part of the authorization boundary. Tirith protects the session state and stable lock identity, checks the generation, and publishes a new state before it releases the transition. A missing or changed state identity is a refusal condition. The ledger therefore supports both later correlation and protection against state replacement.
See Execution provenance and trust for the child page on execution state, provenance graphs, receipts, and trusted-child controls.
References: crates/…/execution_state.rs• L1-7 crates/…/execution_state.rs• L378-465 crates/…/execution_state.rs• L1909-2040 crates/…/execution_state.rs• L2043-2100
Capsule run receipts
A capsule run receipt is the durable account of one contained-project attempt. It connects the requested policy and coverage with the project input digest, the project output digest, the child result, Tirith's own termination decision, cleanup status, and a bounded diff.
The receipt keeps claims separate and testable. A child exit code does not mean that Tirith allowed a clean run, and a Tirith refusal does not become a child exit. A contained status is valid only when the requested coverage was achieved, the target reached its own exit, cleanup was confirmed, and both tree inventories were complete. Other outcomes remain partial or refused.
The receipt is content-addressed and may carry an Ed25519 signature. Tirith can also anchor its content hash in the audit chain. Durable data uses an argument digest instead of raw arguments and removes host paths from reasons, so the record can be shared without exposing local secrets or layout.
References: crates/…/capsule_receipt.rs• L71-196 crates/…/capsule_receipt.rs• L387-483 crates/…/capsule_receipt.rs• L485-598 crates/…/capsule_receipt.rs• L600-715 crates/…/capsule_receipt.rs• L718-780
Executable provenance
Executable provenance describes where a program came from and whether its current host state supports trust. The cold inspection path reports the resolved path, file type, modification time, permissions, owner facts, code-signature status where the platform supports it, and known package-manager ownership.
tirith exec check resolves a command through the current PATH and also reports other matches. It can flag a command that shadows a system copy. tirith exec provenance performs the same kind of inspection for an explicit path. A recent or world-writable executable is a high-risk signal. An invalid signature or a non-system shadow is a separate warning signal.
This inspection is evidence for an operator and for later policy work. It is not a replacement for the launch-time identity check. The file can change after inspection, so the trusted child path must revalidate the executable at the execution boundary.
References: crates/…/exec_provenance.rs• L1-18 crates/…/exec_provenance.rs• L36-102 crates/…/exec_provenance.rs• L104-180 crates/…/exec_provenance.rs• L213-245 crates/…/exec.rs• L225-333
Trust scopes
A trust scope is the local area in which an operator allows a pattern or rule exception to apply. Tirith supports user scope and repository scope. Repository trust stays with the repository. User trust applies across local work.
Trust is narrow by default. A new entry expires after a default period unless the operator chooses another duration or explicitly requests permanent trust. Broad domain and wildcard patterns require an explicit opt-in. Patterns on the blocklist cannot be trusted. Each entry keeps its pattern, optional rule, source, expiry, and reason so a later review can explain why it exists.
Trust records change policy outcomes. They do not replace executable provenance or capsule coverage. A trusted pattern cannot make an untrusted helper safe to run, and it cannot make a missing OS boundary enforce containment.
References: crates/…/trust.rs• L8-33 crates/…/trust.rs• L137-180 crates/…/trust.rs• L1055-1129 crates/…/trust.rs• L1139-1188
Change checklist
When these files or sections are changed, remember to consider these:
- Route every new process-launch surface through the capsule selection and coverage gate. Do not let an enforcing caller use a degraded policy.
- Keep the execution draft identity aligned with every input that can change the verdict, approval need, warning set, caller, or session correlation.
- Classify every new execution observation as confirmed or unresolved. Bind it to the existing execution identity instead of accepting caller-supplied proof labels.
- Keep
domain_proxy_enforceddependent on OS raw-socket blocking. A broker change alone must not increase reported network coverage. - Preserve launch-time executable revalidation when a helper is resolved before a delay, network request, or second process launch.
- Preserve separate user and repository trust stores, narrow-scope checks, blocklist checks, and expiry behavior when trust policy changes.
- Keep the untrusted-project input scan strict and stable. Do not replace a refusal with a partial copy or let an unstable tree become a contained input.
- Keep capsule receipt status tied to achieved coverage, target completion, cleanup confirmation, and complete input and output inventories. Add new receipt fields to both the content hash and validation rules.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The selected capsule backend lacks a requested capability | An enforcing launch is refused before the target starts | Compare achieved coverage with the spec's required coverage |
| The executable path, owner, permissions, or content changes after selection | The trusted helper launch is rejected | Revalidate the executable immediately before spawn or bind its content for a longer gap |
| A shell boundary or gateway forward has no terminal proof | The event remains unresolved and cannot enter confirmed history | Use evidence grades and require kernel proof or an exact gateway completion |
| The session ledger is stale, replaced, or missing its stable identity | Tirith refuses authorization or promotion | Hold the session boundary, check generation, and validate protected state identity |
| Raw sockets are not blocked while a domain broker is available | The child can bypass the broker | Claim domain proxy coverage only with OS raw-socket denial |
| A trust entry uses a broad pattern or never expires by accident | A policy exception applies to more actions or for longer than intended | Require explicit broad and permanent choices and show scope and expiry |
| The project changes during the stable input scan or contains an unsupported entry | The untrusted-project run is refused rather than based on a partial copy | Use the stable bounded inventory and refuse links, special entries, escapes, and scan changes |
| The output inventory is incomplete after the child exits | The receipt cannot claim a fully contained run | Mark the inventory incomplete and use partial status rather than contained |
| Receipt publication succeeds but its audit anchor fails | The receipt exists but is not tamper-evident | Preserve the anchor warning and do not report the receipt as anchored |
Key files
| File | Why to read it |
|---|---|
| crates/…/execution_state.rs | Defines the execution draft, strict session ledger, evidence grades, and promotion rules. |
| crates/…/trusted_child.rs | Defines executable selection, provenance checks, revalidation, and content binding for trusted helpers. |
| crates/…/mod.rs | Defines capsule intent, coverage reporting, environment isolation, and fail-closed requirements. |
| crates/…/capsule_project.rs | Defines the safe project copy, stable tree inventory, digest, and bounded diff used by the untrusted-project preset. |
| crates/…/capsule_receipt.rs | Defines capsule run outcomes, coverage claims, privacy limits, content addressing, signatures, and audit anchoring. |
| crates/…/capsule.rs | Connects callers to platform backends and applies the degraded-versus-enforcing launch policy. |
| crates/…/capsule_child.rs | Shows the internal launch boundary that applies containment before target execution. |
| crates/…/capsule_proxy.rs | Shows the broker checks and why the broker is not the OS security boundary. |
| crates/…/capsule_windows.rs | Shows the Windows process, container, resource, and cleanup boundary. |
| crates/…/exec_provenance.rs | Defines cold executable provenance collection and executable-risk findings. |
| crates/…/exec.rs | Exposes executable provenance through tirith exec check and tirith exec provenance. |
| crates/…/trust.rs | Defines scoped trust records, expiry, scope limits, and trust-store changes. |