Repository navigation
docs: state the catalog trust boundary for the credential encryption key #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
253d167
cac6eee
754cdee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,14 @@ This document describes the security architecture of extenddb, including the thr | |
| 1. **Client ↔ extenddb**: Untrusted. All input is validated. SigV4 signatures are verified. IAM policies are evaluated. | ||
| 2. **extenddb ↔ PostgreSQL**: Trusted network. The PostgreSQL connection string contains credentials. Use TLS for the PostgreSQL connection in production (`sslmode=require` in the connection string). | ||
| 3. **Admin ↔ Management API/Console**: Authenticated via admin credentials or IAM user credentials. CSRF tokens protect the web console. | ||
| 4. **Catalog database contents**: Credential-equivalent. The AES-256-GCM key that encrypts access key secrets lives in the catalog `settings` table alongside the ciphertext it protects, so read access to the catalog database yields every stored access key secret. On PostgreSQL the same table holds `data_database_connection_string`, the login for the data database; the console, the management API and the `settings` CLI mask it, but a reader of the catalog database gets it in full. Treat catalog read access, and any catalog backup, as equivalent to holding those credentials. See [Credential Storage](#credential-storage). | ||
| 5. **Server host**: Credential-equivalent as well. `extenddb.toml` holds the catalog connection string, and a running server keeps the encryption key and recently used decrypted secrets in process memory, so read access to the config file, a core dump of the server, or a read of its memory yields the same credentials. | ||
|
|
||
| ### Out of Scope | ||
|
|
||
| - **PostgreSQL security**: extenddb relies on PostgreSQL access controls and network security. Securing the PostgreSQL instance (firewall rules, TLS, authentication) is the operator's responsibility. | ||
| - **Operating system security**: File permissions on `extenddb.toml`, TLS keys, and the PID file are the operator's responsibility. | ||
| - **Key management**: Access key secrets are encrypted with a locally generated AES key stored in the catalog database. For HSM-grade key management, use a KMS-backed encryption layer at the PostgreSQL level. | ||
| - **Key management**: extenddb generates the credential encryption key locally and stores it unwrapped in the catalog database. It does not wrap the key with an external KMS or HSM, derive it from an operator passphrase, or rotate it. Deployments that require any of those must add protection below extenddb, for example an encrypted volume, a managed database with a customer-managed KMS key, or a PostgreSQL distribution that adds transparent data encryption. That protects the key at rest but not from a principal that can query the catalog. | ||
|
|
||
| ## Authentication | ||
|
|
||
|
|
@@ -54,7 +56,10 @@ extenddb uses SigV4 signature verification with a local credential store and IAM | |
| #### Credential Storage | ||
|
|
||
| - Secret keys encrypted with AES-256-GCM using a per-catalog encryption key | ||
| - Encryption key generated during `extenddb init` and stored in the catalog database | ||
| - Encryption key generated during `extenddb init` and stored unwrapped in the catalog `settings` table, under the key `encryption_key` | ||
| - The encryption key and the ciphertext it protects therefore share one trust domain: anyone who can read the catalog database can decrypt every stored access key secret. Restrict catalog database access to the extenddb service account, and protect catalog backups to the same standard as the credentials themselves. | ||
| - The management API and web console redact `encryption_key` from settings responses. The key is readable only with catalog database access: a database client, or `extenddb settings get encryption_key --show-secret` on a host that holds the catalog connection string. | ||
| - extenddb has no command to rotate the encryption key. Rotating it by hand makes every stored access key secret and session credential unreadable: re-create all access keys under the new key, then restart the server, which keeps the old key and decrypted secrets in memory. | ||
| - Console passwords hashed with bcrypt (cost factor 12) | ||
| - No in-process credential cache — every request reads directly from PostgreSQL | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hasn't been true for a while: unencrypted credentials are in-memory with a running extenddb server.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. #786 rewrites this bullet with a section on the credential and policy caches, so I left this line to it, to keep the two PRs from conflicting. The new Server host item in Trust Boundaries says the running server keeps the key and recently used decrypted secrets in memory. |
||
|
|
||
|
|
@@ -229,7 +234,7 @@ Import/export file paths are validated: | |
|
|
||
| - `extenddb init` prints admin credentials once; they are not stored in plaintext | ||
| - The `--password` flag accepts passwords via environment variable (`EXTENDDB_ADMIN_PASSWORD`) to avoid process listing exposure | ||
| - Access key secrets are shown once on creation and cannot be retrieved afterward | ||
| - Access key secrets are shown once on creation, and no API or console page returns them again; a reader of the catalog database can still decrypt them (see [Credential Storage](#credential-storage)) | ||
|
|
||
| ### Logging | ||
|
|
||
|
|
@@ -252,7 +257,7 @@ pg_dump extenddb_catalog > catalog_backup.sql | |
| pg_dump extenddb_catalog_data > data_backup.sql | ||
| ``` | ||
|
|
||
| Encryption keys are stored in the catalog database. A catalog backup includes the encryption key needed to decrypt access key secrets. | ||
| The encryption key is stored in the catalog database, so a catalog dump contains both the key and the encrypted access key secrets. A catalog backup is credential-equivalent: store it encrypted, restrict who can read it, and do not copy it to less-protected environments (for example a developer machine or a shared bucket) to reproduce an issue. | ||
|
|
||
| --- | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my suggested wording got the order wrong and also omits a major difficulty with this.
The working order is: replace the encryption key, restart every server (which still is using the old encryption key it has in memory), then re-create the access keys.
However, that means that after the restart every stored access key and session credential will fail to decrypt, so every signed request fails. The user will have to not only recreate all access keys needed by clients, but also distribute the new keys and secrets to each client to enable that client to successfully log in. Major headache people should be aware of before attempting a rotation.
Could the bullet say that plainly? For example:
"Extenddb has no command to rotate the encryption key. Replacing it by hand invalidates every access key and session credential. Replace the key, restart every server, then re-create all access keys and give each client its new credentials. After the restart, each client's requests will until the client has its new credentials."