MentisDB 0.10.9.54 — Security, reliability and retrieval
0.10.9.54 is the result of an exhaustive audit of the whole codebase: server, dashboard, storage, search, dependencies and CI. The work ran as parallel agent workstreams that coordinated through MentisDB itself — plans, findings, checkpoints and hand-offs were appended to the project's own chain, so each agent picked up where another left off. The audit found a serious authorization bug, fixed the memory blow-up reported in issue #23, repaired reranking, and made ranked search faster and more accurate.
/tools/execute endpoint. Upgrade with
cargo install mentisdb --locked --force and restart the daemon.
1. A chain-scoped token could act outside its chain
MentisDB supports bearer tokens scoped to one or more chains, so an agent can
be given its own memory and nothing else. Through the legacy MCP
/tools/execute route, a chain-scoped token could act outside its
scope: reading and writing other chains, calling global-only tools such as listing every chain
with its storage path, and merging or deleting chains it was never granted.
This affects 0.10.8.53 and earlier whenever bearer-token access is enabled.
The fix follows a simple rule: authorization must inspect exactly the fields the executor consumes, and every operation on both REST and MCP is now checked against one shared authorization table.
The same review produced a set of smaller hardening fixes:
- One shared REST/MCP authorization table; listing chains, webhook management, cross-chain agent listing, skill mutations and admin flush need a global token.
- Merge and branch chain keys are trimmed and validated before authorization, so a padded key cannot resolve to a different chain.
- Webhooks refuse private, loopback, link-local, IPv4-translated, local NAT64 and Teredo targets, re-check DNS at delivery time, never follow redirects, and back off with a circuit breaker.
- The dashboard fixes a stored XSS via crafted keys, guards every state-changing call and the login form against CSRF, and adds a
Hostallowlist against DNS rebinding (MENTISDB_DASHBOARD_ALLOWED_HOSTSfor extra names). - Backup restore bounds the manifest, file count and declared sizes; secrets files are written
0600.
2. Issue #23: memory blow-up after upgrading
takver reported a daemon growing to 28.8 GiB and getting OOM-killed after upgrading a data directory with many chains. The report was accurate. Every chain loaded its own FastEmbed ONNX session, about 100 MB each and never released, and opening a chain without a fresh vector sidecar embedded its whole history in one unbounded batch on the request path. Our reproduction with 13 chains and 2,704 thoughts blew through a 6 GB cap.
Now one model is shared per process, inference runs in small bounded chunks,
and missing sidecars are rebuilt by a single background worker while the chain
keeps serving lexical and graph results. The same reproduction peaks at about
1.7 GB. The model cache moved from the working directory
to <MENTISDB_DIR>/.fastembed_cache, and
MENTISDB_EMBEDDINGS=off|local-text|fastembed lets you opt out of
ONNX entirely.
3. Reranking works again, and default retrieval improved
enable_reranking=true had been quietly broken: the raw Reciprocal
Rank Fusion total, a number around 0.05, replaced the additive score, so
LoCoMo R@5 fell to 3.6%. RRF is now a scaled consensus bonus added on top of
the score. The thesaurus is keyed by stem so inflected words expand, and its
weight was damped after benchmarks showed that more frequent expansion was
displacing literal matches.
BEFORE (b4372ff) 0.10.9.54
LoCoMo default R@5/R@10 63.8 / 72.7 63.9 / 73.5
LoCoMo rerank R@5/R@10 3.6 / 5.9 66.0 / 74.1
LME default R@5/R@10/R@20 66.8/72.0/78.2 68.0/72.8/78.8
LME rerank R@5 2.8 68.6
Query q/s (LoCoMo / LME) 206 / 159 384 / 385
One finding is worth sharing. An interim build was slower on queries, and the cause was not our code: fastembed 7 brings an ONNX Runtime release that always registers the CoreML execution provider on macOS, which made query embeddings about 2.5x slower. Only sampling the live process revealed it. fastembed stays on 5.x, with a test that guards the pin.
4. Durability and speed
- A torn final record is preserved and truncated before the next append; corruption in the middle of a file fails the open instead of silently dropping records.
- Registries are written atomically; the implicit-edge overlay catches up after a crash.
MENTISDB_FSYNC=1opts into anfsyncper group commit for power-loss durability.- Per-append cost dropped from 6.3–7.8 ms to 1.4 ms; benchmark ingest went from 171.5 s to 75.1 s (LoCoMo) and 725.6 s to 184.2 s (LongMemEval) on a host with varying load.
Upgrade notes
- Reads of an unknown chain return
404; call bootstrap before reading a new chain. - Reverse proxies in front of the dashboard must keep the original
Hostor forward a name listed inMENTISDB_DASHBOARD_ALLOWED_HOSTS. Scripts calling the dashboard API addX-MentisDB-Dashboard: 1. - MCP payloads mixing
tool/parametersandname/argumentsreturn400. - Large chains may serve lexical-only ranked results briefly after the first start while sidecars rebuild.
- The Intel macOS binary is back, built without local embeddings.
cargo install mentisdb --locked --force
Full details: release notes. Thanks again to takver for #23.