| 1 | # Security |
| 2 | |
| 3 | *[中文版](SECURITY.zh-CN.md)* |
| 4 | |
| 5 | Utopia is at v0.1. Below are the **known, unresolved** limits — not a vulnerability report, |
| 6 | but the places the design has not reached yet. |
| 7 | |
| 8 | ## Before you put this on a public network |
| 9 | |
| 10 | **Credentials are stored in the clear.** LLM API keys and Ask-the-Data connection strings |
| 11 | are plain text in Postgres (`llm_settings.chat_api_key`, `data_sources.conn_string`). Anyone |
| 12 | who can read the database can read them. Encryption at rest is a 1.0 item; until then, keep |
| 13 | the system and its database inside a trusted network. |
| 14 | |
| 15 | **The default database password is `utopia`.** By default the port binds to loopback |
| 16 | (`127.0.0.1:1517`), so nothing outside the host can connect. If you change `UTOPIA_DB_BIND` |
| 17 | to expose it, change `UTOPIA_DB_PASSWORD` in `.env` first. |
| 18 | |
| 19 | **A data source is only as safe as its grants.** Registering one is a deployment-level |
| 20 | action, but the connection string reaches every workspace the source is granted to. Grant it |
| 21 | only where that database should be visible, and use a read-only database role in the string |
| 22 | itself — the SQL gate below is defence in depth, not a substitute for least privilege at the |
| 23 | source. |
| 24 | |
| 25 | ## What is in place |
| 26 | |
| 27 | - **JWT signing key generated on first start** — 32 bytes from a CSPRNG, stored in the |
| 28 | database. No deployment shares a default key. |
| 29 | - **`Secure` on session cookies behind TLS** — decided from `X-Forwarded-Proto`, so local |
| 30 | HTTP development still works. Force it with `UTOPIA_COOKIE_SECURE=true` if your proxy |
| 31 | omits the header. |
| 32 | - **Database port bound to loopback** — `127.0.0.1:1517`; the app reaches the database over |
| 33 | the compose network. |
| 34 | - **Optional least-privilege runtime role** — set `UTOPIA_APP_DB_PASSWORD` and |
| 35 | `UTOPIA_MIGRATION_URL`, and the app connects as a role that can only read and write |
| 36 | business tables and append to the ledger, while migrations run as the owner. |
| 37 | - **Data sources reach only granted workspaces** — a registered database is mounted into a |
| 38 | knowledge base only where an explicit grant exists. Before this, any base admin could |
| 39 | mount any registered source, which crossed tenants. |
| 40 | - **Read-only gate on Ask-the-Data** — parser allowlist, read-only transaction, enforced row |
| 41 | limit; three layers, so a statement past the parser still cannot write. |
| 42 | - **Accounts are deactivated, not deleted** — `users.deactivated_at` blocks sign-in while the |
| 43 | ledger keeps that person's decisions attributable. |
| 44 | - **Passwords hashed with argon2.** |
| 45 | |
| 46 | ## Reporting a vulnerability |
| 47 | |
| 48 | Email **security@deeplethe.com** rather than opening a public issue. Include the affected |
| 49 | version or commit, the endpoint or component, and steps to reproduce. You will get an |
| 50 | acknowledgement within a few days, and the release that carries the fix names you unless you |
| 51 | ask otherwise. |