Data location, isolation and security

Where a database's data lives, how organizations are kept apart, how secrets are handled and what the control plane can and cannot reach.

This page states how the hosted service handles your data and credentials, as far as the service itself defines it. It describes behaviour you can check in the dashboard and the management API.

Where your data lives

A database runs on a cluster in the region you chose when you created it. That region does not change for the life of the database, and a backup is restored into the region of the database it was taken from.

Your documents are in the cluster. The control plane holds what it needs to manage the database, and nothing of its content:

The control plane holdsIt does not hold
Accounts, organizations, members and invitationsDocuments
Databases: name, region, plan, limits, stateDatabase key secrets
Credentials' metadata: name, permission, when created and revokedAPI key secrets (only a hash)
Token keys' public halvesToken keys' private halves
Operations, backups' catalog entries, usage figures
The audit log

The data path

Your application talks to its database's cluster directly. Neither the dashboard nor the management API is between your application and its data: they do not relay requests and are not needed for a connected application to keep working.

When the dashboard shows a database's collections and schema versions, it reads them from the cluster on your behalf. It does not show, read or store documents.

Isolation between organizations

Every resource belongs to one organization, and every request is checked against the organization of whoever makes it.

  • A person reaches only the organizations they are a member of, with the role they hold in each.
  • An API key reaches only its own organization, and only one database of it if it is scoped to one.
  • A resource in another organization is reported as not found, exactly as if it did not exist. Nothing reveals whether an ID belongs to someone else.

The same checks apply to the dashboard and the management API, because both go through the same rules: a rule is not something one of them enforces and the other forgets.

Access is checked when a change is made

A change is confirmed against the caller's access in the same step that makes it. If a member's role is lowered, a member is removed, or an API key is revoked or has its secret replaced while a request is in progress, that request does not complete a change afterwards.

Secrets

  • Shown once. The secret of a database key or an API key is displayed a single time, when it is created, rotated or replaced.
  • Not stored. For an API key the service keeps a SHA-256 hash of the secret and its last four characters. For a database key it keeps no part of the secret beyond its last four characters; the secret itself exists only in the database's cluster. The last four characters are shown so that you can tell keys apart.
  • Recognisable. Database key secrets start with mk_ and API key secrets with mc_sk_, so a leaked one is easy to identify.
  • Not in the audit log. Entries never contain a secret or document content.
  • Private keys stay with you. For token keys you register only a public key. The service never receives the private half.

A secret that was lost cannot be recovered by anyone. Rotate the database key, or replace the API key's secret.

What each credential can reach

CredentialDocumentsCollections and schemasDatabases and their credentialsMembers, API keys, audit log
Database keyYes, in its databaseWith the admin permissionNoNo
Document tokenOne documentNoNoNo
API keyNoNoYes, within its scopeNo
A signed-in memberNoRead-only, in the dashboardYesOwners and admins

See credentials and members and roles.

The service's operators

The service's operator functions, which are for running its clusters and for recovery, require access that is given to one person for a limited time and then expires. A change made with that access is recorded. It does not reach document content: the service has no operator function that reads documents. Apart from the one action below it does not reach an organization's databases or credentials either, and API keys and database keys never carry it.

One operator action concerns your data directly: restoring a backup of a database whose deletion's grace period is over, which is done on request, requires a stated reason, and is recorded in your organization's audit log.

Deletion

Deleting a database blocks access first and removes the database from its cluster after a grace period. Its keys are revoked, and what the cluster still retains of it is purged. Its backups are kept until their retention ends and are not deleted early. See database lifecycle and backups.

If a key leaks

  • A database key (read or write): revoke it on the Keys page, or rotate it with Revoke the old key now. The tokens it minted end with it.
  • A token key's private half: revoke the token key on the Token Keys page. The tokens it signed end with it.
  • A document token: Revoke all tokens on the Token Keys page ends every token issued so far and keeps the keys. Read what it requires of your tokens first: tokens without an issued-at claim are refused from then on.
  • An admin database key: besides documents, it can change collections and migrations, and create keys and register token keys in the database itself, which revoking it does not end.
    1. Create a new admin key if you need one, then revoke the leaked key. The tokens it minted end with it.
    2. Wait until Not made here on the Keys and Token Keys pages says it was last compared with the database after your last revocation (it is compared about every 15 minutes; the time is shown to the second).
    3. Revoke there, with Revoke key on their rows, the keys first seen since the leak that you do not recognise: admin keys first, since they can make more. The tokens they signed or minted end with them.
    4. Repeat steps 2 and 3 until a comparison after your last revocation shows nothing new: a key one of them made before you revoked it shows only then.
    5. Review the database's collections and migrations for changes you did not make.
  • An API key (management): revoke it under the organization's Settings → API Keys. It never reaches your documents, but it can create and revoke database keys, register token keys and revoke all tokens: check both keys pages and the audit log for what it did.

Your part

  • Keep database keys and API keys in a secret store, and out of browsers, mobile apps and source control.
  • Give each service the least permission it needs, and scope API keys to one database where you can.
  • Rotate keys when someone with access to them leaves. Removing a member does not revoke keys.
  • Give more than one person the owner role, so losing one account does not lock the organization.
  • Review the advisor and, as an owner or admin, the audit log.