HexDB

Search HexDB

Find a feature, an API example, a step, a FAQ answer or a term, then jump to it.

Security

Secure by Default, Not by Checklist.

There is no unauthenticated mode. Every request outside a short public list needs credentials, refusals are audited, and everything on disk is encrypted with a key only you hold.

Listen to the podcast - 5:41 min

Security: Encryption, Tokenization and Access Control

AES-256-GCM at rest and TLS in transit, API keys, sessions and MFA, role grants, row filters and field masks, and one_way and vault field tokens.

0:00--:--
  1. Authentication
    HttpOnly, SameSite=Strict session cookies for browsers; hxk_ API keys for scripts and services; OAuth access tokens from Entra ID, Okta, Auth0 and other OpenID Connect providers, acting as existing users. Argon2id passwords. Role changes apply on the next request.
  2. Multi-factor
    TOTP (RFC 6238) with every authenticator app, plus ten single-use backup codes. No code is ever accepted twice.
  3. Access Control
    Built-in and custom roles granted per tessellation or stream, with row filters, hidden fields, and masked fields per role (a card number reads as ************1111). Every handler checks before it looks anything up, so a 403 never reveals whether something exists.
  4. Audit Trail
    Sign-ins, failures, key changes, schema and index changes, bulk and cascading deletes, restores and purges, refusals and maintenance, with actor, target, outcome and client address. Ship it to a SIEM with a plugin.
  5. Brute-force Protection
    Failed sign-ins are throttled per login and per address, and the count is shared across the whole lattice. Unknown logins take as long as wrong passwords.
  6. Between Hexes
    Discovery is a mutual challenge-response; replication requests carry single-use, time-boxed keyed-BLAKE3 signatures. The lattice key is never sent and rotates live.
  7. File Permissions
    Uploading, deleting and restoring files are permissions of their own, separate from editing a file's details, and a role can be limited to folders: upload only into /inbox/, say.
  8. Write-only Secrets
    API keys in the lattice configuration are sealed, never returned, logged or audited, and can only be replaced. Every change is a checksummed version you can roll back.
  9. Sealed in Memory
    Fields any role masks are kept encrypted wherever documents stay in memory and opened only while a request uses them, and core dumps are off by default, so neither a memory dump nor a crash file holds card numbers in the clear.
  10. Tokenization
    Mark a field in the schema and its value is replaced by a token on write (tok_..._4242), before it reaches the log, memory, disk, replicas or backups. Lookups and joins by the real value still work. Vault tokens can be revealed by users with the detokenize permission, each reveal audited; one-way tokens can't be reversed at all.
  11. Malware Scanning
    Every upload is scanned with ClamAV and YARA rules before it's stored. A file that matches is quarantined on the Overseer, never replicated or downloadable, until an administrator releases or deletes it, and stored files are rescanned as signatures change.
  12. AI on Your Terms
    Off until an administrator turns it on, with your own provider and key and a monthly token budget. Fields your roles hide never reach the model.

Sixteen Permissions, Any Combination

Built-in roles cover the usual cases (reader, writer, owner, operator, auditor, ai, admin). Custom roles pick from the same sixteen permissions.

PermissionAllowsScope
readGet, list, query, count, aggregate, the change feed; consume streamsper tessellation
writeInsert, replace, patch, delete; publish to streamsper tessellation
manageDelete tessellations; manage indexes, schemas and advice; configure streamsper tessellation
uploadUpload files and new versions; create files tessellations (with write)per tessellation
deleteMove files to the trash and delete them from itper tessellation
restoreRestore files from the trash and earlier versions of filesper tessellation
statusServer status, metrics, storage and lattice detailsglobal
logsThe server logglobal
auditThe audit trailglobal
pluginsPlugins and their delivery stateglobal
maintenanceFlush, compact and back upglobal
aiRun prompts through the lattice's AI provider, within its budgetglobal
chatAsk the AI chat about the data you can read, within the chat limitsglobal
shareMake sharing links to files and folders you can readglobal
detokenizeRead the real values behind vault tokens (audited)per tessellation
adminEverything: users, roles, settings, configuration, functions, schedules, joining hexesglobal

Grants, in One Request

A grant names a role and the tessellations it applies to. Streams use the resource name stream:<name>. A grant on * covers everything.

# A grant names a role and the tessellations it applies to
curl -X POST http://localhost:7700/users -H "Content-Type: application/json" -d '{
  "login": "ada", "password": "correct horse battery staple",
  "roles": [{ "name": "writer", "tessellations": ["orders", "customers"] },
            { "name": "reader", "tessellations": ["*"] }] }'

# Custom roles from any set of permissions
curl -X POST http://localhost:7700/roles \
  -d '{ "name": "analyst", "permissions": ["read", "status"] }'

Row Filters, Hidden and Masked Fields

A role can be restricted per tessellation: a filter that limits which documents it sees and writes, using the caller's login, email or attributes, fields it can never see or change, and fields it sees masked, with at most the first 6 and last 4 characters showing, as PCI DSS allows for card numbers.

# A role that only sees and writes its own region, never sees cost or margin,
# and sees card numbers as ************1111
curl -X POST http://localhost:7700/roles -H "Content-Type: application/json" -d '{
  "name": "regional", "permissions": ["read", "write"],
  "restrictions": { "orders": { "filter": { "region": { "$user": "attributes.region" } },
                                "hide": ["cost", "margin"],
                                "mask": { "card": { "show_last": 4 } } } } }'

curl -X PATCH http://localhost:7700/users/ada -d '{ "attributes": { "region": "EU" } }'
# Queries, counts, aggregations, GraphQL and the change feed all see only matching documents (a delete event carries only the ID).
# Filtering or sorting on a hidden or masked field is refused, so values can't be probed.
  • • Responses carry nosniff, DENY framing, a no-referrer policy and a Content Security Policy.
  • • Other sites can't read responses unless their origin is listed in cors.allowed_origins, and credentials never cross origins. Cookie-authenticated changes must be same-origin (CSRF protection).
  • • TLS is two settings away, with HSTS, Secure cookies and HTTPS replication between hexes.

Compliance

Built for PCI DSS, HIPAA and SOC 2.

The controls these standards ask a database for are built into HexDB, in every edition: encryption at rest, field masks, least-privilege roles, multi-factor sign-in, an audit trail, backups and failover. Here is what each requirement maps to.

  1. PCI DSS

    For card numbers and the systems that store them.

    3.4.1 Mask PAN when displayed
    Field masks: a role reads a card number as ************1111, never more than the first 6 and last 4.
    3.5.1 Render stored PAN unreadable
    AES-256-GCM on the stored data (documents, files, indexes and the write-ahead log), with a key only you hold.
    3.6, 3.7 Key management
    Keys rotate without downtime; a hex without the key refuses to start rather than discard anything.
    4.2.1 Strong cryptography in transit
    TLS for clients, HTTPS replication between hexes, and sealed file chunks.
    7.2 Access by need to know
    Roles per tessellation, row filters, hidden and masked fields.
    8.3.4, 8.4 Lockout and MFA
    Sign-in locks after 5 failures; TOTP multi-factor authentication with backup codes.
    10.2 Audit logs
    Sign-ins, changes to accounts, roles and structure, and every refused request, with who, what, when and from where.
  2. HIPAA

    For protected health information, under the Security Rule's technical safeguards.

    164.312(a) Access control
    A unique account or API key per person and per app, with roles, row filters and field masks.
    164.312(a)(2)(iv) Encryption
    AES-256-GCM at rest, on every hex, for documents, files, indexes and the write-ahead log.
    164.312(b) Audit controls
    An audit trail of sign-ins, refused requests, and changes to accounts, roles, settings and structure.
    164.312(c) Integrity
    Authenticated encryption and BLAKE3 hashes on every fragment; damaged copies are repaired.
    164.312(d) Authentication
    Passwords with lockout, and TOTP multi-factor authentication.
    164.312(e) Transmission security
    TLS to clients and between hexes.
    164.308(a)(7) Contingency plan
    Online backups, every document on at least two hexes, and automatic failover.
  3. SOC 2

    For the Trust Services Criteria a SOC 2 report examines.

    CC6.1 Logical access
    Encryption at rest, roles, MFA, and no unauthenticated mode.
    CC6.7 Data in transit
    TLS and authenticated hex-to-hex traffic.
    CC7.2 Monitoring
    The audit trail, request logs, and metrics history in the admin UI.
    CC8.1 Change management
    Versioned schemas checked before they apply, with rollback, and versioned lattice configuration.
    A1.2 Recovery
    Online backups, replicas that take over in seconds, and crash recovery from the write-ahead log.
    PI1 Processing integrity
    Schema validation on every write, and atomic transactions.

What This Is, and Isn't

HexDB hasn't been through a PCI DSS assessment, a HIPAA audit or a SOC 2 examination. Compliance covers your whole system and how you run it, and an assessor or auditor checks that. HexDB gives that system a database whose controls map to the requirements above, so there is less to build around it.

Three Settings to Tighten

Some defaults are gentler than these standards ask for:

  • security.audit_retention_days = 365PCI DSS keeps audit logs for a year (the default is 90 days).
  • security.lockout_minutes = 30PCI DSS locks an account for at least 30 minutes (the default is 15).
  • [tls]Every standard here wants encryption in transit; HexDB Enterprise serves HTTPS already.