OperationsSecurity & compliance

Security & compliance

This page lists the controls an auditor would ask about and says where each one lives. For the isolation model itself, see Security & isolation.

⚠️

Mnemosyne holds no certification and no auditor has been engaged. It is alpha software, on the 3.6.x line. The controls below are implemented in code; whether they meet a given framework is for you and your auditor to decide.


Audit log

Security-relevant actions, such as key creation and revocation, exports, hard deletes and sign-ins, are written to mnemo_audit_log with the actor, the action, the resource and the time. Entries are hash-chained: each stores SHA-256 over the previous hash and its own content, so a changed or removed entry breaks the chain. The app role’s grants on the table are append-only.

Over HTTP, GET /audit lists fact removals (user forgets and system archives) and GET /audit/stats counts them per day. The dashboard has an audit view under admin.


Scoped API keys

Authorization is by scope. A key carries only the scopes it was created with, and a request whose route needs another scope is refused with 403. Scope names include memory:read, memory:write, memory:export and memory:hard_delete.

ActionRouteCLI
CreatePOST /admin/keysmnemo keys create
ListGET /admin/keysmnemo keys list
RevokeDELETE /admin/keys/{keyId}mnemo keys revoke
RotatePOST /admin/keys/{keyId}/rotatemnemo keys rotate

A key can also carry an expiry (expiresIn), a sensitivity ceiling (maxSensitivity) and an IP allowlist of CIDR ranges (ipAllowlist). A rotated key keeps working for 7 days. GET /admin/keys returns lastUsedAt for each key, which is what an access review needs.

The keys of the scoped scheme (MNEMO_SCOPED_AUTH=1) have their own routes, /admin/scoped-keys, and their own command, mnemo keys scoped. See Security & isolation.


Approvals

Some actions need a second person. The gated request answers 202 with an approval id. A different user resolves it:

curl -X POST http://localhost:3939/approvals/<id>/resolve \
  -H "Authorization: Bearer mns_live_..." \
  -H "Content-Type: application/json" \
  -d '{"status": "approved"}'

status is approved or denied. The resolver’s identity comes from the authenticated key, and the requester cannot approve their own request. A workspace export (GET /export, POST /export, GET /export/jsonl) is gated this way and needs the memory:export scope. It carries only the facts up to the caller’s sensitivity ceiling.


Break-glass access

Privileged access uses a two-person flow on /break-glass. One admin files a request with POST /break-glass; a different admin approves it with POST /break-glass/{id}/approve. Both must use an mk_admin_ key bound to a user. An approved grant is valid for 15 minutes.

The server issues such a key, only to a caller bound to a user, with POST /admin/scoped-keys and "type": "admin", or with mnemo keys scoped create --type admin. It lives 24 hours at most, its TOTP secret is shown once, and every request with it sends a current code in x-mnemo-mfa. These keys are only accepted with MNEMO_SCOPED_AUTH=1.


Sensitivity and retention

Memories are classified public, internal, confidential or restricted, and each key has a read ceiling. See Security & isolation.

A purge job runs daily and closes facts that are past the retention window of their tier. The defaults are 730 days for internal, 365 for confidential and 90 for restricted; managed session transcripts are kept 30 days. Read or change the windows per workspace with GET, PUT and DELETE /config/retention, or for the whole installation with /admin/config/retention. Set MNEMO_RETENTION_DRY_RUN=true to log what the job would do without doing it.

Deleting a memory for good, rather than closing it, needs the memory:hard_delete scope.


Erasure

Two operations remove data for good. Both need the memory:hard_delete scope.

  • Hard delete of one fact. DELETE /facts/{id}/hard deletes the row and writes a deletion-log row and an audit entry. No key is destroyed. With federation, the deletion reaches the peers that may hold the fact as a tombstone on their next sync, and each archives its copy. The facts DELETE /facts/purge removes reach them the same way.
  • Crypto-erasure of a person. POST /admin/erasure destroys the encryption keys of one subject of the workspace: a platform user (userId, every key that person accrued) or one actor (actorId, the key:<id> reference its facts carry). confirm must repeat the id. An agent policy that requires approval for a delete requires it here too, and a break-glass key needs the two-person grant.
curl -X POST http://localhost:3939/admin/erasure \
  -H "Authorization: Bearer mns_live_..." \
  -H "Content-Type: application/json" \
  -d '{"actorId": "key:mk_0123456789abcdef", "confirm": "key:mk_0123456789abcdef"}'
{ "subject": { "kind": "actor", "id": "key:mk_0123456789abcdef" }, "keysDestroyed": 1 }
mnemo erase --user <userId> --confirm <userId>
mnemo erase --actor key:mk_0123456789abcdef --confirm key:mk_0123456789abcdef

The TypeScript client calls it eraseSubject.

  • An erasure_initiated audit entry is written before any key is touched. If it cannot be written, nothing is destroyed. A terminal erasure_complete follows with the number of keys destroyed.
  • Rows are not deleted. The confidential and restricted text stays as ciphertext no key can open: reads return it as [erased] and recall leaves it out. The text of public and internal facts and the stored vectors are not touched.
  • The answer is 400 without exactly one subject (erasure_subject_required) or when confirm does not repeat it (erasure_not_confirmed), and 404 when the subject has no live key left.
  • An agent whose policy requires approval for delete_fact needs one for an erasure too, and a break-glass key needs the two-person grant.
  • There is no MCP tool for it, on purpose: memory_purge deletes rows and destroys no key.

The daily retention job also destroys an actor’s keys once all of that actor’s encrypted facts have expired.


PII

POST /remember redacts emails, phone numbers, card numbers, SSNs, API keys, IP addresses and tokenised URLs before a statement is stored. The patterns are conservative; this is not a guarantee that no personal data is stored.


Webhooks

Outgoing webhook payloads are signed with HMAC-SHA256. Verify the Mnemosyne-Signature header (t=<unix seconds>,v1=<hex>) against the endpoint’s secret before trusting a delivery.


Data residency

Your data lives where you run Postgres. On top of that, MNEMO_REGION pins workspaces to the region an instance serves:

MNEMO_REGION=eu-west-1
  • A workspace created by an instance with MNEMO_REGION set takes that region (mnemo_workspace.region, migration 0062). The region never changes: to move a workspace, export it and import it into a workspace created in the other region.
  • On an instance with MNEMO_REGION set, a call for a workspace pinned to another region is refused. HTTP and the dashboard answer 403 wrong_region with details.homeRegion and details.instanceRegion, gRPC answers PermissionDenied, and a WebSocket upgrade is closed with 1008.
  • If the region cannot be read while the lock is on, the call is refused, not let through.
  • Workspaces created before migration 0062, or by an instance without MNEMO_REGION, have no region and pass everywhere.
  • Unset, the instance runs in single-region mode and checks nothing. Health probes and /metrics are never checked.
  • The header of a JSONL export reports the workspace’s region when it has one.

Evidence script

scripts/collect-soc2-evidence.sh in the repository gathers an evidence bundle into a soc2-evidence-YYYYMMDD/ directory:

DATABASE_URL="postgres://user:pass@host/db?sslmode=require" \
PROMETHEUS_URL="https://prom.internal" \
bash scripts/collect-soc2-evidence.sh
⚠️

The script is a template. Without DATABASE_URL and PROMETHEUS_URL it writes stubs instead of real data. Check every file before you hand the bundle to anyone.

docs/compliance/ in the repository holds a controls matrix and a vendor register. They are working documents, not audited statements.


Reporting a vulnerability

Use GitHub private vulnerability reporting on the repository: Security, then “Report a vulnerability”.