Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed crates/openhuman-core/src/security/README.md

Steven Enamakel16806f26e109
diff --git a/crates/openhuman-core/src/security/README.md b/crates/openhuman-core/src/security/README.md
index a28e0c774f..eff4104030 100644
--- a/crates/openhuman-core/src/security/README.md
+++ b/crates/openhuman-core/src/security/README.md
@@ -1,10 +1,8 @@
# Security
-Trust boundary for the autonomous core. This is the kernel security family
-(`security/mod.rs`): `SecurityPolicy`, the approval gate, taint/redaction,
-credentials, and the keychain are exactly the set a future `Guard<D>`
-decorator draws from, and a swapped driver must never see any of it. None of
-these submodules is feature-gated — the family is kernel, permanently.
+Trust boundary for the autonomous core. `security/mod.rs` calls this the
+kernel security family: `SecurityPolicy`, the approval gate, redaction,
+credentials, and the keychain. None of these submodules is feature-gated.
## Layout
@@ -23,13 +21,14 @@ these submodules is feature-gated — the family is kernel, permanently.
| `live_policy.rs` | Process-global, hot-swappable current `SecurityPolicy` (see its own `//!`) |
| `secrets.rs` | One-line re-export of `keyring::encrypted_store` for legacy import paths |
| `tools.rs` | `SecurityPolicyInfoTool`, the only LLM-callable surface of this domain (read-only, default-ON); command/path gating itself is enforced in-engine, never as an agent-callable tool |
-| `schemas.rs` | `security.policy_info` RPC controller |
+| `schemas.rs` | `security.policy_info` RPC controller, registered through `core/all.rs` |
+| `ops.rs` | `security_policy_info_for_config` / `load_and_get_security_policy_info` behind that controller |
| `detect.rs` | `create_sandbox` — picks a `Sandbox` backend for the host |
| `traits.rs` | `Sandbox` trait and `NoopSandbox` |
| `docker.rs`, `bubblewrap.rs`, `firejail.rs`, `landlock.rs` | Legacy `Command`-wrapping sandbox backends implementing `Sandbox` (see below) |
| `audit.rs` | Append-only audit log of agent actions |
| `pairing.rs` | Pairing token / non-loopback bind guard |
-| `core.rs` | `redact()`, the uniform log-redaction helper |
+| `core.rs` | `redact()`, 4-char-prefix log redaction (glob re-exported) |
Sandbox note: `docker.rs` / `bubblewrap.rs` / `firejail.rs` / `landlock.rs`
here wrap a `std::process::Command` per the `Sandbox` trait and are chosen by
@@ -49,8 +48,10 @@ AppContainer backend; the two domains are not interchangeable.
- `pub trait Sandbox` / `pub struct NoopSandbox` — `traits.rs` — pluggable
sandbox abstraction.
- `pub fn create_sandbox(config: &SecurityConfig) -> Arc<dyn Sandbox>` —
- `detect.rs` — auto-detects Landlock / Firejail / Bubblewrap / Docker or
- falls back to `NoopSandbox`.
+ `detect.rs` — honors `config.sandbox.backend` or auto-detects Landlock /
+ Firejail / Bubblewrap / Docker, falling back to `NoopSandbox`. Landlock and
+ Bubblewrap are behind the `sandbox-landlock` / `sandbox-bubblewrap` cargo
+ features.
- `pub use self::keyring::SecretStore` — encrypted-on-disk secret codec whose
master key lives in keychain-backed storage.
- `pub use egress::{emit_external_transfer, enforce_egress, local_only_blocks, local_only_tool_block, DataKind, EgressDescriptor, EgressReason, IdentificationRisk}` —
@@ -61,14 +62,17 @@ AppContainer backend; the two domains are not interchangeable.
/ `pub struct Actor` / `pub struct Action` / `pub struct ExecutionResult` /
`pub struct SecurityContext` / `pub struct CommandExecutionLog` — `audit.rs`
— append-only audit trail.
-- `pub struct PairingGuard` / `pub fn constant_time_eq` / `pub fn is_public_bind`
- / `pub fn ensure_core_rpc_token_for_bind` — `pairing.rs` — pairing-token
- check before binding the RPC server publicly (backed by `tinychannels_bus`).
+- `pub fn is_public_bind` / `pub fn ensure_core_rpc_token_for_bind` /
+ `CORE_TOKEN_ENV_VAR` / `CoreBindTokenError` — `pairing.rs` — refuse a
+ non-loopback RPC bind without a core token. `PairingGuard`,
+ `constant_time_eq`, and the token helpers are re-exported from
+ `tinychannels_bus::security`.
- `pub fn redact(value: &str) -> String` — `core.rs` — uniform 4-char-prefix
redaction for logs.
-- `pub use ops as rpc` / `pub fn security_policy_info() -> RpcOutcome<serde_json::Value>` —
- `ops.rs` — RPC handler behind `schemas.rs`'s `security.policy_info` function,
- used by the doctor / settings UI.
+- `pub use ops as rpc` — `ops.rs`'s `security_policy_info_for_config(&Config)`
+ and `load_and_get_security_policy_info()` return
+ `RpcOutcome<serde_json::Value>` and back the `security.policy_info` RPC
+ function; `tools.rs` exposes the same read to the agent.
## Security invariants
@@ -81,18 +85,18 @@ behavior, to make a feature work:
`policy/types.rs`).
- **`workspace_dir` stores internal state and is never an acting-tool target.**
Enforced by `SecurityPolicy::is_workspace_internal_path`
- (`policy/path_checks.rs:420`) — memory DBs, sessions, tokens, and other core
+ (`policy/path_checks.rs`) — memory DBs, sessions, tokens, and other core
persistence under `workspace_dir` (`WORKSPACE_INTERNAL_DIRS` /
`WORKSPACE_INTERNAL_FILES` and the `memory-`/`memory_tree-`/`session_raw-`
prefixes) are unwritable by agent tools even under a `trusted_root` grant.
- **Unknown commands classify as writes.** `SecurityPolicy::classify_command`
- (`policy/command_checks.rs:126`) is fail-closed: a command that is not
+ (`policy/command_checks.rs`) is fail-closed: a command that is not
provably read-only is at least `CommandClass::Write`, the highest class
across `;`/`|`/`&&`/`||` segments wins, and a redirect (`>`, `>>`) or `tee`
lifts the class to at least `Write` no matter how benign the base command
looks.
- **System and credential paths are always forbidden.**
- `SecurityPolicy::is_always_forbidden` (`policy/path_checks.rs:471`) matches
+ `SecurityPolicy::is_always_forbidden` (`policy/path_checks.rs`) matches
case-insensitively by path segment (`.ssh`, `.gnupg`, `.aws`, `.azure`,
`.kube`, `keychains`, Windows `Microsoft\{Protect,Credentials,Crypto,Vault}`)
and by absolute prefix (`/etc`, `/root`, `/boot`, `/proc`, `/sys`, `/system`,
@@ -100,10 +104,11 @@ behavior, to make a feature work:
unconditional and is **not** overridable by a `trusted_root` grant.
- **The approval gate is on by default and interactive requests expire as
denied after ten minutes.** `security/approval/gate.rs`'s
- `DEFAULT_APPROVAL_TTL` is 10 minutes and the gate fails closed on timeout;
- `core/types.rs::approval_gate_boot_decision` always installs the gate for
- `HostKind::TauriShell` regardless of any `OPENHUMAN_APPROVAL_GATE=0`
- override.
+ `DEFAULT_APPROVAL_TTL` is 10 minutes and a timed-out park returns `Deny`;
+ `approval_gate_boot_decision` (`core/types.rs`, applied in
+ `core/jsonrpc.rs`) always installs the gate for `HostKind::TauriShell` and
+ ignores `OPENHUMAN_APPROVAL_GATE=0` there — only CLI, Docker, and library
+ hosts may opt out.
## Called by
@@ -120,18 +125,17 @@ behavior, to make a feature work:
goes through the autonomy gate.
- `crates/openhuman-core/src/cron/scheduler.rs` — wraps scheduled shell jobs in
`SecurityPolicy`.
-- `crates/openhuman-core/src/security/credentials/` — uses `SecretStore` and
- `redact`.
+- `crates/openhuman-core/src/security/credentials/` — stores profile secrets
+ through `keyring::SecretStore`.
+- `crates/openhuman-core/src/memory/guard/` — `enforce_write_tier` under
+ `MemoryCore::store`, and `redact` for audit lines.
## Tests
- `policy/policy_tests*.rs`, `policy/proptest_tests.rs`,
`policy/enforcement_scratch_dir_tests_tests.rs` — see
[policy/README.md](policy/README.md).
-- Each other file has an adjacent `*_tests.rs` (`audit_tests.rs`,
- `detect_tests.rs`, `live_policy_tests.rs`, `ops_tests.rs`, `pairing_tests.rs`,
- `tools_tests.rs`, `traits_tests.rs`) and each sandbox backend has its own
- `#[cfg(test)]` blocks where the binary is available
- (`docker_tests.rs`, `bubblewrap_tests.rs`, `firejail_tests.rs`,
- `landlock_tests.rs`).
-- `core_tests.rs` — round-trips `redact()` cases.
+- Every other file has an adjacent `*_tests.rs` (`audit_tests.rs`,
+ `core_tests.rs`, `detect_tests.rs`, `live_policy_tests.rs`, `ops_tests.rs`,
+ `pairing_tests.rs`, `tools_tests.rs`, `traits_tests.rs`, and one per sandbox
+ backend).