Skip to content
agentsessions

Security posture

What agentsessions protects, what it does not, and how to deploy it accordingly.

This is the operator’s view. For reporting a vulnerability, see SECURITY.md.

agentsessions protects the integrity of the record. It does not protect access to the system.

Everything below follows from that split. The project makes strong, testable claims about what a session log says and whether it can be trusted. It makes no claims at all about who is allowed to reach the reference daemon, which does not check caller authority. Custom Go hosts can opt into per-RPC checks, but complete required-mode deployment is not available (below).

These are enforced in code and exercised by the conformance suite.

The log is tamper-evident. Every record is hash-chained over a canonical form (RFC 8785 JCS over proto3-JSON), so altering or reordering a record, or removing one that is not at the end, breaks verification. Truncating the tail, or replacing the whole log, leaves a chain that verifies; detecting it needs an external anchor such as a recorded head hash. The canonicalization is language-neutral by design: hack/verify_chain.py is an independent Python implementation that reproduces the Go hashes, so an auditor does not have to trust the Go binary that wrote the journal. The host checks the chain itself before it uses a journal: Exec, reconstruction, recovery and Fork refuse a journal that fails verification (DATA_LOSS) before running the harness, calling a model or tool, or appending, and Fork before checkpointing the parent or provisioning a child, so a record changed in storage is not served, extended or copied.

A superseded writer cannot corrupt a session. Each incarnation holds a fencing token, and the log rejects an append carrying a stale one. A process that was presumed dead and then wakes up cannot write. Combined with a compare-and-swap on append, that is what makes “single writer” enforceable rather than aspirational.

Replay does not re-execute side effects. Reconstructing a session serves recorded model results from the journal and never calls a provider, so replaying someone’s session cannot spend their budget or trigger a new external action. This holds for a mediated harness; an unmediated one cannot be reconstructed (below).

Payloads stay out of the logs. Operational logging records structure — session ids, counts, outcomes — and never message contents, event payloads, or fence values.

Model credentials stay out of argv. agentsessionsd reads the model key from the environment and never accepts it as a flag, so it does not appear in the process list or shell history.

A model key is not sent over plain http, except to loopback or a trusted service name. With a key set, agentsessionsd refuses to start when -model-base-url is http to a host other than a loopback address, localhost, or a name ending in .svc or .svc.cluster.local. The service-name allowance is a trusted-network exception, not a guarantee: it checks the name only, nothing proves the name resolves to a cluster service, and the key and prompts cross the pod network unencrypted. Use https unless you trust that network. With HTTP_PROXY set, Go sends a plain-http request to a .svc name through that proxy, key and prompts included, and the proxy is usually outside the network you trusted; loopback and localhost are never proxied. Add .svc,.svc.cluster.local to NO_PROXY (a leading dot matches every name under it).

Model credentials belong in a header, not the URL. agentsessionsd logs only the model ID at startup, not the provider endpoint. Endpoint URLs can still appear in process arguments and deployment configuration. Do not put a key, signature or token in the query of -model-base-url or -model-path: set the key in MODEL_API_KEY and name its header with -model-auth-header.

The reference daemon has no authentication. Its gRPC listeners use plaintext transport with no credentials. Any process that can reach the port can call every RPC. Optional Go authentication interceptors are available for custom hosts (below), but the daemon does not install them.

The default Sessions service has no authorization. Custom hosts must explicitly install WithAuthorization (below); the daemon does not. IdentityRef is metadata, not a control. Anyone who can reach the default service can discover a pending approval through Get/List and approve or deny it. By default, ApproveRequest.identity is copied to the decision’s Event.actor as caller-supplied provenance; --actor, issuer and subject flags are not credentials or permission checks. The durable gate controls event ordering and effect recovery, not who is entitled to decide.

project is not a tenancy boundary. It is an exact-match filter on listing. A caller that names another project gets that project’s sessions. Do not treat it as isolation.

There is no transport security in this repo’s own listeners. The daemon’s listeners and the runtime/local and runtime/remote harness transports are plaintext: traffic on them is readable and modifiable in flight by anything on the path. The substrate backend is the exception: it reaches harnesses through substrate’s atenet-router over mTLS (below), and the router-to-worker hop is mTLS too.

On substrate, the host reaches the router over mTLS, and any allowlisted client can drive any session’s harness. The substrate backend dials atenet-router.ate-system.svc:443, substrate v1’s default envoy router, naming the actor in an ate-target-actor: <atespace>/<actor> header (the transport). What each side checks:

  • The router checks the host. The host presents its pod’s SPIFFE certificate, issued by substrate’s pod identity signer (podidentity.podcert.ate.dev/identity) through a podCertificate volume. The router requires a certificate that chains to that signer’s CA and carries a SPIFFE ID listed exactly in its --ingress-allowed-spiffe-ids; it refuses any other client during the TLS handshake, before it reads the header or wakes an actor.
  • The host checks the router. agentsessionsd requires the router’s serving certificate to chain to the servicedns signer’s ClusterTrustBundle (servicedns.podcert.ate.dev/identity) and to carry the DNS name atenet-router.ate-system.svc (-atenet-router-server-name). It never skips verification, and it re-reads its certificate and the trust bundle on every connection, so kubelet’s rotations apply without a restart.

What is not verified:

  • The router’s identity is a DNS name, not a SPIFFE ID: its servicedns certificate carries DNS names only. The servicedns signer issues that name to any pod in ate-system that the atenet-router Service selects (substrate cmd/podcertcontroller/internal/servicednssigner). So anyone with write access to pods, Services or PodCertificateRequests in ate-system can present the router’s certificate: by creating or relabeling a pod the Service selects, by editing the Service’s selector, or by requesting a certificate for a pod it selects. Treat that access as able to impersonate the router to every host.
  • The router authorizes no caller per actor or per atespace. Any allowlisted ID reaches every actor: it can wake any actor and open a Harness.Connect stream to it (substrate’s threat model tracks this as T-04, “check client permissions before resuming actors”, not yet implemented), and the harness accepts the stream, because it does not authenticate the host either. List only the hosts that serve sessions.
  • Anyone who can create PodCertificateRequests in the host’s namespace can mint the host’s SPIFFE ID: the pod identity signer issues the ID of any ServiceAccount the request names in its namespace (substrate cmd/podcertcontroller/internal/podidentitysigner). Keep that permission out of the namespace agentsessionsd runs in.

A caller that gets through, an allowlisted client or a router impersonator, can feed a harness forged model results or tool results, read what the harness emits, and keep an actor from suspending: substrate drains open streams before it snapshots, and Placer.Suspend only refuses to overlap operations of its own Registry, so it neither sees nor ends a stream another caller holds open. The hash chain stays intact, because only the real host writes the journal, but anything the harness emits afterwards, including what the real host then records, can reflect the forged input. For a REQUIRES_MEMORY_SNAPSHOT harness the forged input lands in RAM and persists through suspend, resume and fork, so a verified chain is not evidence that its content is unpoisoned.

The supported router clients are in-cluster pods that mount a pod certificate. Clients on a laptop that port-forward the router (the agentsuite demo’s replay, driver.sh, smoke-microvm.sh and the session lifecycle UI) are not supported yet (router clients outside the cluster).

The ate.dev/api-access=true label that Substrate v1 requires on the agentsessionsd namespace (namespace access) admits every pod in that namespace except worker pods to ate-api-server at the network level. ate-api-server still authenticates and authorizes each request (as the policy’s comment in substrate manifests/ate-install/ate-system-networkpolicies.yaml notes): Substrate checks every call against the atespace’s AccessPolicy, and the daemon needs only editor in its atespace (authorization). So the label widens reachability, not permissions. Keep untrusted workloads out of a labeled namespace.

Not yet implemented: the harness does not authenticate the host. A planned fix delivers a per-session credential at actor creation and has harnessnode check it on every Connect, so a harness talks only to its own session’s host whatever the router admits. Router-side caller authorization (T-04) belongs upstream in substrate and would complement it, not replace it.

The harness is trusted code. For a mediated harness the host makes the model calls and runs the host-executed tools, which is what makes replay exact, but that is a determinism mechanism, not a containment one. An unmediated harness sends the model calls it makes itself from its own compute, where only the runtime’s egress can see them. Whatever isolation a harness has comes from the Runtime backend underneath it, and the backends differ sharply: runtime/local serves the harness inside the host process over a unix socket, so a harness there shares the host’s memory, filesystem, and credentials. A sandboxed backend is what puts a boundary there; the local one has none.

A harness registered by address is whatever answers there. runtime/remote (agentsessionsd --harness name=address) dials the operator-configured address over cleartext h2c with no authentication of either side. Sessions clients cannot supply an address; operators can configure one at startup or register one through the separate operator listener when enabled. Anything that can listen on that address, or sit on the network path to it, is the harness: it writes every event the session journals, chooses which model calls the host makes and pays for with its credential, and sees the full history the host sends each turn. The chain makes later tampering with the journal detectable; it cannot tell a forged harness from the real one. The optional operator registry can also register a remote address at runtime; unlike the startup --harness flag, this requires access to the separate operator port. Bind the harness to loopback or a unix socket on the host, or keep the hop on a network you trust entirely. For a unix socket, “can listen on that address” means “can write to the socket’s directory”, so put it in a directory only the harness’s user can write, not a shared one such as /tmp. cmd/harnessnode refuses a lock file next to its socket that is a symlink, a hard link, or owned by another user, so a hostile directory cannot redirect its writes, but it cannot stop another user who can write there from binding the socket first. The host does refuse a harness that declares REQUIRES_MEMORY_SNAPSHOT, but that is a correctness check on what the harness declares, not authentication.

That check also has a known limit. The host checks a harness’s identity, version and capabilities with a Describe call before it opens the turn’s Connect stream, and the answer is not bound to that stream. If a different harness takes over the same address between the two calls, for instance because the harness restarted, gRPC reconnected to another replica, or a proxy routed the two calls to different backends, the turn runs on that harness and the host does not detect it. Registering a harness by address assumes the operator controls what serves that address, and that every harness that can answer there declares the same identity, version and capabilities. Reconstruction replay separately checks the harness class on the exact Connect stream before sending Start; heterogeneous class routing therefore fails before Run.

Registering a harness is an admin action. A caller that can register a harness chooses what the host dials, which means where it sends every session’s history and whose model credential pays for the calls that harness makes through the host. The HarnessRegistry API therefore has no place on the Sessions port, which anyone who can reach it can call. agentsessionsd only serves it when --registry-addr is set to a literal loopback IP:port (for example 127.0.0.1:8081); wildcard, hostnames including localhost, and non-loopback IPs are refused. The listener is separate from Sessions, off by default, plaintext and unauthenticated. Sessions remains plaintext and unauthenticated too; it never serves registry RPCs. Loopback limits network reachability, not identity: any local process, including another container in the same Kubernetes pod (which shares its network namespace), can administer registrations. It is not per-user isolation. An embedder that serves the API must keep it off the Sessions listener and control access to it. A registered remote harness is whatever answers at its address, as above. HarnessSpec.descriptor_id makes the host refuse a turn when the harness there reports another descriptor id, which catches a misdirected address; the id is what the harness says about itself, so it does not authenticate the harness.

A harness is mediated or unmediated by where its model calls originate (spec §8.8). The credential invariant is the same for both classes; what differs is who upholds it and what the journal records.

  • The invariant. Where the runtime isolates the harness from the host, the value of a provider credential never enters the harness’s compute: not its environment, filesystem, memory, or a snapshot of any of them. runtime/local isolates nothing: its harness shares the host process and the host’s credentials.
  • Mediated (for example chatagent under harnessnode): the harness asks the host for each model call through EventSink.Model. The host makes the call with the key from its own environment and journals it, so the host keeps the key out, sees and records every call, and applies the model policy when one is configured. The policy restricts which models are called; the reference host enforces no call, token, or cost budget.
  • Unmediated (an agent CLI that calls its provider itself, such as Claude Code): model calls it makes itself leave its compute through the runtime’s egress. The harness holds only a placeholder key, which the egress replaces with the real credential on the way out. The egress, not the host, keeps the key out, and the host cannot check that it does. An unmediated harness declares HarnessClassUnmediated and REQUIRES_MEMORY_SNAPSHOT, so reconstruction replay refuses it and placement runs it only on memory-snapshot compute. These are trusted declarations, not proof of where calls originate; the host does reject the contradictory explicit declaration UNMEDIATED + STATELESS_REPLAY. A call it still makes through EventSink.Model is handled as for a mediated harness.

What an unmediated harness gives up for the calls it makes itself, and an operator accepts by running one:

  • Spend is not bounded by the host. The value stays out of the harness, but its use does not: every request the harness sends through the egress is authenticated. The host never sees these calls, so its model policy does not apply and it has no place to add a budget; only the harness, the egress policy and the provider account bound spend.
  • No model-call audit. The journal holds no MODEL_CALL for these calls, only the output and usage the harness reports. A verified chain proves the record was not altered after writing, not that a report matches what the provider returned.
  • No replay. Reconstructing an unmediated execution would call the provider again, so the replay guarantee above does not apply. The reference controller refuses an explicitly unmediated harness before reconstruction runs it; raw journal replay remains safe. A turn interrupted by losing the harness’s memory fails, and the user re-prompts; once the compute is gone, that means a new session (spec EXE-43).
  • The egress sees session content. It must read the request to inject the credential, so it is trusted with prompts and outputs as well as the key.

Not yet verified end to end: that a runtime egress enforces an installed policy and injects the credential over a placeholder (request header, retries, TLS trust in the actor), and that no actor snapshot holds the value. On Substrate v1.0.0, that the policy governs the first request and requests after a suspend and resume follows from its source (spec §17). See the open question in spec §17.

The egress policy is runtime configuration: which hosts and ports the harness’s compute may reach, and which credential the egress injects on a matching request. The journal does not record it. On substrate, substrate.WithEgressPolicy or the daemon’s -substrate-egress-policy-file sets the Substrate EgressPolicy of each session’s actor before every backend resume of a suspended actor, so while the option is set, the backend resumes an actor only once its stored policy matches the configuration. Substrate enforces a stored policy through its policy caches (about 10 seconds for requests and new connections, 5 seconds for DNS on v1.0.0), so requests a resumed actor makes soon after a change can still be judged by the policy cached before its suspend. Without the option, or with the flag empty, the backend makes no egress call, and an existing actor resumes with whatever policy it has stored. An actor already running when the backend reaches it, or woken by the Substrate router, keeps its stored policy until it is suspended and the backend resumes it, or until substrate.Backend.SyncEgressPolicy applies the change. The policy holds credential references (ate-secret://...) or an actor JWT audience, never a credential value. The backend’s install log records the rule count, the outcome and an error_kind, not the rules. A policy Substrate refuses as invalid reaches callers as fixed text (FAILED_PRECONDITION, COMPUTE_CONFIG_INVALID), without Substrate’s message, which can name a rejected hostname or credential reference. A policy call Substrate refuses because another operation holds the actor, and an Exec refused because the actor was replaced while its policy was converged or it was resumed, are ABORTED with COMPUTE_BUSY and leave Substrate’s message out as well. An error the WithEgressPolicy function returns keeps its code (from the sentinel it wraps) but never its text, which only names the session (and says busy for a busy one): the function’s own message can name a credential reference. Other install failures keep the backend error’s text, which reaches callers when authorization is off. A daemon startup error for a policy file that does not parse can quote the offending JSON token; it goes only to the operator.

  • Fail closed. A configured policy that the control client cannot install, or that Substrate refuses, fails the call and leaves the actor suspended. With the option set, a control client that cannot read and update policies fails every resume of an existing actor and every Sync, even when the function returns no policy, since only a read finds a stored policy and only an update clears it. An actor without a policy is deny-all.
  • Changes reach existing actors at their next backend resume. The backend reads the stored policy and replaces it when it differs from the configured one, under the stored version, so a tightened policy is stored before the backend next resumes each existing session, and its traffic follows within Substrate’s policy caches. An actor the Substrate router wakes for a routed request is resumed without the backend, so it keeps its stored policy, and the backend then finds it running. A policy that no longer configures any rule is cleared to an empty rule set (deny-all), never deleted.
  • The configuration is authoritative, if the backend is the only policy writer. A policy edited in Substrate by anyone else is overwritten at the actor’s next backend resume while the option is set. A stored policy the control client cannot read is refused, not overwritten. The backend’s preconditions order its own converges and Syncs, not other writers: a policy another identity stores between a converge and ResumeActor, or on a running actor, is enforced until the actor’s next converge. Keep the backend’s identity the only writer of egress policies in its atespace. Substrate v1 policy calls name the actor, not its UID, so a fork whose clone is replaced, before its policy is created, by an actor with no policy creates the child’s policy on that actor and resumes it; the fork then fails ABORTED and leaves it running. A clone that already has a policy is refused without a write.
  • Running compute changes only on a Sync. An actor already running when the backend reaches it keeps whatever policy it has, or stays deny-all without one, until it is suspended and resumed. substrate.Backend.SyncEgressPolicy applies a changed policy to a running actor. Change the configuration, then call it: a Sync always writes, so a converge that read the stored policy before it cannot undo it. Its effect on traffic is bounded by the same policy caches, and an open TLS passthrough connection is not cut. The daemon does not call it.
  • Removing the option does not revoke. Without the option, or with the daemon’s flag empty, each stored policy stays in force on its actor. To revoke, keep the option with a function that returns no policy, or restart the daemon with a file holding {} (no rules): each stored policy is then cleared to an empty rule set (deny-all) at the actor’s next backend resume. Until then a running actor, and one the Substrate router wakes, keeps its rules, as above; a host clears a running actor with a Sync, which the daemon does not call.

See Actor egress policy for the install points and the comparison.

Any caller that can reach the default Sessions service can permanently tombstone a known UID: Delete has no additional authorization unless the host installs WithAuthorization. PENDING acknowledges durable intent only. The SQLite allocation-attempt ledger is incomplete, not authoritative cleanup inventory. Until #88 provides authoritative cleanup inventory and reclamation, actors, snapshots and fork-child pins remain retained indefinitely; Delete does not call Stop, reclaim resources or stop an actor’s independent external activity. The retained metadata and journal are audit evidence, not a complete inventory of resources to clean up.

UID, metadata and journal remain forever and are available through Get and raw Replay even when List hides them. Deletion is neither data erasure nor access revocation; it does not cascade to children. Do not store secrets expecting deletion to remove them. Exec, historical Fork, Resume, Suspend and Approve (including exact retries) are refused for the tombstone, but the same-Registry admission guard does not fence another host’s compute provisioning before its first durable fence. Keep runtime-side reconciliation separate and scoped to provable ownership. See deletion semantics.

REQUIRES_APPROVAL is supported for STATELESS_REPLAY and REQUIRES_MEMORY_SNAPSHOT harnesses. The RPC/SDK commits a decision without compute or an executor call; explicit Resume performs recovery. CLI approve/deny do both, and a recovery failure leaves the decision committed. The default Sessions service has no caller enforcement; custom hosts can require an independent approve permission (below). Sessions ships no tool/resource policy evaluator, approval timeout, expiry, automatic decision or implemented Cancel path; a custom host can supply its own check through the pre-dispatch tool policy hook. Unresolved requests and suspended snapshots/handles are retained indefinitely; operators must manage retained resources outside these APIs.

A custom host executor must authorize tools/resources itself and durably deduplicate by session UID plus idempotency key, storing the original receipt across host restarts. Resume re-drives an interrupted ordinary call only for tools declared with placement.WithDurableDedup; a false declaration is an effect that can repeat. A hash-chained request or decision alone does not make delivery exactly once. Two sessions using the same harness-chosen key are distinct namespaces. The stock daemon can optionally configure Unix-socket executors for CLI -harness entries, dispatching only tools that declare safe durable dedup. Keep sockets in private directories with restricted permissions, and credentials in the executor, not config. Read-only or naturally idempotent tools may declare true when repeating them is harmless. An approved gate without an executor stays recoverable and fails Resume with FAILED_PRECONDITION; denial requires no executor and records a denied receipt. Configured executor errors instead become durable EXECUTOR_ERROR receipts: the effect may have committed before the response was lost, and recovery does not retry a receipted failure. Neither path prevents a trusted harness from doing unmediated work outside the sink.

CloseApproval ends a gate the harness can no longer re-issue, so the session can take a new turn. It writes host records only and calls no executor, policy hook, harness or runtime. An undecided gate gets a host denial (reason “approval closed”) and a NOT_EXECUTED receipt; a denied gate gets NOT_EXECUTED; an approved gate without a receipt gets OUTCOME_UNKNOWN, because the journal cannot prove the executor never ran. A close revokes the approval for later recovery, but it cannot stop a call another host already dispatched; that host’s receipt append then fails its fence. A gate that already has a receipt is returned unchanged. Only the host writes the two codes: a harness report or ordinary executor result carrying one is rejected without a receipt, and an approved call’s executor result carrying one is recorded as EXECUTOR_ERROR. Closing can only stop an effect, never grant one, so it uses its own approval.close action rather than approve (below). The journal attributes a close only partly: the undecided case’s denial carries the verified approver when the caller was authenticated, but a denied or approved gate’s close writes only a TOOL_RESULT, which has no identity field, so the journal does not record who closed it. The fixed reason marks a host close, but an Approve denial that supplies the same reason looks the same. A host that needs attribution keeps it in its own ledger. See spec §10.5.

NOT_EXECUTED and OUTCOME_UNKNOWN need no SQLite schema change. A build without them that already opens this release’s journal (an unreleased schema v9 build) still serves every session without a close. For a session holding a close receipt, its hash-chain verification fails: VerifyJournal and its controller Exec, Resume and controller.Replay refuse the session (DATA_LOSS), its Exec and Resume RPCs fail INTERNAL with a replay divergence, and its Sessions.Replay RPC streams the record unverified with the code as the number 4 or 5. An older harness rejects the receipt. Upgrade every host sharing a journal and every harness before calling CloseApproval. See §18.

A custom Go host can install placement.WithToolPolicy (or controller.WithToolPolicy) to check a host-executed call right before its executor runs: an ordinary CONTROLLER_MEDIATED call, including one Resume re-drives, and an approved REQUIRES_APPROVAL call on recovery. The hook receives the session UID, execution ID, a copy of the call rebuilt from its journaled form (so the hook cannot change what runs), the verified caller of the Exec or Resume that dispatches it (empty when authentication is off), and the committed decision for an approved call, including its verified approver when the host recorded one. It does not receive the decision’s request actor, which is caller-supplied. Sessions defines no policy language and the stock daemon installs no hook.

A call whose journaled form differs from the arguments the executor receives is refused transiently before the hook, so the hook never judges one value while the executor receives another: the integer 2^53+1 that the journal’s float64 numbers round, a json.Number such as 0.30000000000000001 that the journal records as 0.3, a float32 such as 1e20 whose JSON text reads as a different float64, or a string that is not valid UTF-8. An argument the guard cannot compare is refused the same way: a Go struct that encoding/json writes field by field, or a value or non-string map key whose type has a MarshalJSON or MarshalText method, such as time.Time, since the journal holds only that method’s output while the executor receives the Go value. Below 2^53 in magnitude, a hook compares a float64 argument as its JSON value, the shortest decimal that reads back as that float (strconv.FormatFloat(f, 'g', -1, 64)), not as its exact binary expansion. At or above 2^53 every float64 is an integer and the host dispatches only an argument with exactly that value, so the hook reads it exactly: 2^60 is 1152921504606846976, not the 1152921504606847000 its shortest text gives.

The hook returns one of three verdicts. Allow runs the executor as before. A transient refusal (a credential refresh failed, a provider is down) runs nothing and writes no receipt: on an approved call Resume fails with FAILED_PRECONDITION, the decision stays recoverable and the next Resume asks again; on an ordinary call the error reaches the harness like an executor error. A definitive refusal (a grant was revoked, policy says no) runs nothing and records a POLICY_DENIED receipt, which the harness receives as the tool’s result and which recovery and replay serve without asking again. An unset or unknown verdict is a transient refusal. Keep secrets out of the refusal reason: a definitive reason is journaled in the receipt’s error and sent to the harness, and a transient reason is returned to the harness and the caller and, when it ends an ordinary call’s turn, journaled in the ERROR record. Replay and recorded receipts never call the hook. Only the hook writes POLICY_DENIED: an executor result carrying it is rejected without a receipt, and on an approved call Resume fails with FAILED_PRECONDITION and the decision stays recoverable.

POLICY_DENIED is a new receipt code that needs no SQLite schema change of its own. A binary built before it refuses this release’s journal at open (schema v8, which marks the verified approver), but one that already had the journal open still serves it. For a session that holds a POLICY_DENIED receipt, that binary’s hash-chain verification fails (DATA_LOSS) and its Exec, Resume, VerifyJournal and controller.Replay refuse the session. Its Sessions.Replay RPC does not verify and streams the record with the code as the number 3. An older harness rejects the receipt, so upgrade every host sharing a journal and every harness before installing a hook that can refuse definitively. See spec §9.4 and §18.

For a local host with a remote harness, run the daemon with a real model and listen only on loopback (the operator port is optional; Sessions still uses its existing -addr setting):

Terminal window
MODEL_API_KEY=... agentsessionsd -addr 127.0.0.1:8080 -registry-addr 127.0.0.1:8081 \
-journal agentsessions.db -model your-model -model-base-url https://trusted-model.example/v1
agentctl harness register --server 127.0.0.1:8081 --name mine --spec spec.json
agentctl harness get --server 127.0.0.1:8081 --name mine --observe
agentctl harness list --server 127.0.0.1:8081 --include-retired --page-size 50
agentctl harness retire --server 127.0.0.1:8081 --name mine --reason maintenance

spec.json is a strict proto-JSON HarnessSpec, for example {"remote":{"address":"127.0.0.1:9000"},"capabilities":{"resumability":"RESUMABILITY_STATELESS_REPLAY"},"descriptor_id":"echo"}. Both new and stored remote registrations need -model (and a model key when that endpoint requires one), so model calls cannot silently use the built-in echo stub. Without -model, stored remote registrations load as unservable and their existing sessions fail FAILED_PRECONDITION, whether active or retired, even with the operator listener off. Static inspection, listing and retirement do not require -model. This reference daemon does not serve substrate placements. Registry responses print proto-JSON, including spec_digest and lifecycle state.

The checked-in Kubernetes manifest pins v0.4.0, which supports -registry-addr but leaves it off: add -registry-addr 127.0.0.1:8081 to its args first. The manifest does not expose the operator port through a Service. With the listener enabled, an operator with pods/portforward RBAC may open a local tunnel, then use the CLI against its local endpoint:

Terminal window
kubectl -n agentsessions port-forward --address 127.0.0.1 deployment/agentsessionsd 18081:8081
# In another terminal:
agentctl harness list --server 127.0.0.1:18081 --include-retired

Explicitly bind kubectl’s local endpoint to 127.0.0.1 with --address, not 0.0.0.0. Grant pods/portforward and pods/exec narrowly: exec access also reaches the pod’s loopback. Port-forward RBAC controls who can open a tunnel, not authorization for processes already inside the pod. Do not expose the registry through a Kubernetes Service or Ingress. The daemon’s operator port has no independent token or TLS. #127 tracks covering it with the same verifier and authorizer as Sessions, using a separate operator role. Until then it stays loopback-only and off by default. Anyone who can reach this port can change destinations for session history and spend the host’s model budget.

Given the above, there is one safe shape for this release:

  • Run it on loopback, or on a network segment you already trust entirely.
  • Treat every host as single-tenant. One project per host if you need separation.
  • Do not put it behind a public ingress, even an authenticated one, unless that proxy is doing all of the authentication and authorization and nothing else can reach the port.
  • Keep the journal file’s permissions tight. It holds full conversation contents and opaque execution config in the clear, and anyone who can read it can read every session. Do not put credentials in execution config; operational logging omits it, but the durable journal and Replay API expose it.
  • Anyone who can write the journal can rewrite history. The chain makes that detectable, not impossible: verification tells you the log was altered, it does not prevent the alteration. The chain is also unkeyed, so a writer that recomputes every hash after an edit, or removes records from the end, passes verification, including the host’s own check before it uses a journal. Journal write access is also as powerful as registry access: the daemon loads stored remote addresses even with the operator listener off and dials them when observing or placing sessions, so a writer can choose where session history goes and whose calls spend the host’s model budget.

Host-side ownership and authorization contracts

Section titled “Host-side ownership and authorization contracts”

api.CallerIdentity is an exact verified caller issuer/subject pair, separate from agent IdentityRef provenance. Trusted Go hosts can atomically create an owned session through sqlitelog.Store.CreateOwnedSession, including active-harness admission. Existing UIDs cannot be claimed, even when unbound or deleted. Metadata updates, fencing and appended/copied history do not assign or replace owners. Legacy sessions and sessions created by unenforced RPCs remain unbound; ownership is not inferred from provenance. Unbound sessions are denied by OwnerAuthorizer, not treated as public. Owner metadata is not hash-chain attested; database writers are trusted.

The host-side api.Authorizer contract has an owner-only implementation. OwnerAuthorizer grants only ordinary session actions to an exact owner; create, approval decisions, audience minting and unknown actions are denied. It does not verify credentials. ActionFork authorizes the parent only, not child ownership. The current fork path creates unbound child rows before metadata publication; CreateOwnedSession cannot claim them afterward. Enforcing hosts must not expose owned forks until a separate primitive reserves verified child ownership before fencing or copying logs, with publication and failure cleanup defined. This must preserve fork admission for existing sessions on retired harnesses; ordinary create admission is not a substitute. This is a prerequisite for enforcement (#127).

ListOptions.Owner filters an exact pair in SQL before paging; enforcing callers must always set it, since nil retains the full project listing. Its unsigned cursors are not caller-bound credentials.

The daemon does not install these contracts. Custom hosts can opt into the RPC checks below, but that is not a deployable required mode. SQLite schema v5 carries an off-mode authorization marker; this host refuses required, unknown or missing markers even at the same schema version. There is no supported switch to enable required mode. The marker is checked only at Open. Changing it requires stopping every writer, including embedded CLI processes, then restarting all hosts with binaries that support the new mode; already-open hosts do not recheck it. Owner identifiers are retained metadata: deletion is not erasure. Do not expose a host on an untrusted network.

Custom hosts can pass session.WithAuthorization(policy) to NewService and session.WithRegistryAuthorization(policy) to NewHarnessRegistry. Each option requires a verified authn.Caller(ctx) even for direct handler calls: missing caller returns UNAUTHENTICATED before request validation. A nil policy fails closed with INTERNAL, not back to off. Constructors without these options retain trusted-network behavior, even if authentication interceptors are installed.

Checks precede runtime IO, fences, stream frames and approval repair. Each Go api.AuthorizationRequest.Method carries the full originating RPC path, for example /agentsessions.v1.Sessions/Exec or /agentsessions.v1.HarnessRegistry/GetHarness, including for direct handler calls. Compound, recovery and global checks retain that originating path: inputless Exec approval recovery checks resume with the Exec method, not the Resume method. Method is a Go SPI field, not a protobuf message or wire field.

RPC Required actions
GetSession, Replay read
Exec exec; also resume when inputless Exec enters approval-recovery Resume
CreateSession global create
Exec with no session global create, then exec on the prospective owned UID, before insert
Suspend suspend
Resume resume and exec
DeleteSession delete
Approve read and independently approve
CloseApproval read and independently approval.close
Cancel cancel, then UNIMPLEMENTED
Fork fork on parent and global create, then FAILED_PRECONDITION (owned publication unavailable)
ListSessions global list, then exact verified-owner SQL filtering before keyset pagination
GetHarness (including observe), ListHarnesses, RegisterHarness, RetireHarness global registry.read, registry.list, registry.register, registry.retire, respectively
CreateHarness global registry.register

Ordinary Exec can restore suspended compute with exec alone; only inputless approval recovery adds resume. The Resume RPC always requires both resume and exec, even for a no-op.

Global actions use empty UID/owner. Create and auto-create insert the verified caller as immutable owner; they never claim existing rows. The service passes stored owners, not request provenance, to the policy. Existing unbound rows reach custom policies with a zero Owner; OwnerAuthorizer denies them, but a custom policy can allow them. Unknown UIDs and policy refusals return the same generic PERMISSION_DENIED once the deletion probe permits lookup. Only errors.Is(err, api.ErrPermissionDenied) is a policy denial; unexpected policy/store failures and enforced RPC INTERNAL diagnostics are sanitized; an INTERNAL Exec or Resume failure that left compute running keeps only its fixed RT-7 report after internal error. Caller cancellation and deadlines retain their codes. Policies own their failure logs and metrics; the service never logs raw policy causes. In enforced mode only, INTERNAL diagnostics include request_id, method, error_kind and a stable error_category. Known trusted host/store errors log the full cause with category host. Model/provider/harness and other unknown-origin errors never log message text: category is execution for Exec/Resume, runtime for Suspend/Fork, or external for other methods. Unknown mixed execution/runtime phases fail closed; a store fault deep inside runtime is not trusted unless known at the service storage boundary. There is no heuristic redaction. Request metadata, credentials and session payloads remain excluded; trusted/off behavior is unchanged. This is a diagnostic-only exception to the operational log data policy, not permission to put sensitive data in errors. Custom policies own any additional sharing rules; listing remains owner-only, not a list of arbitrary grants.

Mutation owner lookups for Exec, Suspend, Resume, Fork, Approve, CloseApproval and DeleteSession first probe shared deletion admission after authentication. The probe acquires and immediately releases admission before owner SQL or policy evaluation; it never leases SQL. An exclusive Delete already in progress at the probe returns ABORTED before lookup or policy, even for a verified non-owner who knows the UID. This narrow disclosure grants no access. The tiny shared probe can also race an owner’s Delete, briefly returning ABORTED to Delete; this is not an owner-query SQL hold. The probe can race a later Delete; the mutation’s later guards remain authoritative. An owner query, including one later denied by policy, holds no admission while waiting for SQL and cannot keep Delete out that way. Outside probe contention, inaccessible sessions return PERMISSION_DENIED. GetSession and Replay remain unguarded audit reads; Cancel is unchanged.

api.OwnerAllowlistAuthorizer delegates ordinary session actions to OwnerAuthorizer and adds explicit exact issuer/subject allowlists via Allow map[api.Action][]api.CallerIdentity for create, list, approve and registry actions. Unknown actions and mint stay denied even if allowlisted. An owner alone cannot approve: this policy requires an owner who is also on the approve allowlist. A separate non-owner approver needs a custom read policy. Configure policies before serving; do not mutate their allowlists concurrently.

approval.close is an ordinary owner action: OwnerAuthorizer allows it for the owner, and OwnerAllowlistAuthorizer delegates it unchanged, so an owner who cannot approve can still deny an undecided gate or revoke an approval that has no receipt. Neither policy lets a non-owner close, and approve does not imply approval.close. Because the caller must be the owner, a close of an undecided gate under either policy journals the owner as verified_approver. A host that wants only approvers to close needs a custom policy.

Enforced Approve ignores request identity and clears the actor before decision/retry comparison. Historical decisions with a nonempty actor are not identical retries after this normalization. Whenever the authentication interceptors verified the caller, with or without authorization, Approve journals that exact issuer/subject as ApprovalResult.verified_approver. No request field or forwarded header can set it. An exact retry must come from the same verified approver: the same decision from another caller, an authenticated retry of a decision recorded without an approver, and an unauthenticated retry of one recorded with an approver are all FAILED_PRECONDITION. The approver is covered by the hash chain and visible to anyone who can read the session’s journal through Replay. It is not sent to harnesses: the host clears it in the live decision, the receipt’s decision and every earlier decision in Start.History. A pre-dispatch tool policy hook, which is host code, receives it with the committed decision. Role, grants and policy version are not journaled; a host that needs them keeps them in its own ledger keyed to the decision. Journal schema v8 marks journals that can hold the field; see spec §18.

This is not cross-host isolation or supported required-mode activation. Journals remain marked off, so unenforced hosts and CLI processes can still read/write owned sessions, create unbound rows, and bypass these checks. Do not share an enforcement test journal with them. Owned Fork remains refused before discovery or effects until ownership can be reserved before the first copied record. Complete activation also needs an immutable journal policy marker and startup validation, a daemon required switch, and TLS assembly with server identity validation (#127). Registry stays on its separate, opt-in loopback listener; there is no same-pod/self-dial exemption or implicit credential forwarding.

Custom hosts can install both interceptors returned by authn.NewInterceptors on a gRPC server. Install them before any interceptor that discloses data or performs effects. A panic-recovery interceptor may wrap them; grpc-go does not recover verifier panics. authn.Required requires a CallerVerifier; authn.Off skips verification and installs no caller. The verifier reads incoming metadata or verified TLS peer information and returns only an exact issuer/subject pair and a future credential expiry, never credentials. Adapters must reject missing, malformed, duplicate and expired credentials, validate signatures, exact allowed issuers, per-issuer audiences and explicit claim mappings. Do not discover trust from untrusted issuer URLs. Adapters also own failure logging and metrics, without credential material. The interceptors sanitize verifier errors on the wire and do not log or count them. No credential format or production verifier is bundled.

The interceptors validate identity/expiry and return generic UNAUTHENTICATED on verification failure, without anonymous fallback or method exemptions. Health and reflection on the same server also require credentials; kubelet gRPC probes cannot send them. Hosts should serve health and reflection on a separate server/listener, with appropriate network access restrictions. authn.Caller(ctx) exposes the verified pair; request identity and forwarded headers do not establish it. Unary calls authenticate once at admission: credential expiry does not add a handler deadline, end the call, or remove its verified caller. The caller’s own cancellation/deadline still applies, but the interceptor preserves the handler’s returned result and status. Only streams get the earlier caller deadline or verified expiry; expiry reports UNAUTHENTICATED, while caller cancellation/deadlines retain their codes. Stream expiry overrides even a successful handler return; effects may already have completed. Handlers must cooperate with cancellation. There is no in-stream refresh, interruption of transport I/O already in progress, or rollback of an in-flight effect. If expiry interrupts a running Exec harness and it returns an error, the controller journals a best-effort ERROR, unless stopped after an approval intent. Retrying Exec with inputs and a fresh credential starts a new turn, rather than automatically continuing the interrupted one; pending approvals still follow the recovery rules in spec §11.4 (OPS-14). An ERROR does not prevent later Resume recovery. Expiry before the harness runs need not journal an ERROR. Verification runs once per RPC: revocation before ValidUntil is not noticed by an admitted unary call or an open stream.

Authentication alone is not isolation. Hosts still need authorization before disclosure/effects, TLS with server identity validation, and a compatible journal policy. None is assembled by these interceptors; the reference daemon has no required-mode switch. This does not secure the harness, router or model endpoints.