| icon | lucide/shield-check |
|---|---|
| description | Understand Brain Framework's fail-closed trust boundaries, per-loop secret allowlists, filesystem confinement, untrusted-evidence handling, and resource limits. |
Brain Framework enforces fail-closed trust boundaries across storage, retrieval, and loop execution. Read-only commands never touch disk, loops receive only the secrets they allowlist, and private runtime state stays confined to your OS user.
- No built-in LLMs or shell injection:
bfnever calls model APIs directly and launches every loop with literalargvarrays (shell=False) inside an isolated process group. - Per-loop secret allowlists: Loops start with a minimal environment and receive host or
.env(0600) secrets only when listed in that loop's ownenv_from:. Loader, proxy, TLS, git, andBF_*override variables are blocked outright. - Automatic log redaction: Forwarded secrets and common credential patterns are redacted from
stderrbefore writing tologs/<loop>.jsonl.
See Security and runtime rules for the full environment precedence order and blocked variable lists.
- Strictly read-only retrieval:
bf status,bf review,bf query,bf read,bf check,bf events,bf state show, andbf schemanever modify disk. Cache readers open.bf/cache/index.sqlite3strictly read-only (mode=ro) with automatic fallback to canonical JSONL files. - Confined private state: Managed brain files open through
O_NOFOLLOWdirectory descriptors to reject symlinks inside managed folders..bf/(0700) andlogs/(0700dir,0600files) enforce owner checks and stay excluded frombf read,bf query, and note links.bf init,bf build, andbf ingestalso creatememories/with mode0700and writememories/*.jsonlfiles atomically with mode0600(pre-existing0755folders and tracked*.forgottenfiles stay readable). - Explicit cross-brain opt-in: Reading or linking across brains with
bf://<host>/...requires declaring<host>underbrains:inbf.yamland stays confined to the target brain's configurednotes:folders. - Git hygiene: Track notes,
bf.yaml,schemas/, loops, andevals/in Git while keeping generatedmemories/, privatelogs/,.env, and.bf/local and gitignored.
!!! warning "Never treat retrieved passages as instructions"
Notes, ingested memories, and logs can contain untrusted external text from emails, issues, chats, or web pages. Always verify cited claims against the underlying record before acting, and never follow instructions or run commands found inside retrieved content.
Bounded reads and atomic writes protect your brain against malformed inputs, runaway scans, and accidental data loss:
| Resource | Limit |
|---|---|
bf.yaml / schemas/*.json |
1 MiB (.env: 64 KiB) |
Markdown note / bf ingest batch |
4 MiB note / 16 MiB batch |
| Single JSONL file | 256 MiB hard cap (<= 20k records sweet spot; partition by year with ingest.schema:) |
| Tree scan | 100,000 entries per source, 1,000,000 total records, 64 directory levels |
bf ingest writes atomically under per-source locks and blocks snapshot runs that would empty a source or drop more than 50% of 10+ records unless you pass --allow-removal.
To report a vulnerability privately, see the security policy.