Encryption at rest
Membrane’s SQLite backend uses SQLCipher to encrypt the database file. The encryption key is applied viaPRAGMA key at database open time.
Set the encryption key
Set the key via the environment variable (recommended) or in the config file.Or in
config.yaml:Config:
TLS transport
The gRPC server supports optional TLS. Provide a certificate and key file to enable it.API key authentication
Membrane supports bearer-token authentication for gRPC clients via theauthorization metadata header.
When
api_key is empty in both config and environment, authentication is disabled and all gRPC requests are accepted.
Rate limiting
Membrane uses a token bucket rate limiter applied per client. Configure the rate viarate_limit_per_second:
| Value | Behavior |
|---|---|
100 (default) | 100 requests per second per client |
0 | Rate limiting disabled |
ResourceExhausted error.
Trust-aware retrieval
Trust-gated retrieval is the primary data access control boundary in Membrane. Every retrieval request must supply aTrustContext that specifies:
MaxSensitivity— the highest sensitivity level the caller may access.Authenticated— whether the caller is authenticated.ActorID— who is making the request.Scopes— the visibility scopes the caller is allowed to access.
Sensitivity levels
Records are assigned a sensitivity level at ingestion (default:low). The sensitivity ladder is:
| Level | Order |
|---|---|
public | 0 |
low | 1 |
medium | 2 |
high | 3 |
hyper | 4 |
medium is accessible only to trust contexts with MaxSensitivity of medium, high, or hyper.
Graduated exposure (redacted access)
Records at exactly one sensitivity level above the caller’sMaxSensitivity are returned in redacted form: metadata only, with the payload stripped. This gives the caller awareness that relevant but restricted records exist, without exposing sensitive content.
Records two or more levels above the threshold are not returned at all.
Scope filtering
Records can be tagged with a scope at ingestion. When the trust context’sScopes list is non-empty, only records whose scope matches one of the allowed scopes (or records with no scope) are returned.
Input validation
The ingestion policy engine validates all candidates before writing to the store:- Required fields —
Source,EventKind,Ref(for events),Subject+Predicate(for observations),ThreadID+State(for working state). - Sensitivity values — must be one of
public,low,medium,high,hyper. - Payload size limits — enforced at the gRPC transport layer.
- String length checks — long strings are rejected before reaching the store.
- Tag count limits — excessive tag arrays are rejected.
- NaN/Inf rejection — floating-point fields (salience, confidence) are validated against NaN and Inf.
Audit trail
Every write operation—ingestion, revision, reinforcement, penalization, and outcome recording—appends a structured entry to the record’sAuditLog:
GetMetrics snapshot via TotalAuditEntries. This provides a full, queryable provenance trail for every record’s lifecycle.