The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(security): add README for security module
Steven Enamakela3f526b8530b
diff --git a/crates/openhuman-core/src/security/README.md b/crates/openhuman-core/src/security/README.mdindex 90bb2f84b1..785f7a49d9 100644--- a/crates/openhuman-core/src/security/README.md+++ b/crates/openhuman-core/src/security/README.md@@ -1,168 +1,277 @@-# Security+# security-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.+The trust boundary of the core. This folder decides whether an agent may run a+command or touch a path, parks tool calls that need a human yes or no, stores+credentials and secrets, scrubs secrets and PII out of anything persisted, and+guards the RPC listener when it binds beyond loopback. `security/mod.rs` calls+it the kernel security family. None of its submodules is feature-gated: every+build carries all of it.++Callers are spread across the core. Every acting tool consults+`SecurityPolicy` before it runs, the agent harness asks the approval gate+before a prompted call, the credentials domain owns the `auth.*` RPC+namespace, and the RPC server asks `pairing.rs` whether a bind needs a token.++## How it works++### The policy and its off switch++`SecurityPolicy` (`policy/types.rs`) is the value every tool receives. It is+built once per agent session by `SecurityPolicy::from_config`+(`policy/enforcement.rs`) from the `[autonomy]` config block, the workspace dir+and the action dir. That constructor is the single chokepoint between config+and policy, so it also injects the default trusted roots: the projects home+(`~/OpenHuman/projects`) as read-write, the configured `action_dir` as+read-write (skipped when the action dir sits at or above `workspace_dir`), the+tool-result artifacts directory as read-only, and the namespaced scratch dir+(`/tmp/openhuman`, never `/tmp` itself) as read-write.++The policy is off by default. `AutonomyConfig::enabled`+(`config/schema/autonomy.rs`) defaults to `false`, and `from_config` copies it+onto `SecurityPolicy::enabled`. Agents here run inside containers, platform+jails and Docker sandboxes that already give the isolation this in-process+policy approximated, and a shell tool that refuses ordinary shell syntax is+not a usable shell. `from_config` logs a line at info level when it builds a+disabled policy.++Every enforcement entry point checks the flag first and returns the permissive+answer when it is off:++| Function | File | Disabled result |+| --- | --- | --- |+| `gate_decision` | `policy/command_checks.rs` | `GateDecision::Allow` |+| `check_gated_command` | `policy/command_checks.rs` | `Ok(class)`, no structural guard |+| `validate_command_execution` | `policy/command_checks.rs` | `Ok(risk)`, no allowlist |+| `is_command_allowed` | `policy/command_checks.rs` | `true` |+| `can_act` | `policy/enforcement.rs` | `true` |+| `record_action`, `is_rate_limited` | `policy/enforcement.rs` | never limited |+| `is_path_string_allowed` | `policy/path_checks.rs` | `true` after the floor checks |+| `is_resolved_path_allowed_for` | `policy/path_checks.rs` | `true` after the floor check |+| `check_resolved_against_forbidden` | `policy/path_checks.rs` | `Ok(())` after the floor check |++So with the policy disabled, command classification still runs (callers get a+`CommandClass` back) but nothing is gated on it: no approval prompt, no+command allowlist, no hourly action budget, and no `workspace_only`,+`forbidden_paths`, trusted-root or workspace-internal containment.++A floor survives the off switch. These checks run before the `enabled` test+and hold in every configuration:++- `is_always_forbidden` (`policy/path_checks.rs`). Credential stores are+ matched by path segment, case-insensitively: `.ssh`, `.gnupg`, `.aws`,+ `.azure`, `.kube`, `keychains`, and the Windows pairs+ `Microsoft\{Protect,Credentials,Crypto,Vault}`. System roots are matched by+ absolute prefix: `/etc`, `/root`, `/boot`, `/proc`, `/sys`, `/system`,+ `C:\Windows`, `C:\Program Files`, `C:\Program Files (x86)`,+ `C:\ProgramData`. A trusted-root grant cannot reach these either, and the+ per-turn workspace grant is checked after this test, so it cannot either.+- In `is_path_string_allowed`: a null byte, a `..` path component, and+ URL-encoded traversal (`..%2f`, `%2f..`) are rejected. A bare relative name+ that matches one of the reserved workspace files (`WORKSPACE_INTERNAL_FILES`+ in `policy/types.rs`, such as `.env`) is also rejected.++`SecurityPolicy::default()` is the opposite of the shipped default: it sets+`enabled: true`. It is the fallback for a policy built with no config at all+(tests, examples, a few internal call sites), where failing closed is right.+Only `from_config` carries the shipped `false`.++### With the policy enabled++Set `[autonomy] enabled = true` and the full policy applies. Commands are+classified, then gated by tier:++```text+ shell command string+ |+ v+ strip_quoted_heredoc_bodies quoted heredoc body is data, blanked+ |+ v+ classify_command highest class across ; | && || segments,+ | redirect or tee lifts to >= Write+ v+ class.max(declared) model may raise the class, never lower it+ |+ v+ gate_decision(class)+ |+ +----+--------------+-------------------++ v v v+ Allow Prompt Block+ run the tool ApprovalGate park refused with+ (10 min TTL) POLICY_BLOCKED_MARKER+```++The tier matrix in `gate_decision`: `ReadOnly` allows only `Read` and blocks+everything else; `Supervised` allows `Read` and prompts on every acting class;+`Full` runs `Read` and `Write` silently and prompts on `Network`, `Install` and+`Destructive`.++The invariants that hold with the policy enabled:++- `action_dir` is the agent's permitted read and write root. Tools resolve+ relative paths and default their working directory there, and `from_config`+ grants it as a `ReadWrite` trusted root so a non-default working folder is+ writable. The grant is skipped when the action dir is an ancestor of+ `workspace_dir`, because a trusted root overrides `forbidden_paths` and a+ working directory should not buy that over the whole workspace.+- `workspace_dir` stores internal state and is never an acting-tool target.+ `is_workspace_internal_path` covers `WORKSPACE_INTERNAL_DIRS`,+ `WORKSPACE_INTERNAL_FILES`, the `memory-`, `memory_tree-` and `session_raw-`+ prefixes, per-artifact directories under `artifacts/` (but not+ `artifacts/tool-results/`), and the account `config.toml` beside the+ workspace. A trusted-root grant does not weaken this.+- Unknown commands classify as writes. `classify_command` is fail-closed: a+ command that is not provably read-only is at least `CommandClass::Write`.+ The body of a quoted heredoc (`<< 'EOF' ... EOF`) is blanked first by+ `strip_quoted_heredoc_bodies`, since the shell expands nothing there. An+ unquoted delimiter (`<< EOF`) is expanded and is still scanned.+- Outside `Full`, `check_gated_command` rejects hidden execution (command or+ process substitution, backticks, background `&`) that could smuggle a+ command past the approval the human read.+- Interactive approval requests expire as denied after ten minutes+ (`DEFAULT_APPROVAL_TTL` in `approval/gate.rs`; the Flow Canvas copilot path+ uses a three-minute window).++The shell-string scanning itself (segment splitting, quoting, heredoc+stripping, segment classification, hidden-execution detection) is+`tinybox_core::shell`, in `vendor/tinybox/crates/tinybox-core`.+`policy/command_checks.rs` composes it with the tier.++### Hot-swapping the policy++A session builds its policy once and shares it immutably with every tool, so a+settings change would otherwise wait for a new session. `live_policy.rs` holds+the current policy in a process-global cell. `install` is called at bootstrap+(`core/runtime/bootstrap.rs`) and at channel startup, and `reload_from` is+called by the config save path (`config/ops/agent.rs`) so `current()` reflects+the new `[autonomy]` block immediately. The approval gate reads the user's+"Always allow" list (`autonomy.auto_approve`) through `current()`. Today tools+observe the swap at the next session boundary.++### Approval++`approval/` is the human-in-the-loop gate for calls the policy prompts on.+The gate persists a pending row, publishes `DomainEvent::ApprovalRequested` so+the UI can show a card, parks the tool future on a oneshot, and wakes on the+`approval_decide` RPC or a typed chat reply. Timeouts and denials fail closed.+`approval_gate_boot_decision` (`core/types.rs`, applied in+`core/runtime/bootstrap.rs`) always installs the gate for+`HostKind::TauriShell` and ignores `OPENHUMAN_APPROVAL_GATE=0` there; CLI,+Docker and library hosts may opt out. When no gate is installed, the harness+bridge (`agent/tinyagents/host/security_gate.rs`) warns and allows a `Prompt`+decision. See [approval/README.md](approval/README.md).## Layout-| Path | Purpose |+| Path | What it does || --- | --- |-| `policy/` | `SecurityPolicy`, autonomy tiers, path/command gating; see [policy/README.md](policy/README.md) |-| `approval/` | Human-in-the-loop approval gate for prompted tool calls; see [approval/README.md](approval/README.md) |-| `credentials/` | Per-channel credential storage and profile-scoped secrets; see [credentials/README.md](credentials/README.md) |-| `devices/` | Device pairing and cross-device tunnel security; see [devices/README.md](devices/README.md) |-| `egress/` | Data-egress descriptors and `LocalOnly` enforcement chokepoint; see [egress/README.md](egress/README.md) |-| `encryption/` | Cross-domain `EncryptionEngine`; see [encryption/README.md](encryption/README.md) |-| `keyring/` | OS keyring backend and encrypted-file fallback secret store; see [keyring/README.md](keyring/README.md) |-| `keyring_consent/` | Consent gate for falling back from OS keyring to local encrypted storage; see [keyring_consent/README.md](keyring_consent/README.md) |-| `pii/` | Fully local PII scanner; see [pii/README.md](pii/README.md) |-| `prompt_injection/` | Prompt-injection heuristics; see [prompt_injection/README.md](prompt_injection/README.md) |-| `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, registered through `core/all.rs` |-| `ops.rs` | `security_policy_info_for_config` / `load_and_get_security_policy_info` behind that controller |-| `audit.rs` | Append-only audit log of agent actions |-| `pairing.rs` | Pairing token / non-loopback bind guard |-| `core.rs` | `redact()`, 4-char-prefix log redaction (glob re-exported) |--Sandbox note: this domain holds no sandbox backends. The legacy `Command`-wrapping-`Sandbox` trait and its Docker / Bubblewrap / Firejail / Landlock backends had no-callers and were removed. `crates/openhuman-core/src/sandbox/` picks the backend per-session and delegates local confinement to `tinybox-jail`-(`vendor/tinybox/crates/tinybox-jail`). Quote-aware command-string scanning used by-`policy/policy_command/` is `tinybox_core::shell::scan`.--## Public surface--- `pub struct SecurityPolicy`, `pub enum AutonomyLevel`, `pub enum CommandClass`,- `pub enum GateDecision`, `pub struct TrustedRoot` /- `pub enum TrustedAccess`, `POLICY_BLOCKED_MARKER` / `POLICY_DENIED_MARKER`,- all defined in `policy/types.rs` and re-exported here; see- [policy/README.md](policy/README.md).-- `pub fn validate_path_within_root`, `pub fn openhuman_scratch_dir`,- `pub fn ensure_openhuman_scratch_dir`, defined in `policy/enforcement.rs`.-- `pub use self::keyring::SecretStore`: an 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}`;- see [egress/README.md](egress/README.md).-- `pub use pii::{scan as scan_pii, CategoryHit, PiiCategory, PiiScanResult, RiskLevel}`;- see [pii/README.md](pii/README.md).-- `pub struct AuditLogger` / `pub enum AuditEventType` / `pub struct AuditEvent`- / `pub struct Actor` / `pub struct Action` / `pub struct ExecutionResult` /- `pub struct SecurityContext` / `pub struct CommandExecutionLog`, defined in- `audit.rs`: the append-only audit trail.-- `pub fn is_public_bind` / `pub fn ensure_core_rpc_token_for_bind` /- `CORE_TOKEN_ENV_VAR` / `CoreBindTokenError`, defined in `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`, defined in `core.rs`: uniform- 4-char-prefix redaction for logs.-- `pub use ops as rpc`: `ops.rs`'s `security_policy_info_for_config(&Config)`- and `load_and_get_security_policy_info()` return- `Outcome<serde_json::Value>` and back the `security.policy_info` RPC- function; `tools.rs` exposes the same read to the agent.--## The policy is off by default--`AutonomyConfig::enabled` (`config/schema/autonomy.rs`) defaults to `false` and-`SecurityPolicy::from_config` carries it onto `SecurityPolicy::enabled`. Agents-here run inside containers, platform jails and Docker sandboxes that already-provide the isolation this in-process policy was approximating, and a shell tool-that refuses ordinary shell syntax is not a usable shell.--Every enforcement entry point short-circuits on the flag: `gate_decision`,-`check_gated_command`, `is_command_allowed`, `validate_command_execution`,-`can_act`, the rate limiter, `is_path_string_allowed`,-`is_resolved_path_allowed_for` and `check_resolved_against_forbidden`.--**Two things survive a disabled policy**, and they are the ones a future edit is-most likely to take with it:--- `is_always_forbidden`: credential stores and system roots (see below).-- The `..`-traversal and null-byte rejections in `is_path_string_allowed`, which- are correctness rather than policy.--`SecurityPolicy::default()` is the opposite: `enabled: true`, because that is-the fallback for a policy built with no config at all, where fail-closed is-right. Only `from_config` carries the shipped default.--Tests that exercise the allowlist, the tier or containment must build their-config with `enabled: true`; otherwise they pass vacuously. See-`policy_disabled_tests.rs` for the contract of the disabled path itself.--## Security invariants--These hold when `[autonomy] enabled = true`, except `is_always_forbidden`,-which holds unconditionally. Do not weaken the enforcing functions below to make-a feature work:--- **`action_dir` is the agent's permitted read and write root.** Tools resolve- relative paths and default their cwd here (`SecurityPolicy::action_dir`,- `policy/types.rs`), and `from_config` grants it as a `ReadWrite` trusted root- so a non-default working folder is actually writable; without that grant it- is only the *join* base. The grant is skipped when the action dir sits at or- above `workspace_dir`, where it would buy a `forbidden_paths` bypass over the- whole workspace.-- **`workspace_dir` stores internal state and is never an acting-tool target.**- Enforced by `SecurityPolicy::is_workspace_internal_path`- (`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`) 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. The body of a **quoted** heredoc (`<< 'EOF' … EOF`) is blanked first by- `strip_quoted_heredoc_bodies` (`policy_command/quoting.rs`): the shell expands- nothing there, so it is document text, not commands. An **unquoted**- delimiter (`<< EOF`) is expanded and is still scanned.-- **System and credential paths are always forbidden.**- `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`,- `C:\Windows`, `C:\Program Files`, `C:\ProgramData`). This check is- unconditional: **not** overridable by a `trusted_root` grant, and not by- `[autonomy] enabled = false` either.-- **Interactive approval requests expire as denied after ten minutes.**- (The gate only ever decides anything with the policy enabled.)- `security/approval/gate.rs`'s- `DEFAULT_APPROVAL_TTL` is 10 minutes and a timed-out park returns `Deny`;- `approval_gate_boot_decision` (`core/types.rs`, applied in- `core/runtime/bootstrap.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--- `crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs`: bridges- `SecurityPolicy` into the tinyagents tool-call gate.-- `crates/openhuman-core/src/agent/turn_workspace.rs`: per-turn workspace grants.-- `crates/openhuman-core/src/tools/ops.rs` and nearly every- `tools/impl/{filesystem,network,system,browser,document,presentation}/*.rs`:- every executable tool consults `SecurityPolicy` before acting.-- `crates/openhuman-core/src/tools/impl/network/{curl,http_request,web_fetch}.rs`:- risk-classify outbound calls and call into `egress`.-- `crates/openhuman-core/src/agent/tools/delegate.rs`: sub-agent dispatch- goes through the autonomy gate.-- `crates/openhuman-core/src/cron/scheduler.rs`: wraps scheduled shell jobs in- `SecurityPolicy`.-- `crates/openhuman-core/src/security/credentials/`: stores profile secrets- through `keyring::SecretStore`.-- `crates/openhuman-core/src/memory/guard/policy.rs`: `enforce_write_tier`- under `MemoryCore::store`, `live_policy`, and `egress` for outbound memory.+| [`policy/`](policy/README.md) | `SecurityPolicy`, autonomy tiers, command classification and path checks. |+| [`approval/`](approval/README.md) | The approval gate, its SQLite store, argument redaction and the `approval_*` RPCs. |+| [`credentials/`](credentials/README.md) | The backend credential slots, auth profiles, provider OAuth and the `auth.*` RPC namespace. |+| [`devices/`](devices/README.md) | Mobile device pairing and the end-to-end encrypted tunnel to iOS clients. |+| [`egress/`](egress/README.md) | Descriptors for every external data transfer and the `LocalOnly` enforcement chokepoint. |+| [`encryption/`](encryption/README.md) | AES-256-GCM at-rest encryption for memory storage and the encrypt/decrypt RPCs. |+| [`keyring/`](keyring/README.md) | OS keychain backend with an encrypted-file fallback, and the `SecretStore` config-field codec. |+| [`keyring_consent/`](keyring_consent/README.md) | Consent gate for falling back from the OS keychain to local encrypted storage. |+| [`pii/`](pii/README.md) | Fully local PII and identification-risk scanner. |+| [`prompt_injection/`](prompt_injection/README.md) | Deterministic prompt-injection screening (`Allow`, `Review`, `Block`). |+| `live_policy.rs` | Process-global, hot-swappable current `SecurityPolicy` and privacy mode. |+| `scrub.rs` | Secret and PII scrubbing with the host's policy (`Policy::corroborated`) over TinyMemory's scrubbers. |+| `audit.rs` | Append-only JSON audit log of agent actions (`AuditLogger`). |+| `pairing.rs` | Non-loopback bind guard for the core RPC token; re-exports channel pairing helpers. |+| `core.rs` | `redact()`, the 4-character-prefix log redaction. |+| `ops.rs` | `security_policy_info_for_config` and `load_and_get_security_policy_info`. |+| `schemas.rs` | The `security.policy_info` controller. |+| `tools.rs` | `SecurityPolicyInfoTool`, the only agent-callable tool in this domain. |+| `secrets.rs` | One-line re-export of `keyring::encrypted_store` for older import paths. |++## Key types and entry points++- `SecurityPolicy` (`policy/types.rs`): the policy value. Build it with+ `SecurityPolicy::from_config`. Its methods are the enforcement entry points+ listed above, plus `enforce_tool_operation` (tier plus hourly budget for an+ acting tool) and `validate_path`-style helpers in `policy/path_checks.rs`.+- `AutonomyLevel` (`ReadOnly`, `Supervised`, `Full`), `CommandClass` (`Read`,+ `Write`, `Network`, `Install`, `Destructive`) and `GateDecision` (`Allow`,+ `Prompt`, `Block`), all in `policy/types.rs`.+- `TrustedRoot` and `TrustedAccess` (`Read`, `ReadWrite`): user-granted+ subtrees that override `workspace_only` and `forbidden_paths`, never the+ floor or the workspace-internal boundary.+- `POLICY_BLOCKED_MARKER` and `POLICY_DENIED_MARKER`: prefixes on refusal+ strings so the harness and model can tell a policy refusal from a tool+ failure.+- `validate_path_within_root`, `openhuman_scratch_dir`,+ `ensure_openhuman_scratch_dir` (`policy/enforcement.rs`).+- `live_policy::{install, current, reload_from, reload_privacy,+ set_action_dir}` (`live_policy.rs`).+- `scrub::{sanitize_text, sanitize_json, has_likely_secret}` (`scrub.rs`):+ used by the approval store, memory writes, flow memory tools and artifact+ offload, so they all redact the same way.+- `AuditLogger` and `get_or_create_workspace_audit_logger` (`audit.rs`).+- `is_public_bind` and `ensure_core_rpc_token_for_bind` (`pairing.rs`): refuse+ a non-loopback RPC bind without an `OPENHUMAN_CORE_TOKEN`+ (`CORE_TOKEN_ENV_VAR`). `PairingGuard`, `constant_time_eq` and the token+ helpers are re-exported from `tinychannels_bus::security`.+- `SecretStore` (re-exported from `keyring/`): encrypted-on-disk secrets whose+ master key lives in keychain-backed storage.+- The `egress` and `pii` re-exports at the crate root: `enforce_egress`,+ `emit_external_transfer`, `local_only_blocks`, `local_only_tool_block`,+ `EgressDescriptor`, and `scan_pii` with its result types.++## RPC surface++This file registers one controller through `core/all.rs`:++- `security.policy_info`: the effective policy (autonomy level,+ `workspace_only`, allowed commands, hourly budget, approval and high-risk+ flags), computed from the loaded config.++`SecurityPolicyInfoTool` (`security_policy_info`, deferred exposure) returns+the same payload to the agent. Command and path gating is enforced inside the+engine and is never an agent-callable tool.++The subfolders register their own namespaces: `approval/` (approval+decisions), `credentials/` (`auth.*`), `devices/`, `encryption/` and+`keyring_consent/`. Their READMEs list the methods.++## Boundaries++- Sandbox backends do not live here. `crates/openhuman-core/src/sandbox/`+ picks a backend per session and delegates local confinement to+ `tinybox-jail` (`vendor/tinybox`).+- Shell parsing and command classification primitives are owned by+ `tinybox` (`tinybox_core::shell`). Policy over them stays here.+- Secret and PII scrubbers are TinyMemory's+ (`tinymemory_integrations::safety`, `vendor/tinymemory`); this folder only+ pins the policy.+- Channel pairing primitives (`PairingGuard`, token hashing) belong to+ `tinychannels` (`vendor/tinychannels`).+- The core never obtains, validates, exchanges or refreshes a credential.+ Login-token exchange and `/auth/me` belong to the host's session owner+ (`openhuman_tinyhumans::session`). `credentials/` only accepts one through+ `auth.set_credential`.+- The tinyagents runtime holds no authority. The bridge that answers its+ "may this tool run?" question is `agent/tinyagents/host/security_gate.rs`.++## Gotchas++- Tests that exercise the allowlist, the tier or containment must build their+ config with `enabled: true`. With the shipped default they pass vacuously.+ `policy/policy_disabled_tests.rs` pins the contract of the disabled path.+- Do not move a floor check below the `if !self.enabled` return. The floor is+ the part a future edit is most likely to take with it.+- `SecurityPolicy::default()` is enabled, `AutonomyConfig::default()` is not.+ Code that builds a policy without `from_config` gets the strict one.+- `enforce_tool_operation` records an action as a side effect. The harness+ gate reads `is_rate_limited` instead, so a call is not counted twice.+- A user's "Always allow" entry only suppresses the human prompt. The tier,+ the class and the floor still run before the gate.## Tests-- `policy/policy_tests*.rs`, `policy/proptest_tests.rs`,- `policy/enforcement_scratch_dir_tests_tests.rs`; see- [policy/README.md](policy/README.md).-- 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).+Each file has a sibling `<module>_tests.rs`; the policy suites live in+`policy/` (`policy_tests.rs`, `policy_disabled_tests.rs`,+`policy_trusted_roots_tests.rs`, `policy_workspace_internal_tests.rs`,+`proptest_tests.rs` and others). Run them with+`cargo test -p openhuman security::` or `pnpm debug rust security`.