Security & Compliance
Encryption, TLS / mTLS, RBAC, rate limits, breach detection, audit, SIEM, data residency, DSAR: every governance knob in cortex.toml.
This page covers [security], [governance], and [compliance] in cortex.toml: about 80 fields.
Most are off by default (PII detection and audit logging are on, and bearer auth is on unless you
set CORTEX_INSECURE_NO_AUTH=1) so you can evaluate quickly. Before
production, walk this page top to bottom and turn things on.
Retention is enforced; preset rate limits are headers
A scheduled retention sweeper (every CORTEX_RETENTION_SWEEP_INTERVAL_SECS, default
3600 s) erases events older than the retention policy, and a non-null
[governance] default_retention_ttl_secs becomes the deployment-wide default it sweeps against (a
30-day value reports deployment_default_days: 30). Setting it therefore deletes data. See
Retention & WAL. The preset's rate-limit quotas are reported in
response headers rather than enforced; per-tenant limits (CORTEX_SUBTREE_RATE_LIMITS, below) are
enforced, and anything else belongs at your load balancer.
Governance: the foundation
[governance]
default_retention_ttl_secs = 2592000 # 30 days; null = forever
max_retention_secs = 220752000 # 7 years (default cap)
pii_detection = true # default
pii_handling = "Flag" # "Flag" (default) | "Block"
audit_logging = true # default| Field | Default | What it does |
|---|---|---|
default_retention_ttl_secs | null (forever) | Deployment-wide retention default; the sweeper erases older events. |
max_retention_secs | 7 years | Hard upper bound, even for explicit "forever". |
pii_detection | true | Scan every event for PII before commit. |
pii_handling | "Flag" | "Flag": accept + mark for re-scan. "Block": reject if scanner is down or finds PII. |
audit_logging | true | Log every read/write to the audit trail (queryable via /v1/audit). Kept in memory and lost on restart unless CORTEX_V1_AUDIT_PATH names a file; see Audit Trail. |
Retention comes from policies; the audit path is /v1/audit
The deployment and per-scope retention policy is enforced by the sweeper (Retention & WAL).
Per-event values (ttl_seconds / expiration_date on an envelope) are stored with the event; expiry
comes from the retention policies, not from these fields. For selective deletion use
/v1/forget or /v1/erasures. The audit trail is queried at
/v1/audit: see Audit.
Encryption at rest
[security.encryption]
enabled = false # default off: turn this on
key_file = "/etc/cortexdb/keys/master.key"
key_rotation_interval_secs = 7776000 # 90 days
blob_store_sse_kms = false # use cloud KMS for blobsWhen enabled = true, all RocksDB column families and the WAL are encrypted with AES-256-GCM. The
key_file (32 random bytes) is required, must be mode 0600 owned by the cortexdb user, and old keys
are retained for decrypting historical segments across rotations.
head -c 32 /dev/urandom | base64 > /etc/cortexdb/keys/master.key
chmod 600 /etc/cortexdb/keys/master.key
chown cortexdb:cortexdb /etc/cortexdb/keys/master.keyFor HSM / cloud-KMS keys, mount the unwrapped key into tmpfs, point key_file at it, and rotate via
your KMS policy.
TLS and mTLS
[security.tls]
api_tls_enabled = false # default: terminate at LB instead
cert_path = "/etc/cortexdb/tls/cert.pem"
key_path = "/etc/cortexdb/tls/key.pem"
ca_cert_path = "/etc/cortexdb/tls/ca.pem"
mtls_enabled = false # require client certs on internal RPC
min_tls_version = "1.2" # "1.2" | "1.3"For "TLS at the LB, plaintext inside VPC", leave everything off. For zero-trust, enable API TLS + mTLS
and set min_tls_version = "1.3": every client (SDK, dashboard, peer node) needs a cert signed by the
CA at ca_cert_path.
Authentication and roles
Who may do what is decided per request by the caller's token and the roles on each scope:
- Sign-in through your identity provider (OIDC, JWT or PASETO): trust it with an
issuers-file entry (
CORTEX_AUTH_ISSUERS_FILE), which maps each token to a person or service and a tenant. - Roles (Owner, Writer, Reader, Summary) are granted on scopes and change through change sets; see Shared Memory.
- Capabilities come from the deployment preset, the tenant and the token (Authorization).
Configure sign-in and roles there. The [security.rbac] table in cortex.toml is not how they are set.
Simple bearer auth without OIDC
Setting CORTEX_API_KEY requires Authorization: Bearer on every request, and the value itself is the
working credential (constant-time compared; PASETO v4 / JWT bearers also work). There is no shipped
default key. To run unauthenticated for local dev, set CORTEX_INSECURE_NO_AUTH=1 (every request
served as user:local, or as whatever X-Cortex-Actor names). It does not restrict the bind:
the server listens on 0.0.0.0, so publish the port on loopback only (-p 127.0.0.1:3141:3141). A keyless, network-exposed server auto-generates a key and
requires it rather than serving open, and an X-Cortex-Actor header with no bearer is rejected on
every preset; see Authorization.
Rate limiting
[security.rate_limit]
enabled = false # default: no rate limit
default_rpm = 600 # requests per minute per actor
default_rpd = 50000 # requests per day per actor
burst = 20 # short-burst capacityThe preset's limits are informational
The server reports the preset's rate limit in headers but doesn't reject over-limit requests on it, so
enforce hard limits at your load balancer or gateway. The header value carries the deployment's
configured limit with a unit (e.g. x-ratelimit-limit: 50000/s), plus x-ratelimit-reset; there is no
x-ratelimit-remaining:
x-ratelimit-limit: 50000/s
x-ratelimit-reset: 2026-05-18T15:42:00ZPer-tenant limits
CORTEX_SUBTREE_RATE_LIMITS=read=RATE[:BURST],write=RATE[:BURST] gives each tenant subtree its own
token bucket per second (BURST defaults to twice RATE; off when unset). A subtree is the scope's first
CORTEX_TENANT_DEPTH segments (default 1, the root; 2 for tenants under a bucket root such as
org:b7/org:acme). Reads are /v1/recall, /v1/recall/stream, /v1/answer and /v1/compose;
writes are /v1/experience (one) and /v1/experience/bulk (one per item, all or none). A request is
charged only after it passed authorization; over the limit it answers 429 SUBTREE_RATE_LIMITED with
Retry-After and nothing was done. The buckets are per process: on a cluster each data node limits the
roots it serves.
Breach detection
[security.breach_detection]
enabled = false # default off
max_failed_auth = 5
auth_window_secs = 300 # 5-min sliding window
lockout_duration_secs = 3600 # 1-hour lockout
webhook_url = "" # POST URL for alertsFailed auths (bad JWT, expired token, denied capability) are counted per actor; exceeding
max_failed_auth within auth_window_secs triggers a lockout and an alert.
Field-level access control
[security.field_access]
enabled = false # default off
[security.field_access.masked_fields]
reader = ["content.text", "subject"] # fields masked for this roleWhen enabled, response payloads have masked fields replaced with "[REDACTED]" based on the actor's
role: useful for shipping recall results into a UI without exposing raw memory text.
Data residency
[compliance.data_residency]
enabled = false # default off
default_region = "us-east-1"
allowed_regions = [] # empty = allow all
block_cross_region_transfer = falseData stays where the deployment stores it, so residency is decided by where you run it: for EU-only or US-only data planes, run one deployment per region, in that region, with its storage and model providers in the same region.
Consent and purpose
[compliance.consent]
require_consent = false # default: no consent enforcement
default_purposes = ["customer_support"]
max_validity_secs = 31536000 # 1 year defaultWhen require_consent = true, every write must reference a consent record, and reads filter to events
whose consent is still valid and whose purposes include the caller's.
Record consent in your own system
There is no consent API for capture; keep lawful-basis and consent records in your own system and apply
them before you capture. What CortexDB may learn about a subject has its own consents:
a derivation policy can deny a sensitive topic unless the
subject consented, and PUT /v1/derivation/settings records the subject's consent with its purpose,
audited as derivation_consent.
Governed memory
Governed memory controls what enrichment learns from your events: derivation policies, subject settings and consents, corrections, review before commit, re-derivation, and a report of what was derived. CortexDB provides the controls; whether a deployment meets a law depends on how it uses them. They help with these duties:
- Data minimization and purpose limitation:
mode: explicit, stages, source rules, and topic and detector denials keep enrichment to what you need. Detectors are exact; topic labels are the extraction model's judgment, so test a topic policy on your own events before relying on it. - Consent for sensitive categories (for example GDPR Article 9, Washington's consumer health
data):
deny_unless_consenttopics, lifted only by a subject's recorded consent. - The right to limit sensitive personal information (California):
limit_spiin subject settings. - Objection and rectification:
objectionandmode: offin subject settings; corrections that stay applied. - Access and portability:
GET /v1/memory/about, with each item's sources. - Erasure: erasure reaches every governed record, and its receipt names the change-feed consumers that may hold a copy.
- Risk assessments and regulators' questions:
GET /v1/derivation/reportand the audit trail. - New York's General Business Law Article 48: the opt-in read-time use rule withholds earlier-session memory from users not established as adults. Your application asserts the age; CortexDB verifies none.
Classification and auto-redaction
[compliance.classification]
auto_classify = false # LLM assigns sensitivity tags on write
default_sensitivity = "Internal" # "Public" | "Internal" | "Confidential" | "Restricted"
auto_redact_above = "Confidential" # auto-redact fields above this levelWith auto_classify = true, the extraction LLM also assigns a sensitivity tag; fields above
auto_redact_above are stored encrypted and decrypted only for authorized roles.
DSAR (Data Subject Access Requests)
[compliance.dsar]
enabled = false # default offWhen enabled, /v1/erasures accepts subject-targeted delete requests:
# 1. Preview
curl -X POST https://api/v1/erasures/preview \
-H "Authorization: Bearer $TOKEN" \
-d '{"scope": "org:acme/user:alice", "audit_note": "DSR-1234 preview"}'
# 2. Execute: confirm_all is REQUIRED with no selector.memory_ids
curl -X POST https://api/v1/erasures \
-H "Authorization: Bearer $TOKEN" \
-d '{
"scope": "org:acme/user:alice",
"from_preview_id": "ervw_01HX...",
"confirm_all": true,
"idempotency_key": "dsr-1234",
"audit_note": "DSR-1234 fulfilled"
}'Execute needs confirm_all
An erasure with a from_preview_id but no selector.memory_ids erases the entire scope: the
server requires confirm_all: true (or an explicit selector.memory_ids), else
422 EMPTY_SELECTOR_WITHOUT_CONFIRMATION.
Erasures cascade across all five layers and are recorded in the audit log with the audit_note;
tombstones are kept for governance.max_retention_secs so re-derivations can't reincarnate erased
data.
SIEM forwarding
[compliance.siem]
enabled = false # default off
format = "cef" # "cef" | "leef" | "json"
output_path = "/var/log/cortexdb/siem.log"
webhook_urls = []
datadog_api_key = ""
splunk_hec_token = ""
batch_size = 100
flush_interval_secs = 30Security-relevant events (auth success/failure, rate-limit hits, breach alerts, erasures, PII blocks,
capability denials) are formatted and shipped to the local log, every webhook_urls endpoint, Datadog,
and/or Splunk HEC. CEF is most widely supported in enterprise SIEMs; JSON suits cloud-native
aggregators.
Cross-agent visibility
[compliance.cross_agent]
enabled = false # default off
default_visibility = "Private" # "Private" | "Team" | "Org" | "Shared""Private" isolates every agent, requiring explicit grants; "Team", "Org" and "Shared" widen what
agents see of each other's memories by default (useful for multi-agent systems).
What leaves your server
Three outbound calls, each with its own off switch. None of them carries memory content.
| Call | What it sends | Off switch |
|---|---|---|
| Usage count | Anonymous, aggregate usage counts (no request bodies, query text, stored content or IP addresses), on by default | CORTEX_TELEMETRY=0 (or DO_NOT_TRACK=1) |
| The console's update check | A request for the newest release | CORTEX_UPDATE_FEED_URL=off |
| License renewal | The license, a random id for the server and its version | CORTEX_LICENSE_URL=off (Your license) |
Calls to the model providers you configure (embeddings, answers, enrichment, reranking) are yours to choose: point them at machines on your own network to keep that text inside it. An air-gapped server turns off all three calls above and takes license renewals by hand.
Deployment preset
export CORTEX_DEPLOYMENT_PRESET=dev_local| Preset | Intended for |
|---|---|
dev_local | Local development and evaluation. The default. |
on_prem_enterprise | Self-hosted, single-organization deployments. |
cloud_shared_saas | Multi-tenant shared cloud. |
cloud_private | Dedicated single-tenant cloud. |
These four are the complete set: older startup/growth/enterprise names are not valid. The preset
primarily shapes auth posture; self-hosted, the in-binary minter (/v1/auth/signup, /v1/auth/tokens)
is off by default (503 NOT_CONFIGURED): enable it with CORTEX_V1_MINTER_ENABLE=1. Individual
controls are enabled by their own security.* / compliance.* sections. See
Deployment Presets.
A compliance-shaped checklist
Before shipping to a regulated environment:
governance.default_retention_ttl_secs(or a per-scope policy) set, knowing the sweeper deletes events past it; dry-run the sweep first (Retention & WAL).governance.pii_handling = "Block";governance.audit_logging = true.security.encryption.enabled = truewithkey_fileowned0600bycortexdb.security.tls.api_tls_enabled = trueor TLS terminated at a trusted LB;mtls_enabled = truefor inter-node RPC;min_tls_version = "1.3".- Sign-in through your identity provider, trusted with an issuers-file entry.
- Hard rate limits:
CORTEX_SUBTREE_RATE_LIMITSper tenant, and your LB / gateway for the rest (the preset's quotas are headers-only). security.breach_detection.enabled = truewith awebhook_urlto your SOC.compliance.data_residency.enabled = trueif you have regional obligations;compliance.dsar.enabled = truefor GDPR/CCPA DSARs;compliance.siem.enabled = true.- A scheduled, verified cold backup shipped off-host with ≥30d retention and periodic test-restores.
- With enrichment on: a derivation policy chosen from a template, tested on your own events, and activated; a way for users to correct what was learned; and the derivation report in your periodic review.
Then start from the Enterprise profile.
Next steps
- Profiles & Presets: the full Enterprise profile
- Storage & Cluster: backups and durability
- Authorization: the role / capability model
Retention & WAL Maintenance
Operator-driven expiry of old events and reclamation of dead write-ahead-log rows: per-scope rules, dry-run sweeps, and the WAL census.
Token & Cost Ledger
GET /v1/admin/usage: durable per-role token and dollar accounting, what it measures exactly, what it only bounds, and what it refuses to price.