Skip to content
This repository was archived by the owner on Nov 29, 2026. It is now read-only.

Security: 8b-is/aristotele

Security

SECURITY.md

Security Policy & Audit Report (v0.7.1)

Threat Model

Aristotele runs a local HTTP/1.1 Studio & API server (127.0.0.1:1337), persistent personal memory (~/.aristotele), provider subprocess transports (curl / CLI bridges), and workspace MCP tools behind capability rungs (Rung0..=Rung3) and SPHIST/1 MAC-authenticated logs.

A local AI assistant faces seven primary attack surfaces:

  1. Browser Cross-Origin / DNS Rebinding / CSRF against 127.0.0.1:1337
  2. Stored DOM XSS inside Studio chat/memory/connector panels
  3. Credential / API key exposure in process arguments (ps) or unsafe CLI bridges
  4. Unbounded TCP thread spawning & HTTP request smuggling
  5. Symlink escapes, oversized reads, and policy bypasses in workspace/connector tools
  6. Weak key derivation or non-atomic config/state writes
  7. Unvalidated control characters or out-of-range fields in settings payloads

Audit Findings & Remediations (SEC-01 – SEC-07)

ID Surface Fix Implemented Location
SEC-01 DNS rebinding & wildcard CORS/CSRF (127.0.0.1:1337) Removed Access-Control-Allow-Origin: *. Added strict loopback Host header check (403 on non-loopback), Sec-Fetch-Site: cross-site rejection (403), validated loopback Origin reflection, and per-runtime 256-bit X-Aristotele-Token CSRF validation (ct_eq_str) on browser POST mutations. server.rs, http.rs
SEC-02 Stored DOM XSS & unsafe media URIs Strengthened esc() (& < > " ' \ /), replaced all dynamic string interpolations in onclick/onchangehandlers withdata-*attributes and delegated event listeners, and restricted chat media attachments viasafeMediaMime()/safeImageUrl()`. webapp.rs
SEC-03 API key exposure in curl argv & unconstrained cli: bridges curl_post_json enforces --proto =https, --max-filesize 8388608, CR/LF/NUL/whitespace validation, and passes sensitive headers via an RAII 0600 temp --config file. query_cli_bridge restricts cli: binaries to ["claude", "gemini", "codex", "ollama"] and blocks NUL / leading-- model flag injection. providers.rs
SEC-04 Unbounded accept threads, HTTP smuggling & header injection Capped concurrent HTTP worker threads at MAX_CONCURRENT_HTTP = 64 (503 Service Unavailable when saturated), rejected duplicate Content-Length and inbound Transfer-Encoding headers, sanitized CRLF response headers, added X-Content-Type-Options: nosniff, X-Frame-Options: DENY, Referrer-Policy: no-referrer, Cache-Control, and strict HTML CSP, and bounded CoopOpenAiClient response reads to 8 MiB. http.rs, server.rs
SEC-05 Symlink traversal, oversized file reads & connector policy bypasses Skipped symlinks explicitly in collect_tree and search_dir, enforced MAX_READ_FILE_BYTES = 4 MiB on read_file, blocked flag injection (-) in crabcc_query, expanded PolicyConfig default blocklist with shells (sh, bash, zsh, dash, fish, cmd, powershell, pwsh) and privilege tools (sudo, su, doas, chmod, chown, kill, pkill), and enforced policy.check_program() before test_connector spawns mcp-stdio. tools.rs, memory.rs, runtime.rs
SEC-06 Predictable new key derivation & partial writes New <home>/sovereign.key creation mixes /dev/urandom OS entropy with PID/time/path via BLAKE3 (while preserving existing keys), state directories use 0700, and config.json, policy.json, connectors.json, palace.json, honcho.json, and chat session files commit atomically via write_private_atomic (0600 temp file + rename). memory.rs, runtime.rs, palace.rs, sessions.rs
SEC-07 Control chars & arbitrary enum values in config payloads Sanitized SettingsUpdate and FirebaseHybridConfig fields (strip_ctrl), clamping backend (google_ai / agent_platform, normalizing legacy vertex_ai) and inference_mode (prefer_on_device / only_on_device / prefer_in_cloud / only_in_cloud), plus deep-nesting JSON regression test (JsonError::NestingTooDeep). memory.rs, runtime.rs, json.rs

Security Boundaries, Distinctions & Non-Goals

To avoid overstating guarantees beyond what the code enforces:

  1. Protocol Magic vs. Security (0x62): The GATE_MAGIC (0x62) byte in AuditFrame64 is a wire protocol framing discriminator, not an authentication or security boundary.
  2. Authentication vs. Authorization vs. Truth: A verified keyed BLAKE3 witness_seal proves only local-key integrity of the 40-byte frame prefix; it does not authorize an action (that is separate capability-rung policy) and does not prove the semantic truth or correctness of an LLM answer or trace.
  3. Loopback Threat Model & OS Isolation: Binding 127.0.0.1 + validating Host/Origin/X-Aristotele-Token mitigates browser-based attacks (DNS rebinding, cross-site CSRF). Same-user local processes on the same machine share OS user privileges and can read ~/.aristotele (0600) or probe 127.0.0.1. Memory safety in Rust (0 unsafe) does not replace OS sandboxing, containers, or hardware privilege separation.
  4. Capability Token Lifecycle: CapabilityToken checks local MAC, rung (0..=3), scope hash, and optional unix-epoch expiration. Cross-invocation nonce replay prevention is not maintained globally without an external nonce ledger.
  5. Atomicity & Replay Scope: Configuration/memory files use per-file 0600 temp+rename atomic replacement, and SPHIST/1 WAL appends entries sequentially with hash chaining; this is not a distributed multi-resource ACID transaction protocol. replay_verify() validates log sequence order, local MACs, and payload hashes — it does not re-execute or prove determinism of external filesystem, subprocess, or network side effects.
  6. Execution Gating vs. Model Alignment: Capability rungs restrict local tool/network invocation in Rust regardless of upstream LLM prompt behavior; they solve orthogonal problems from model-level safety training and are not a substitute for upstream model alignment or OS sandboxing.
  7. #![no_std] Core Crates vs. OS-Hosted Binaries: Three core library crates (aristotele-spherepop, aristotele-beehive, aristotele-hiverl) compile with --no-default-features on aarch64-unknown-none. The aristotele CLI/Studio binary (aristotele-cli, aristotele-ayefire) is a standard OS-hosted application linking OS libc/threads/sockets/Metal/curl and is not a bare-metal OS kernel.

Memory-Safety Invariants

  • External crates.io runtime dependencies: 0 across all 6 workspace crates (8b-is/kolibry core crates are pinned via git revision in Cargo.lock).
  • unsafe Rust code in workspace crates/: 0 blocks/functions/traits/impls (enforced via cargo clippy --workspace --all-targets -- -D warnings -F unsafe_code).
  • #![no_std] core crates: aristotele-spherepop, aristotele-beehive, and aristotele-hiverl build cleanly with --no-default-features on aarch64-unknown-none.

Reporting a Vulnerability

Please open a Private Security Advisory in GitHub Security for 8b-is/aristotele (do not file public issues with exploit payloads against active deployments). Include reproduction steps, affected crate/version (aristotele --version), and suggested scope.

There aren't any published security advisories