Security
Auth is mandatory and fail-closed, identity is never client-claimed, the planes can be split so provider keys never touch the memory process — and what remains yours.
What the engine enforces
Auth is mandatory. Every data-plane connection presents an API key at handshake. There is no permissive mode and no config knob to add one — a connection whose key cannot be resolved is refused.
Identity is never client-claimed. The server resolves the key to its
(namespace, space, permissions) scope from the key's own record. The
agent_id a request operates under comes from the authenticated key, not from
any field the client sets. A client cannot assert who it is.
Isolation is structural. Recall serves the caller's space, and can widen to the caller's namespace — never across namespaces. Results outside scope are never candidates, so they don't enter process memory and then get filtered out.
Elevation can't be self-granted. A trusted principal can name an effective
space with act_as, but the namespace must be in its allowlist (otherwise
ActAsDenied), the space is an opaque selector the server derives the storage
id from, and extra capability bits are grantable only if the connecting
principal already holds them.
The admin plane fails closed. It gates on [admin] token, and the server
refuses to start if that is unset rather than coming up unauthenticated.
Brain never holds a provider key. It asks the broker which provider and model a namespace serves — the reply carries no key material — and its completions then travel through the broker, which applies the tenant's real key on the way upstream. Customer keys therefore stay out of this process's WAL, its snapshots and its backups — which is why a keyless boot is correct rather than a misconfiguration. The contract is two routes; see what a broker has to serve.
Nothing enters unattributed. Typed claims carry evidence back to source memories. The write path won't admit a claim with no provenance.
Splitting the planes
One brain-edge binary serves two jobs: the memory verbs, and BYOK credential
management plus the broker. BRAIN_EDGE_PLANE splits them:
boththe defaultMemory verbs, credentials and the broker in one process. Fine for self-host; one process is simpler to run.
datamemory verbs onlyNo key material is reachable in this process. This is the plane that carries tenant traffic.
credentialBYOK and the broker onlyHolds the credential store and answers Brain's resolve calls. Keep it off the path that serves tenants.
Running data and credential as separate deployments keeps tenants' provider
keys out of the process carrying memory traffic. That is the point of the flag,
and it is worth doing before exposure rather than after.
An unrecognised value is a hard startup error, not a silent fallback to
both — quietly serving credentials from a process an operator meant to be
data-only is exactly the mistake the flag exists to prevent.
Credential revocation has a TTL
[llm.broker]
ttl_secs = 300 # how long a resolved credential is cachedThis bounds how long a revoked provider key keeps working. Five minutes by
default. Lower it if your compliance posture needs a tighter revocation window,
and know that lowering it costs a broker round trip more often. ttl_secs = 0
is not "never cache" — it means unset, and the built-in 300 seconds applies.
To shorten the window, give it a small positive number.
API-key revocation is different and immediate: it is checked on connection, so a revoked key cannot resolve a new connection at all.
What is yours
All three brain-db listeners default to loopback in the source config. That default is doing real work — exposing either beyond localhost or a trusted network is your decision and your hardening.
Never expose the admin plane. It mints and revokes keys. In the published
image it binds 127.0.0.1:9092 inside the container; reach it with
docker exec. If you genuinely need remote admin, put it behind a reverse proxy
that terminates TLS and checks the bearer token — don't rebind it and hope.
The wire port needs TLS. The data plane speaks a binary protocol over TCP. Across any untrusted network that wants TLS; the key is presented at handshake and you don't want it in cleartext.
The metrics port is public and unauthenticated. /healthz, /readyz and
/metrics have no token. They expose operational shape — shard counts, arena
pressure, request volumes, extraction spend. Keep 9091 inside your network.
The common mistake is binding everything to 0.0.0.0 to make a health check
work from outside, which exposes admin and metrics at the same time. Expose
the one listener you need and leave the others alone.
Resource bounds. Connection and request limits are yours to set at the boundary.
Key handling
Keys are the identity, so they're the whole surface:
- One key per tenant, or one trusted principal using
act_as— see one space per customer. - Derive the
act_asselector from your authenticated session, never from user-supplied input.space: "bot:" + req.body.userIdis a tenant-crossing bug. - Revoke through the admin plane. Revocation is checked on connection, so a revoked key cannot resolve.
What is not built
Say this plainly, because a gap you don't know about is worse than one you do:
- No per-memory ACLs. Authorisation is at the shard and space level. Field-level security and time-bounded permissions don't exist.
- No replication. Node loss means restore from snapshot.
- No TLS terminator of its own. Neither process terminates TLS. That is your proxy's job on every listener you expose.
If your model needs row-level authorisation inside a shared space, the way to express it today is a space boundary, not a filter.
Before you expose anything
- Admin plane loopback-only, or proxied with its token checked.
- TLS on the wire port if it crosses an untrusted network.
- Metrics port inside your network.
BRAIN_EDGE_PLANE=dataon anything serving tenants, withcredentialdeployed separately.- Keys scoped per tenant, selectors derived from authenticated sessions.
- A tested revocation path, and a
ttl_secsyou have decided on rather than inherited. - Connection and request limits at the boundary —
BRAIN_EDGE_REQUEST_TIMEOUT_SECSandBRAIN_EDGE_MAX_BODY_BYTESbound the edge; the rest is your proxy's.
Was this page helpful?
Backups and recovery
Snapshots are the backup story, the periodic worker captures only the HNSW graph, and restore is destructive in place — which artefact is a restore point and which is an optimisation.
Scaling and limits
Shards are chosen once, tenants are capped at single-shard throughput, and the engine is single-node — the boundaries to know before you build on it.