# OsVault

> Keep API keys encrypted and give them to agents only inside the command they run: masked output, locked keys through a local proxy, no .env file.

Source: https://osevel.com/docs/products/osvault/

OsVault keeps your API keys and other secrets encrypted with a key only you hold, and gives
them to an agent only inside the command it runs. Where a key belongs to one service, the agent
gets a stand-in and the real key is put in on the way to that service. There is no `.env` file
on disk.

OsVault does one thing: it gives the environment to agents, locked. It does not manage agents,
and it never stops an agent to ask.

- [What it protects against](#what-it-protects-against)
- [Set up](#set-up)
- [Running a command with secrets](#running-a-command-with-secrets)
- [Locked keys](#locked-keys)
- [How it works](#how-it-works)
- [Sharing a vault](#sharing-a-vault)
- [Recovery by email](#recovery-by-email)
- [With the Osevel service](#with-the-osevel-service)
- [With the other Os products](#with-the-other-os-products)
- [Limits](#limits)

## What it protects against

- **Keys in plain files.** A `.env` file can be read by any agent working in the folder, and
  gets committed or pasted into a chat by accident.
- **Keys in what the agent reads back.** A value that a command prints is masked before the
  agent sees the output.
- **A copied key.** A locked key never enters the program the agent runs. The agent holds a
  stand-in that is worth nothing anywhere else.
- **Keys sent in a message.** You share a vault with a teammate by address; the values travel
  encrypted to their key.
- **Us.** Osevel's cloud stores ciphertext and signed records. It does not hold a key to your
  secrets, and it cannot see their names. The one exception is stated under
  [recovery by email](#recovery-by-email).

## Set up

You need an Osevel account, and the CLI on the computer where your agents run (Node.js 22.22 or
newer; macOS, Windows or Linux).

1. **Make a vault.** In the dashboard: **New** → a project → **Vault**. Type your keys or paste
   a `.env` file. Osevel sorts them into live and test; anything it does not recognise counts
   as live.
2. **Link the computer.** The Vault page shows the exact command with your dashboard's address:

   ```bash
   npx @osevel/cli vault connect --server https://<your dashboard>
   ```

   The terminal prints an address to open in the browser where you are signed in. Both screens
   then show the same 8 digits; confirm on both. `--name` gives the computer another name.

3. **Give the computer an environment.** On the Vault page, one button gives the linked
   computer `development`. Production is never given by default.
4. **Check.**

   ```bash
   osevel vault list
   ```

   shows the vaults and environments this computer was given. Names only, never a value.

5. **Give it to your agent.**

   ```bash
   osevel vault agent claude-code
   ```

   prints the MCP entry to add to the tool. The tools are `claude-code`, `cursor`, `codex`,
   `opencode` and `other`. The entry carries no token: the computer's link is the credential.
   The agent then has two tools: `vault_list` (names, kinds and notes, never values) and
   `vault_run` (one command with the secrets, the output masked).

Where the computer's own key is kept:

| System  | Key store                                                                    |
| ------- | ---------------------------------------------------------------------------- |
| macOS   | The Secure Enclave                                                           |
| Windows | A file sealed with DPAPI for your Windows user                               |
| Linux   | The desktop keyring (Secret Service, through `secret-tool`)                  |
| Any     | `--software-keys`: a key file. Refused when the Osevel service is installed. |

To drop the link on this computer, run `osevel vault forget` and unlink the computer in the
dashboard too.

## Running a command with secrets

```bash
osevel vault run -- npm run dev
```

The secrets are set in that command's environment only. Nothing is written to disk.

- Without `--vault <name>`, the computer must be linked to exactly one vault.
- Without `--env <name>`, the run uses `development`. It never picks another environment for
  you.
- Before the command starts, a line on stderr says which names were given, which are locked,
  and which were not given and why.

**Masking.** stdout and stderr each pass through a masker. A value, and its base64, hex, URL
and JSON forms, comes out as `[vault:NAME]`, also when it is split across writes. If the masker
fails, the output is withheld and the command is stopped.

**Names that are never given.** A secret may not be named like a variable programs rely on:
`PATH`, `HOME`, `NODE_OPTIONS`, `LD_*`, `DYLD_*`, `GIT_*`, `SSH_*`, `*_PROXY` and others. A
secret also never replaces a variable that is already set on the computer.

Through MCP, `vault_run` runs one command without a shell, with a timeout of at most ten
minutes, and returns the last 100 kB of the masked output.

## Locked keys

A locked key is bound to the address of the service it belongs to. The command gets a stand-in:

```
STRIPE_SECRET_KEY=osv_ph_…
```

A local proxy, started for that run only, puts the real key in place of the stand-in on
requests to that address and nowhere else. It checks the service's certificate as usual, and
masks the key if the service echoes it back. Other connections pass through untouched. The run
points the command at the proxy (`HTTPS_PROXY` and the usual certificate variables); the proxy
leaves through your company proxy if you have one.

- **Locked when saved, by their format:** Stripe, OpenAI, Anthropic, GitHub, Slack, SendGrid,
  Resend, Neon, Supabase Management, Vercel and Render keys. Nothing to set up.
- **Any other token:** fill in "Only sent to" (`api.example.com`) when you add it. In a pasted
  `.env`, a token next to its `https` address (`SHOPIFY_TOKEN` with `SHOPIFY_API_URL`) is locked
  to that address.
- The secret list shows "locked → host" or "masked" for each secret.

For a token you locked to an address yourself, the proxy puts the key in once per request and
only where a credential goes: a credential header (`Authorization`, `X-Api-Key`, …), a
credential parameter (`api_key`, `token`, …) or a whole path segment. A stand-in anywhere else
gets the request refused, so the key cannot be written into the service's data.

Secrets that are not locked are given as real values and masked in the output.

## How it works

- **Your password is the key.** The browser turns it into a key on your device. Osevel receives
  only a proof that you know it. Vault uses your Osevel password; it has none of its own, and
  the dashboard does not ask for it again while you are signed in.
- **Each environment has its own key**, wrapped to each member's account key and to each linked
  computer. A computer opens only the environments it was given.
- **Who may open a vault is a signed log**, not a list the cloud can edit. Each browser and
  computer checks the log and remembers how far it has seen it.
- **Names and notes are encrypted** together with the values.
- **The process that holds values** restarts itself hardened before it opens any, so the
  command it starts cannot attach a debugger to it.

## Sharing a vault

On the vault's page, make an invite link and send it yourself. The secret part of the link is
after the `#` and is never sent to a server. The person signs in and joins; both screens show a
code. Compare it with them once (a call, a chat) and confirm. You choose their role per
environment.

Removing someone, or taking an environment away from them, makes a new key for that environment
and saves its secrets again under it. The page lists the secrets that person could open, to
replace at the provider: a removed member keeps what they already read.

## Recovery by email

At set-up, the browser makes a recovery code and Osevel mails it to you once. Osevel does not
store it. With a forgotten password, you reset the password by email, enter the code from that
mail, and wait five minutes; a notice goes to your address and every signed-in browser.

What this costs, stated plainly: whoever takes over your mailbox can take over the account and
its secrets. Turn on two-step sign-in at your mail provider. And because Osevel sends the
recovery mail, a compromised Osevel at the moment of sending could keep the code. This is the
one exception to "Osevel holds no key to your secrets".

## With the Osevel service

With the Osevel service installed (daemon mode on macOS and Linux, see
[security](https://osevel.com/docs/security/model/#two-modes-unisolated-and-daemon)), `osevel vault connect` links the
**service**. The commands stay the same. What changes:

- The computer's Vault keys are made in the service and sealed with the computer's own key.
  Every value is opened there, by the service's own system user.
- The service runs the proxy. Your processes, the agent's included, get only stand-ins for
  locked keys.
- Only the user who linked may use the link. Other users of the computer get nothing.
- Only an administrator drops the link:

  ```bash
  sudo /opt/osevel/bin/osevel vault forget --service
  ```

Windows has no service yet. There the keys stay in your user's context.

## With the other Os products

- [OsApi](https://osevel.com/docs/products/osapi/) runs inside the proxy. It checks calls made with locked provider keys
  (Railway, Neon, Supabase, Render, Vercel, GitHub) and holds the dangerous ones.
- [OsBox](https://osevel.com/docs/products/osbox/) takes each MCP server's keys from a vault. They are never written into a
  tool's config file.
- [OsMemory](https://osevel.com/docs/products/osmemory/) refuses notes that contain a value from your vaults, and a team's
  memory is shared with the people of a vault.
- [OsBrain](https://osevel.com/docs/products/osbrain/) does not judge vault use: OsVault makes no per-use decision.
- [OsBase](https://osevel.com/docs/products/osbase/) does not use a vault for database credentials; the bridge holds those.

## Limits

- **No approval and no Stop.** A hijacked agent can use a key at once. OsVault has no activity
  list, no first-use notice and no way to stop one agent. Unlinking the computer in the
  dashboard is the way to cut it off.
- **A locked key can still be used.** The agent cannot copy it, but it can call the service
  with it, within what the service lets that key do. A key that can create keys can create one.
  Use the provider's restricted keys where it has them.
- **Unlocked secrets are real values in the command.** Masking guards against accidents, not
  against a determined agent.
- **Masking gaps:** values under 8 characters are not masked (the run says which); a value
  split between stdout and stderr is not masked; base64 wrapped across lines is not covered.
- **Locking gaps:** a key the API wants inside the request body is not put in; programs that
  pin certificates or ignore proxies do not work with a locked key; only HTTPS is covered. The
  proxy was tested with curl, Node.js `fetch` and Python 3.13, not with every SDK.
- **Without the Osevel service** (and on Windows), a process of the same user that may read
  another's memory, or edit the installed CLI, could reach the values.
- **A link an agent starts itself.** An agent can run its own copy of the CLI and start a link
  with keys it holds. Confirm the 8 digits only for a `vault connect` you started yourself.
- **Windows and Linux key stores** are covered by unit tests only; they were not run on real
  desktops.
- **On Windows**, `npm` and other `.cmd` files must be run through `cmd.exe /c`.
- **Anyone a vault is shared with** can read its values in their browser.
- **Not built:** keys for agents that run in someone else's cloud, pushing secrets into deploy
  platforms, pulling them in CI, and notifications.

Related: [OsApi](https://osevel.com/docs/products/osapi/), [OsBox](https://osevel.com/docs/products/osbox/), [OsMemory](https://osevel.com/docs/products/osmemory/), [OsBrain](https://osevel.com/docs/products/osbrain/),
[security model](https://osevel.com/docs/security/model/).
