diff --git a/README.md b/README.md index ac538e6..5183bf8 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,48 @@ -# Dotkeep +
-**A secure home for your project secrets.** Keep API keys, tokens, webhook URLs and `.env` values in one encrypted vault, organised by project and environment, with an audit trail and team sharing. +

+ + Dotkeep +

+ +**The secrets vault for your projects.** + +Keep API keys, tokens, webhook URLs and `.env` values in one encrypted place, organised by project and environment,
+with an audit trail and per-project sharing. Optional end-to-end encryption means not even the server can read your values. [![CI](https://github.com/Munishwar001/dotkeep/actions/workflows/ci.yml/badge.svg)](https://github.com/Munishwar001/dotkeep/actions/workflows/ci.yml) ![Next.js](https://img.shields.io/badge/Next.js-16-black) ![TypeScript](https://img.shields.io/badge/TypeScript-5-3178c6) ![MongoDB](https://img.shields.io/badge/MongoDB-7-47a248) +![Status](https://img.shields.io/badge/status-beta-orange) + +
+ +> **Status: beta.** Dotkeep is a working product, but it has not had an independent security review yet. Until it has, keep high-value production secrets elsewhere. See [Security](#security) for exactly what is and isn't protected. --- -## Why Dotkeep +## Demo -Secrets end up in chat messages, notes and loose `.env` files. Dotkeep gives them one place to live, so you always know where a value is, who touched it, and who can see it. +
+ +
+ +## What it is + +Secrets end up in chat messages, notes and loose `.env` files. Dotkeep gives them one home, so you always know where a value is, who touched it, and who can see it. + +| You want to… | Dotkeep gives you… | +|---|---| +| Stop pasting keys into chat | One vault per project, with local, staging and production side by side | +| Know who saw or changed a secret | An audit log of every view, change, move, import and export (it never records values) | +| Share a project safely | Owner, editor and viewer roles, per project, revocable instantly | +| Limit the damage of a leak | Encryption at rest, two-factor sign-in, and a code requirement before Reveal, Copy or Export | +| Keep even the host out | Opt-in end-to-end encryption with a passphrase and a recovery key | + +The public docs are at **/docs** and need no sign-in. ## Features @@ -24,20 +55,25 @@ Secrets end up in chat messages, notes and loose `.env` files. Dotkeep gives the **Import, export and backup** - Import and export a single environment as `.env` or JSON. -- One-click **whole-vault backup and restore**. +- One-click **whole-vault backup and restore** (not available on end-to-end accounts, see below). -**Teams** +**Sharing** - Share a project by email as **owner**, **editor** or **viewer**. Access changes take effect immediately. -- An **audit log** records who viewed, changed, moved, imported or exported what, and when. It never records values. +- The **audit log** records who viewed, changed, moved, imported or exported what, and when. **Account security** -- Email and password sign-in with verification, or Google sign-in. +- Email and password sign-in with email verification, or Google sign-in. - **Two-factor authentication** (authenticator app) with one-time recovery codes. - **Protect secret values:** require a 2FA code before Reveal, Copy or Export. - Session list with per-device sign-out, and password-change alerts by email. +- **Opt-in end-to-end encryption** (Settings), with a passphrase and a recovery key. - Admin area for user management and a server error record. -## How secrets are protected +## Security + +Dotkeep stores secrets in one of two ways. You choose per account. + +### Default: encrypted on the server | Measure | Detail | |---|---| @@ -49,8 +85,41 @@ Secrets end up in chat messages, notes and loose `.env` files. Dotkeep gives the | Abuse limits | Rate limits on sign-in, reveal, export and 2FA attempts | | CSRF | Same-origin checks on state-changing requests, JSON only | | Server-side validation | All input and limits are enforced on the server | +| Headers | `nosniff`, `X-Frame-Options: DENY`, `Referrer-Policy`, `Permissions-Policy` | + +The server holds the key, so it **can** decrypt a value when you reveal it. This protects you if the database leaks. It does not protect you if the server itself is compromised. + +### Opt-in: end-to-end encrypted -> **End-to-end encryption is opt-in (Settings), not the default.** By default, values are encrypted on the server with a key the server holds, so the server can decrypt them when you reveal one. With end-to-end encryption on, your browser encrypts values with a vault key protected by a passphrase (PBKDF2-SHA256 → AES-256-GCM) and a recovery key, and the server only stores ciphertext. Shared projects, .env import and backup restore stay server-side or unavailable while it is on; see the docs. The server-side default protects you if the database leaks, but not if the server itself is compromised. Use 2FA and *Protect secret values* for extra protection, and treat the encryption key as the crown jewels. +Turn it on in **Settings**. Your browser encrypts each value with a vault key before sending it. The vault key is stored only in locked form: once locked by your **passphrase** (PBKDF2-SHA256, 600,000 iterations) and once by a **recovery key**. The server stores ciphertext and never receives the passphrase, the recovery key or the vault key. + +Limits you should know before using it: + +- **Lose both the passphrase and the recovery key and the secrets are gone.** Nobody can recover them, including us. +- Shared projects stay server-side encrypted (members don't have your vault key). +- Import and whole-vault backup restore are off for end-to-end accounts. +- Names, environments, types and notes are not encrypted. +- The vault locks on page reload and asks for the passphrase again. +- A web app's JavaScript comes from the server, so a fully compromised server could serve altered code. A CLI or browser extension would close that gap. +- A weak passphrase can be guessed offline by someone who copies the locked key. + +### Reviews and reporting + +- Internally reviewed and covered by an automated security regression suite. **Not independently audited.** +- Found a vulnerability? Please report it privately, not in a public issue. Use **Security → Report a vulnerability** on this repository (the repo owner needs to have private reporting switched on in the repository settings). + +## Architecture + +``` +Browser ──HTTPS──▶ Next.js (App Router, Vercel) ──▶ MongoDB Atlas + │ │ + │ ├─ session cookie + CSRF checks on every write + │ ├─ AES-256-GCM (VAULT_ENCRYPTION_KEY) for server-side values + │ └─ SMTP for verification, reset and alert emails + └─ end-to-end mode: WebCrypto encrypts/decrypts in the browser; the server only sees ciphertext +``` + +Secret writes and the end-to-end migration use MongoDB **transactions**, so a replica set or Atlas is required. ## Tech stack @@ -58,11 +127,11 @@ Secrets end up in chat messages, notes and loose `.env` files. Dotkeep gives the - MongoDB (official driver) - Tailwind CSS 4 and shadcn/ui - Nodemailer for email, Google OAuth for optional social sign-in -- GitHub Actions CI, deployable on Vercel +- GitHub Actions CI, deployed on Vercel ## Getting started -**Requirements:** Node.js 20+ and a MongoDB database (local or Atlas). +**Requirements:** Node.js 20+ and MongoDB as **Atlas or a local replica set** (transactions don't work on a standalone server). ```bash git clone https://github.com/Munishwar001/dotkeep.git @@ -83,20 +152,22 @@ Then start the app: npm run dev ``` -Open . +Open . A quick check that the database is reachable: . ### Environment variables | Variable | Required | Purpose | |---|---|---| -| `MONGODB_URI` | Yes | MongoDB connection string | +| `MONGODB_URI` | Yes | MongoDB connection string (Atlas or a replica set) | | `MONGODB_DB` | No | Database name (defaults to the one in the URI) | -| `VAULT_ENCRYPTION_KEY` | Yes | 32 random bytes, base64. Encrypts every secret and every 2FA secret | +| `VAULT_ENCRYPTION_KEY` | Yes | 32 random bytes, base64. Encrypts every server-side secret and every 2FA secret | | `APP_URL` | Yes | Public site address, used to build links in emails | | `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS`, `MAIL_FROM` | Production | Sends verification, reset and alert emails. In development, emails are printed to the terminal when `SMTP_HOST` is empty | | `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` | No | Enables "Continue with Google" | -> **Back up `VAULT_ENCRYPTION_KEY`.** If it is lost, every stored secret and every 2FA secret is unrecoverable. Use the same key on every machine and never commit it. +See [.env.example](.env.example) for the full, commented list. + +> **Back up `VAULT_ENCRYPTION_KEY`.** If it is lost, every server-side secret and every 2FA secret is unrecoverable. Use the same key on every machine and never commit it. End-to-end secrets don't depend on this key. ### Making an admin @@ -120,30 +191,39 @@ CI runs types, lint, unit tests, a production build and the API tests against a ## Documentation -The docs are public at **/docs** and linked from the sidebar. Deeper write-ups of each area are in [docs/](docs): - | Guide | Covers | |---|---| | [VAULT_FLOW.md](docs/VAULT_FLOW.md) | Projects, secrets, encryption, history, sharing, backup | | [SETTINGS_FLOW.md](docs/SETTINGS_FLOW.md) | Profile, password, sessions, 2FA, account deletion | +| [e2ee-study-guide.md](docs/e2ee-study-guide.md) | How end-to-end encryption is built, flow by flow | | [EMAIL_VERIFICATION_FLOW.md](docs/EMAIL_VERIFICATION_FLOW.md) | Sign-up and email verification | | [PASSWORD_RESET_FLOW.md](docs/PASSWORD_RESET_FLOW.md) | Password reset and alerts | | [ADMIN_FLOW.md](docs/ADMIN_FLOW.md) | Admin tools | | [DB_FLOW.md](docs/DB_FLOW.md) | Collections and indexes | | [CI_AND_ERRORS.md](docs/CI_AND_ERRORS.md) | CI, error pages, error record, pre-commit hook | -## Deploying +## Running it in production -Dotkeep deploys to [Vercel](https://vercel.com) (configured for the `bom1` region in [vercel.json](vercel.json)) with MongoDB Atlas. Before going live: +Dotkeep deploys to [Vercel](https://vercel.com) (configured for the `bom1` region in [vercel.json](vercel.json)) with MongoDB Atlas. +**Before going live** 1. Set every variable above in your host's environment settings, with `APP_URL` set to your real `https://` address. -2. Configure SMTP so verification and reset emails can be sent. +2. Configure SMTP on your own domain (SPF and DKIM) so verification and reset emails arrive. 3. Store `VAULT_ENCRYPTION_KEY` in a password manager as well as in the host. -4. Protect `main` in GitHub and require the **checks** status before merging. +4. Turn on Atlas backups, and do one test restore. +5. Protect `main` in GitHub and require the **checks** status before merging. + +**Not in place yet** (see the roadmap): a Content-Security-Policy and HSTS, error monitoring such as Sentry, encryption-key rotation, and an independent security review. ## Roadmap -Not available yet, and not promised: changing your email, dark mode, custom tags, a terminal (CLI) for pulling and pushing secrets, and teams or organisations beyond per-project sharing. +Not available yet, and not promised: + +- Hardening: CSP and HSTS headers, error monitoring, key rotation, an independent security review +- A way to reset an end-to-end vault if both keys are lost +- Changing your email, dark mode, custom tags +- A terminal (CLI) for pulling and pushing secrets +- Teams or organisations beyond per-project sharing ## Contributing diff --git a/docs/logo.svg b/docs/logo.svg new file mode 100644 index 0000000..046b014 --- /dev/null +++ b/docs/logo.svg @@ -0,0 +1,5 @@ + + + + +