# Security model

> What each Osevel product protects when AI agents use your databases, keys, cloud APIs, tools and memory, under which assumptions, and what it does not.

Source: https://osevel.com/docs/security/model/

This page states what Osevel protects, under which assumptions, and what it does not protect,
for every product: OsBase (databases), OsVault, OsApi, OsBox, OsMemory and OsBrain. What the
independent reviews and red teams found, and what was fixed, is in
[security-findings.md](https://osevel.com/docs/security/red-team-findings/). What was tested is listed at the end of this page.

- [The products at a glance](#the-products-at-a-glance)
- [Threat model](#threat-model)
- OsBase and the organization model:
  - [What stays in your database and what reaches our cloud](#what-stays-in-your-database-and-what-reaches-our-cloud)
  - [Two modes: unisolated and daemon](#two-modes-unisolated-and-daemon)
  - [The database roles](#the-database-roles)
  - [Which process holds which credentials](#which-process-holds-which-credentials)
  - [What the database enforces and what only the proxy enforces](#what-the-database-enforces-and-what-only-the-proxy-enforces)
  - [Capability risks and the cut-off](#capability-risks-and-the-cut-off)
  - [What a human approval does and does not protect against](#what-a-human-approval-does-and-does-not-protect-against)
  - [The panel and the encrypted channel](#the-panel-and-the-encrypted-channel)
  - [Organizations: who may do what](#organizations-who-may-do-what)
  - [Members' devices](#members-devices)
  - [Approvals in a team](#approvals-in-a-team)
  - [Strong actions](#strong-actions)
  - [Auditing the proofs](#auditing-the-proofs)
  - [Local secrets and the confirmation code](#local-secrets-and-the-confirmation-code)
- [The Osevel service across the products](#the-osevel-service-across-the-products)
- [OsVault](#osvault)
- [OsApi](#osapi)
- [OsBox](#osbox)
- [OsMemory](#osmemory)
- [OsBrain](#osbrain)
- [What osevel does not protect against](#what-osevel-does-not-protect-against)
- [What was tested and what was not](#what-was-tested-and-what-was-not)

## The products at a glance

| Product  | What it protects                                                                                              | The main assumption                                                                               |
| -------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| OsBase   | Your database from an agent's writes: every change journaled and undoable, risky statements wait for a person | The agent reaches the database only through Osevel and cannot read the stored role passwords      |
| OsVault  | Your keys from being read or copied by an agent, and from our cloud                                           | A locked key is used only through the run proxy; you type your password only into an honest panel |
| OsApi    | Your cloud resources from a dangerous API call made with a locked key                                         | The agent has no other key for that service (OsApi sees only calls made with locked keys)         |
| OsBox    | Your AI tools from running an MCP server, version or tool list you did not accept                             | The Osevel service holds the box, or no hostile program runs as your user                         |
| OsMemory | Your notes from our cloud, from other projects' agents and from obvious poisoning                             | You look at what waits for you; recalled text is still text a model may follow                    |
| OsBrain  | The record of what was decided, and your "ask for more" rules, from being changed unseen                      | The move passes through Osevel; the Osevel service holds the rules and the ledger                 |

Two things hold for every product:

- **A product decides only on what passes through it.** An agent with its own key, its own
  database connection or its own MCP server is not seen.
- **Several protections are a hard boundary only with the Osevel service** (daemon mode, macOS
  and Linux). Without it the agent and Osevel run as the same user. See
  [The Osevel service across the products](#the-osevel-service-across-the-products).

## Threat model

- **The agent is untrusted.** It may be wrong, careless, or following instructions injected through
  data it read (a row, a file, a web page). Everything it sends is treated as hostile: SQL text,
  comments in it, and the data it causes to be stored.
- **The human at the terminal is trusted.** Approvals, policy, risk acceptance and undo are the
  human's decisions, made with credentials the MCP server does not hold.
- **Organization members are trusted only within their role.** A member may be malicious or have
  a compromised device: they can do what their role on a resource allows, nothing more, and every
  decision they sign is kept as a proof.
- **Our cloud is not trusted with authority.** It carries encrypted channels, stores accounts and
  the organization's signed records, and relays the panel. It may be compromised or lie: it cannot
  read the channels, invent or change a record, give a role, or enrol a device. It is trusted for
  availability only (without it, panel, relay and new records stop; see the offline policy).
- **The panel's code is served by us, so it may lie.** A page we serve could show one action and
  ask your passkey to sign another. Single-signature actions are therefore limited to what is
  safe to approve with one gesture, strong actions need two members, a waiting period and an
  independent notification, and a team can serve the panel itself and pin it.
- **The database administrator, the application and the host of a team bridge are trusted.**
  Writes by your application and by the admin are not journaled or gated; the bridge host holds
  the database credentials.

These hold for every product. The sections from here to
[Local secrets and the confirmation code](#local-secrets-and-the-confirmation-code) describe
OsBase and the organization model; the other products follow, each with its own threats.

The main assumption for OsBase: the agent reaches the database **only** through the osevel MCP server
(directly, through the daemon, or through a team bridge's relay), and cannot read the locally
stored role passwords. In unisolated mode this holds only for an agent without shell access;
daemon mode makes it hold for an agent with a shell as your user too. When it does not hold, see
[what only the proxy enforces](#what-the-database-enforces-and-what-only-the-proxy-enforces) and
[local secrets](#local-secrets-and-the-confirmation-code).

## What stays in your database and what reaches our cloud

Used only locally (no `connect`), osevel makes no network connection except to your
database. With the dashboard and organizations:

| Data                                                                                                                                                                               | Where it lives                                                        | Our cloud                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Rows, row images, SQL text, approvals, the change journal                                                                                                                          | your database                                                         | never: the panel reads them over an end-to-end encrypted channel (Noise KK) the cloud only relays                              |
| Database credentials                                                                                                                                                               | the bridge's host (keychain or `0600` files)                          | never                                                                                                                          |
| Your account, sessions, organizations, members, teams, invites, verified domains                                                                                                   | the cloud                                                             | yes                                                                                                                            |
| Connectors (online or not), device routes, pairing rendezvous, audit events                                                                                                        | the cloud                                                             | yes; frame sizes and timing of channels                                                                                        |
| Signed records (members' labels, device public keys, roles, policies, project and database names, agent names bound to members, strong requests with approval ids and SQL digests) | the cloud, every team bridge, and (journal v14) each enabled database | stores them; cannot change them undetected                                                                                     |
| Usage counts of our LLM service, plans                                                                                                                                             | the cloud                                                             | counts only, never prompts or results                                                                                          |
| The panel's own state in your browser                                                                                                                                              | IndexedDB                                                             | never: a non-extractable X25519 key, pairing records and organization pins (public values only); decrypted data is memory-only |

## Two modes: unisolated and daemon

|                                                     | Unisolated (default)                    | Daemon mode                                                                                                            |
| --------------------------------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Who holds the role passwords                        | your OS user (keychain or `0600` files) | a dedicated OS user (`_agentreverse` on macOS, `osevel` on Linux), `0600` files in a `0700` directory only it can read |
| What the IDE runs                                   | `osevel mcp`: the MCP server itself     | `osevel mcp`: a thin client that pipes stdio to the daemon's socket and holds no credentials                           |
| How an agent is identified                          | its token (`OSEVEL_AGENT_TOKEN`)        | its token, checked by the daemon before anything else                                                                  |
| Human decisions (`approve`, `undo`, `agent add`, …) | a terminal and the confirmation code    | `sudo` (your password or Touch ID) and the confirmation code                                                           |
| Dashboard bridge                                    | `osevel connect`, as you                | inside the daemon, its token and device records owned by the daemon user                                               |
| Against an agent with a shell as your user          | **not** protected                       | protected, unless the agent can become root                                                                            |

Set up daemon mode with `sudo osevel daemon install`, then `osevel daemon adopt
<project>` for each project. Adopting rotates all the role passwords inside the daemon: every
password your user could have read stops working, and the new ones never pass through your
process. `osevel daemon doctor` checks the setup from your side. 
**Root commands go through the launcher, by its full path.** `daemon install` writes
`/opt/osevel/bin/osevel`, a small script owned by root that runs the same Node.js and osevel as
the service. Run every root command with it:

```bash
sudo /opt/osevel/bin/osevel approve 42
```

not `sudo osevel approve 42`. The short form finds `node` and `osevel` through your `PATH`, which
sudo keeps on macOS, and an agent running as you can put a folder of its own at the front of it
(a shell profile, or a `~/bin` that is already there). Its fake `node` would then run as root.
The full path never looks at `PATH`, and the launcher clears the environment (a system `PATH`,
root's own `HOME`, no `NODE_*` settings) and starts Node without the module folders in your home
before it starts anything. Once the launcher exists, project commands run as root without it are
refused with the exact line to type.

Every run as root that reaches osevel's code also checks itself: it refuses unless the Node.js binary, the osevel package
(every file) and every folder above them belong to root and nobody else can write them. So a
Node.js your user owns (in your home folder, or a Homebrew one) cannot be used for root commands
or for the service: install Node.js and osevel as root (for example the nodejs.org installer,
then `sudo npm install -g @osevel/cli`). The CLI also replaces `PATH` with system folders as root,
so the tools it runs (`id`, `launchctl`, `systemctl`, …) are the system's. `osevel daemon doctor`
checks the launcher and the Node.js and package it runs, in case they became your user's later
(for example a Homebrew install that takes over `/usr/local`).

What this does not cover: the very first `sudo osevel daemon install` still starts through your
`PATH` (there is no launcher yet; check `command -v node osevel` first); commands you type
without the full path, such as `osevel daemon adopt`, can be a fake `osevel` that shows its own
sudo prompt; and an agent that can
rewrite your shell profile can also replace `sudo` itself in that shell, or a command you type
by its full path (with an alias or a shell function), and read your password. The panel, with a
passkey, does not depend on your shell.

The daemon checks its machine at every start:

- **Disk encryption is required.** The role passwords are files on disk, and a copy of the disk
  (a stolen laptop, a backup) would read them. Without FileVault (macOS) or a dm-crypt / LUKS
  layer under the state directory (Linux) the daemon does not start. In a container or on a cloud
  volume the check cannot see the disk; the operator then states that the host encrypts it with
  `OSEVEL_DISK_ENCRYPTION=host` in the service's environment, and the daemon writes that
  statement to its log at every start.
- **No core dumps.** The service sets the core-file limit to 0, so a crash does not write the
  passwords held in memory to disk. The daemon warns when the limit is not 0 (an install made
  before this check: run `sudo osevel daemon install` again).
- **Code digest and signed releases.** A SHA-256 of the installed files is written to the log.
  A release carries a manifest of its files, signed with the project's release key; the daemon
  refuses to start when an installed file differs from it, and a daemon installed from a signed
  release refuses to run anything that is not one.

- **The passwords are sealed with a key the machine's chip holds.** Every role-password file
  and the dashboard bridge's own secrets are encrypted (AES-256-GCM) with a master key that only
  this machine can open: the Secure Enclave on a Mac, the TPM through systemd on Linux, or, for
  a team bridge, a key file the organization's key service mounts (`OSEVEL_MASTER_KEY_FILE`). A
  copy of the disk opens nowhere else. Without such a key the daemon does not start.

**The daemon changes the role passwords every day.** Each database records which store holds
its passwords (journal v26); only that store changes them, every 24 hours, so a stolen copy of a
password works for a day at most. A new password is stored as pending before the database
changes it, so a crash never loses the only working one. `osevel status` shows the holder and the
last change. `init` on a database held elsewhere says so before it takes the passwords over.

**Leases and "report lost".** A connector paired with the panel serves agents only while it
holds a fresh lease from the cloud: one arrives every few minutes while it is connected, and
without one for 24 hours it stops. A lease grants nothing; it can only withhold service. From the
panel (Account → bridges) a person reports a connector lost; after 15 minutes, in which any of
their devices can cancel, the cloud stops its leases and, if it is online, tells it to stop: it
deletes the database passwords it holds at once. The certain remedy stays the same: take the
database over from another machine (`osevel init` with the admin password changes every
password). A connector that was never paired cannot be cut off, so it serves no database
labelled prod.

**Short-lived database users for agent sessions.** In daemon mode each agent session gets its
own database users for the agent and migrator roles, created when the session starts, valid for
15 minutes and renewed while it lives, and ended (sessions terminated, user dropped) when it
closes. A password read from the daemon's memory stops working minutes after the session or the
daemon stops. The database maps each session user to its role for every rule, records its writes
like the agent's, and the connection watch counts it as osevel's own. Requires journal v27
(`osevel upgrade`).

**A production database is served only by the daemon or a team bridge.** In unisolated mode a
database labelled `prod` is refused everywhere a human sets it up: `database set --env prod`,
the panel's "raise the protection" to prod through `osevel connect`, `osevel mcp` serving it,
and `daemon release` handing it back. Adopted databases are labelled with
`sudo /opt/osevel/bin/osevel database set --env prod`. A team bridge's image states its isolation with
`OSEVEL_ISOLATION=container`. This guards the setup, not against an agent: in unisolated mode an
agent with a shell reads the passwords whatever the label says, which is the reason for the rule.

## The database roles

`init` creates one owner role and nine login roles (prefix `ar` by default). All are
`NOSUPERUSER NOCREATEDB NOCREATEROLE NOREPLICATION NOINHERIT` and members of no role. The central
rule: **no role that can decide approvals or change policy has any privilege on a user table**, so
no user code (triggers, defaults, checks, domains, RLS expressions, functions that shadow
built-ins) ever runs with those rights.

| Role                  | Journal                                                                                                                                                                                       | Your tables                                                                    | Other                                                                                                                                                                                                                                                                      |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ar_owner` (no login) | Owns the journal objects                                                                                                                                                                      | none                                                                           | The admin is its only member.                                                                                                                                                                                                                                              |
| `ar_agent`            | **none**                                                                                                                                                                                      | `SELECT/INSERT/UPDATE/DELETE` on managed tables with an active capture trigger | No DDL (guard). `BYPASSRLS` only in `bypass` RLS mode.                                                                                                                                                                                                                     |
| `ar_migrator`         | none                                                                                                                                                                                          | none                                                                           | May call the approval gate, which runs only statements stored on an approved, unexpired, unconsumed approval. DDL only inside the gate.                                                                                                                                    |
| `ar_journal`          | Reads all; inserts agent changes and pending approval requests; may approve only through the MCP prompt or a policy rule, never a terminal-only request                                       | **none**                                                                       | Policy is read-only.                                                                                                                                                                                                                                                       |
| `ar_approver`         | Reads all; decides only through the terminal (`cli`); the only role that may approve terminal-only requests; writes policy                                                                    | **none**                                                                       | No DDL.                                                                                                                                                                                                                                                                    |
| `ar_remote`           | Reads the journal tables; decides only through the dashboard: denies any pending request, approves only requests that are not terminal-only, and only with enough signed proofs (journal v12) | **none**                                                                       | Inserts only approval proofs, the mirror of the signed records (in order, chained) and dashboard tasks; never consumes an approval, no policy writes, no DDL, no routine. The dashboard bridge.                                                                            |
| `ar_auditor`          | Nothing of its own: no journal table, no user table                                                                                                                                           | **none**                                                                       | Only EXECUTE on the `audit_*` functions: SECURITY DEFINER; metadata only (journal v8), and since journal v14 the proofs to check (signed records, signed statements, strong decisions; never SQL text, row images or tokens). For local auditor agents and `audit proofs`. |
| `ar_strong`           | Records strong decisions with their proof and applies them (journal v13)                                                                                                                      | **none**                                                                       | The database applies a decision only after its waiting period, while the watcher lives, and (witness mode) once the witness confirmed it.                                                                                                                                  |
| `ar_watch`            | Reads strong decisions; confirms or cancels them; gives the sign of life                                                                                                                      | **none**                                                                       | Held by the watcher on another machine, never by the bridge.                                                                                                                                                                                                               |
| `ar_undo`             | Reads `changes`, `row_log`, `ddl_log`, `gate_log`; records its own undo changes                                                                                                               | Read/write on managed and capture-closure tables; read on trash tables         | **No access to approvals or policy.** No DDL.                                                                                                                                                                                                                              |

The rules on the `approvals` and `changes` tables are enforced by triggers keyed on the session
user, so a role cannot record a decision it is not allowed to make even with direct SQL. Every
decision channel belongs to exactly one role: the MCP prompt and policy rules to `journal`, the
terminal (`cli`) to `approver`, the dashboard to `remote`.

What each password allows when it leaks, enforced by the database:

- **agent**: read and write the managed tables (captured); no journal, no DDL.
- **migrator**: run statements already stored on an approved schema request; nothing else.
- **journal**: read the journal, create pending requests, approve requests that are not
  terminal-only (as if through the MCP prompt), write session rows for the dashboard (display only).
- **approver**: read the journal, approve anything through `cli`, change policy.
- **undo**: read and write managed tables, read the change log and trash; no approvals or policy.
- **remote**: read the journal (including the SQL text and row images it holds), deny any pending
  request, approve requests that are not terminal-only. It cannot create, consume or expire
  requests, write policy, settings or sessions, or touch your tables.

## Which process holds which credentials

| Process / command                                        | Credentials it loads                                                                                                                                                               |
| -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `osevel mcp` (the MCP server)                            | agent, migrator, journal. The approver, undo and remote passwords are never read, so they are not in the server's memory.                                                          |
| `status`, `verify`, `doctor`, `log`, `show`, `approvals` | journal                                                                                                                                                                            |
| `approve`, `deny`, `policy list/add/remove/reset`        | approver                                                                                                                                                                           |
| `undo`                                                   | undo; plus approver and migrator only after confirmation and only if schema changes must be reversed. `--dry-run` uses only undo.                                                  |
| `init`, `sync`, `doctor --admin`, `prune`, `uninstall`   | the admin, asked for each time and never stored (or `OSEVEL_ADMIN_URL` from the environment)                                                                                       |
| `osevel connect` (the dashboard bridge)                  | remote (reads, panel decisions, proofs, the record mirror), undo (panel undo), strong (strong decisions, journal v13; before v13 the approver, loaded only to run a strong action) |
| `osevel watcher run` (another machine)                   | watch only                                                                                                                                                                         |
| `audit proofs`, auditor agents                           | auditor                                                                                                                                                                            |

In daemon mode, every row above runs as the daemon user: the MCP server inside the daemon (one per
agent connection, with the agent's access level), and the human commands under `sudo`, which drop
root to the daemon user before reading anything. Your own user holds no password of an adopted
project.

All login passwords are generated by `init` (43 random characters) and stored in the OS
keychain (one entry per role), or, when no keychain is available, in one `0600` file per role
(`secrets/<project>/<role>.json` in `0700` directories, unencrypted). Each command reads only the
passwords of the roles it uses, so with either backend a process never holds the others in memory
(the MCP server never loads approver, undo or remote; the dashboard bridge only remote and undo).
In unisolated mode this limits exposure, it is not a boundary: all entries and files belong to
the same OS user, so any process running as that user can read all of them. In daemon mode they
belong to the daemon user. The password is sent to the database as a
SCRAM verifier computed locally; server statement logs or pgaudit may still record the verifier.

## What the database enforces and what only the proxy enforces

**Enforced by the database**, even against someone who connects directly with the agent role's
password:

- no access to the journal, approvals or policy;
- no DDL of any kind (event-trigger guard), no `TRUNCATE`;
- no writes outside the managed tables (cascades from them happen with the owner's rights and are
  captured);
- capture of every row the agent role changes in managed and capture-closure tables;
- no role switching, no server-file functions, no extension creation (Supabase `supautils`
  included);
- schema changes only through the gate, only with an approved, unexpired, single-use approval;
- the cut-off when an unaccepted capability appears: `NOLOGIN`, all managed-table privileges
  revoked, open sessions terminated;
- **what agents see** (Agent 1), while the column classes are enforced (the default since
  `init` 0.2): the agent role cannot read, filter on or return a column that is not open; the
  masked views show rows only to a login that may see `masked` (in daemon mode: that session's own
  agent; otherwise: while any active agent does); revealed values come only from
  `reveal_rows`, which checks the reveal's token, end time, row budget and columns and logs each
  read; `inspect` answers never carry a value of a column that is not open and count guesses
  against a daily budget.

**Enforced only by the proxy** (the MCP server, executor and undo engine). Someone who connects
directly with the agent role's password **bypasses all of these**:

- approval of data writes, the policy rules and thresholds, and the per-session and project
  volume rules;
- binding an approval to the exact pre-existing rows it measured;
- bounded reads: row and byte caps, the receive ceiling and the client-side deadline (a raw
  connection can `SET statement_timeout = 0`);
- `query` being read-only, and the one-statement-per-call rule;
- the forbidden-statement list beyond what the database refuses anyway;
- the planner's checks for schema changes: expressions need a human, every relation must be in a
  managed schema;
- the undo tamper check;
- output escaping and the untrusted-data wrapping of results;
- the level of sight **of each agent** when agents share the agent role (no daemon): the
  database enforces the highest level of any active agent, the MCP server that agent's own; and
  for every registered agent, results and errors without values of private columns even where the
  classes are not enforced.

Such a direct connection's writes **are still journaled** and can be undone, it still **cannot run
DDL** or read the journal, and it is **cut off** like the proxy's sessions if it gains a network or
other unaccepted capability. A leaked migrator password lets someone call the gate directly; that
needs an approved request and is recorded in `gate_log`, and `doctor` raises an alert and records
it as an irreversible change.

## Capability risks and the cut-off

Some features let the agent role act outside the managed tables: network extensions (`pg_net`,
`http`, `dblink`, `postgres_fdw`), foreign data wrappers and foreign tables, `pg_cron`, `pgsodium`,
Supabase Vault and wrappers, `pg_tle`, server files, and SECURITY DEFINER functions and triggers.
`verify` checks for each of them. Any one the agent role can use is a blocking violation unless the
installing human accepted it by name. See
[getting started](https://osevel.com/docs/getting-started/install/#4-capability-risks-you-must-accept-by-name) for the list.

When such a capability appears after install (an extension enabled, a grant to `PUBLIC`, a new or
changed SECURITY DEFINER function, a foreign table), an event trigger cuts the agent role off in
the same transaction. The proxy also re-checks before every statement (at most 1 second stale) and
refuses everything, reads included. Only the admin can lift it: with `sync` once the capability is
gone, or with `osevel risks accept`, which records the acceptance without changing any
password.

Any schema change executed through the approval gate while SECURITY DEFINER items are accepted
re-opens all of those acceptances and cuts the agent off until the human accepts them again
(`osevel risks accept`; the approve screen warns before such a change is approved),
because what such a function does depends on code and objects that change could have replaced.

What the event trigger does not see: role memberships granted to the agent role and `ALTER ROLE`
(shared objects), direct catalog edits by a superuser, objects whose behaviour changes without DDL,
and anything while the event triggers are disabled or dropped (a `verify` violation). Changes made
outside osevel to code or objects an accepted SECURITY DEFINER function uses are not
detected; that is the application owner's responsibility.

## What a human approval does and does not protect against

An approval lets exactly one statement run once, in the session that asked, within 15 minutes,
with the exact SQL text that was shown. For data writes that were measured, it is also bound to the
pre-existing rows touched and to the row counts per table.

It does **not** protect against what the approved statement does later:

- **Approved code runs with other roles' rights.** Functions, procedures, triggers, rules, views,
  policies, domains, defaults and checks that the agent writes and you approve become part of your
  database. A trigger fires for your application's writes with your application's rights, for the
  admin's writes with the admin's rights, and **during undo with the undo role's rights**, which
  include reading the whole change journal. A SECURITY DEFINER function you approve and then accept
  runs with its owner's rights, and so does everything it calls. The approve screen warns about
  this ("Whose rights"); osevel cannot review the code for you.
- **Schema changes run with the admin's rights.** The gate executes approved DDL as the role that
  owns your tables. If you installed as a superuser, that is a superuser.
- **The content of approved inserts** is not bound: an `INSERT ... SELECT` is bound to its row
  count, so the agent can change the source rows between approval and execution with smaller
  writes that need no approval.
- **Unmeasured statements** (`DO`, `CALL`, `UPDATE`/`DELETE` without `WHERE`, writes over a volume
  limit) are approved without a measured impact; the approval binds only the SQL text.
- **Accepting a capability risk** is a standing decision: from then on the agent may use it.

Approvals given in the MCP client's own prompt depend on that client asking a human. A client set
to auto-accept turns them into agent approvals. Terminal-only requests can never be approved there;
`--elicitation none` disables the prompt entirely.

## The panel and the encrypted channel

- **The channel.** Each paired or enrolled browser has its own X25519 key and passkey. The panel
  and the bridge run Noise KK through the cloud's relay; the cloud sees frames, never their
  contents. A channel shows nothing until it is unlocked with the device's passkey.
- **One gesture, one action.** An action (approve, deny, undo, agent changes) is prepared by the
  bridge as a statement; the panel checks that everything it displays equals the statement
  (`verifyPrepareResult`), the passkey signs that statement's digest, and the bridge executes only
  that statement, once, before it expires.
- **The page.** A strict Content-Security-Policy with Trusted Types; decrypted data lives in memory
  only and is wiped on lock; nothing but the device key, pairing records and organization pins is
  stored.
- **A lying panel.** The page is code we serve. A compromised page could display one action and
  have the passkey sign another. Against this: the most dangerous decisions are terminal-only or
  strong actions (two members, a waiting period, a notification the bridge sends directly to the
  team's own channel); and a team can serve the panel from its own domain and pin that origin on
  its bridges (`connect pin-origin`), after which no page we serve can unlock, approve or sign for
  it ([self-hosted panel](https://osevel.com/docs/guides/self-hosted-dashboard/); `panel verify` compares a served panel with the
  published build hashes).

## Organizations: who may do what

Authority lives in **signed records**, not in our cloud ([records](https://osevel.com/docs/security/signed-records/)):

- Each record is signed by a member's enrolled passkey and chained to the previous one. A team
  bridge pins the organization's first record at its terminal (`org pin`, after comparing the
  fingerprint) and verifies the whole chain every time: signature, signer enrolled and not removed
  at that point, the signer's permission, order and chaining, and no rollback to an older log.
- Roles (owner, admin, developer, viewer) add up; there are no deny rules. A **restricted**
  database takes nothing by inheritance, the owner included.
- A record that is well formed and correctly signed but that its signer was **not allowed to
  make** takes no effect, is reported, and the log goes on, so one member cannot freeze the
  organization with a bad record. Anything else that does not verify stops the log there. The
  cloud also verifies each record before storing it (`RECORD_REFUSED`).
- **The panel verifies too.** Before it signs anything it fetches the log and verifies it in the
  browser against the genesis it pinned, and dry-runs the new record. It never takes a bridge key,
  a member or a role on the cloud's word.
- A member sees every colleague and team, but only the databases on which they hold a role, and
  only those databases' access lists and strong actions.

### What a member's browser may read and do on a team bridge

The team bridge enforces the permission table of the records on every request from an enrolled
browser (`packages/bridge/src/team-gate.ts`), not only in the organization view:

| Request                                                                                | Needs on the database                            | Without it                          |
| -------------------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
| Any read of one database (journal, rows, approvals, sessions, agents, verify, policy…) | `activity.view` (every role)                     | `NOT_FOUND`, as if it did not exist |
| `projects.list`, `d1.projects.list`, subscriptions                                     | `resource.view`                                  | left out / `NOT_FOUND`              |
| Undo (Postgres or D1)                                                                  | `undo.run` (developer and up)                    | `FORBIDDEN`                         |
| Lower, revoke or create an agent; leave or cancel a task                               | `agent.manage` (developer and up)                | `FORBIDDEN`                         |
| Arrange a project's folders                                                            | `project.manage` on the project (admin and up)   | `FORBIDDEN`                         |
| Approve or deny                                                                        | the database's approval policy                   | `FORBIDDEN`                         |
| Revoke a device paired at the terminal                                                 | `members.manage` on the organization, or its own | `FORBIDDEN`                         |

- A signed action is checked when it is prepared and **again after the passkey**, so a role
  revoked in between stops it.
- A restricted database counts only roles on that database itself; one whose settings cannot be
  read counts as restricted.
- A device paired at the bridge's own terminal is the bridge operator, who already holds the
  database credentials on that machine; the gate leaves it as it was. An individual's bridge (no
  records) has one human and no gate.
- **Fixed 2026-11-19.** Before this gate, an enrolled member with any role, or none, could read
  every enabled database's journal and row images through the panel channel, undo changes and
  lower or revoke agents; only the organization view and approvals followed the roles.
  `e2e/system/member-roles.test.ts` fails without the gate.

## Members' devices

- Only the first owner pairs a browser at the bridge's terminal. Every other device is **enrolled**
  by an admin: the new device commits to its key before it sees the admin's random nonce, then
  reveals it; both screens show an 8-digit code the two people compare over a call or in person;
  only then does the admin sign the enrolment. A relay that swapped the key shows a different
  code. The cloud cannot enrol a device; a stolen email account cannot either.
- An enrolled browser reaches a team bridge with the bridge key **from the verified records**.
  The cloud routes only a member's own device ids; the bridge accepts a channel only from a
  device the records enrolled (and, when pinned, made on the pinned origin).
- IDE clients on members' machines are enrolled the same way and can open IDE channels only for
  agents bound to their member.
- A removed device or member stops signing and reaching bridges from the next record sync.

## Approvals in a team

- A request goes to the database's approvers (the policy record), needs approvals from as many
  **different members** as the database needs, never from the member who owns the agent on
  `prod`, and climbs the team tree when nobody answers; past the owners it is rejected.
- The bridge checks the signer against the records before it records a decision. The **database
  counts the proofs** itself (journal v12): the remote role cannot approve before enough
  different members signed, even with direct SQL.
- Every proof keeps the member, the device, the statement they signed (journal v14) and the
  WebAuthn assertion.
- On `prod` the IDE's own prompt cannot approve (an IDE set to auto-accept would turn it into the
  agent's approval).

## Strong actions

Actions that could widen access (raising an agent, a second writable database, approving a
terminal-only request, raising a database's protection) can come from the panel as **strong
actions**: a signed request, a second member's signature on `prod`, an independent notification
to the team's own webhook, and a waiting period during which anyone with a say can cancel.
Lowering protection stays at the terminal. Since journal v13 the **database** decides: it applies
a strong decision only after the waiting period by its own clock, while the watcher (a second
program on another machine, holding only the `watch` credential) gives a sign of life, and in
witness mode only after the witness verified the proof from its own pinned genesis. A stolen
bridge alone cannot shorten the wait, skip the witness, or apply anything the members did not sign.

## Auditing the proofs

Every decision made through the panel can be checked again, independently of the bridge that made
it: `osevel audit proofs` (or the `audit_proofs` tool of an auditor agent) verifies the
signed records mirrored into the database, each proof's statement against its digest and its
request, the passkey signature of a device enrolled at that time, the number of different signers,
and each strong decision's records. It exits 1 on any violation. Auditor agents get the verdicts,
never the signed statements.

## Local secrets and the confirmation code

**Unisolated mode.** osevel runs as your OS user. An agent that can run shell commands as
the same user can:

- read the stored role passwords from the OS keychain (or the `0600` file), including the
  approver, undo and remote passwords, and connect directly;
- run the CLI in a pseudo-terminal (`script`, `expect`, a terminal multiplexer, a few lines of
  Python), read the displayed confirmation code and type it, imitating you.

The confirmation code (interactive terminal required, random code, no skip flag, database text
escaped so it cannot draw a fake prompt) raises the bar against an agent that runs the CLI through
a pipe or a tool call. **It is not a hard boundary.** If your agent has unrestricted shell access
and you stay in unisolated mode, treat osevel as protection against mistakes and casual
prompt injection through the MCP tools, not against a determined agent with shell access.

**Daemon mode** moves the boundary to the operating system. An agent with a shell as your user:

- cannot read the daemon's state (`0700`, another user), its environment or its memory (another
  user's process; tracing it needs root), and cannot signal it;
- holds no working password even if it read your store before adoption: adopting rotated them all;
- reaches the database only through the socket, with the access level of a token it has;
- cannot approve, undo or register agents: those need `sudo`, so your password. The confirmation
  code stays as a second check;
- cannot read the dashboard connector token or forge a paired device.

It is still not protected against:

- **an agent that can become root**: passwordless `sudo` (a `NOPASSWD` rule), a `sudo` ticket it
  can reuse, membership of the `docker` group, or a root exploit. `daemon doctor` warns about
  password-less sudo and the docker group. Keep `sudo` timestamps per terminal (the default
  `tty_tickets` on macOS, `timestamp_type=tty` on most Linux distributions), so a recent `sudo` in
  your terminal does not carry over to the agent's;
- **another agent's token**: an agent can read another IDE's configuration and use that token. It
  then acts with that agent's access level and every change is recorded under that agent;
- **reads that need the journal password**: `log`, `status` and the like also need `sudo` in daemon
  mode; an unprivileged read path does not exist yet.

## The panel lock and hardware keys (Security 1)

- **A read session is short and ends at the bridge.** At most 4 hours (an owner may set 15 min to
  12 h) and 90 seconds without pointer, key, scroll or touch activity in the page (30 s to
  15 min). The bridge enforces both: requests the page makes on its own do not count as activity,
  so a page left open stops working even if its lock screen is defeated from the console.
- **One read session per person.** Unlocking a new page ends the person's older one on that
  bridge; other tabs and the person's other browsers are also told to lock (a signal, not
  enforcement).
- **The lock screen shows nothing** (no names, no counts); the app behind it is unmounted.
  Unfinished form text is kept in tab memory only, or discarded if the organization chose so.
- **Settings come from a signed record**, not from our cloud: only an owner can change them, and
  each change is in the organization's log.
- **Hardware keys per role.** When a role needs a hardware security key, a member holding it
  anywhere unlocks (and renews) only with a device whose enrolment attestation chains to a root
  certificate the organization pinned. We ship no roots: the owner chooses which makers to
  trust. Enrolment asks for the attestation (`direct`), so the browser may ask the person to let
  the organization see the key's make and model.
- **Limits.** A device paired at the bridge's own terminal is the bridge operator, who already
  holds the database credentials: the hardware key rule does not apply to it. Malicious panel
  JavaScript can fake activity signals and keep a session alive until its maximum length. The
  attestation check trusts the pinned roots; an authenticator maker whose attestation key leaks
  could be impersonated until the owner removes its root.

### The activity log (journal v33)

Every unlock, renewal, end (lock, idle, expiry, a newer page) and failed unlock of a panel
session is an entry in `agent_reverse.activity_log` of each database the connector serves. The
connector appends; the database's guard writes the number, the time and the chain (SHA-256 over
the previous digest and the entry) itself, and refuses every change and deletion. After each
session event the connector sends the cloud a seal: the database's random install id, the entry
number and the head digest, never the content. At every start the connector recomputes the chain
and compares it with the latest seal; `osevel audit activity` shows the log and checks the chain.
An owner who switches the guard off can still rewrite or cut the log, but it then no longer
verifies, and a log cut back before the sealed entry shows as rewound.

## The panel opens on computers

The web panel is for desktop and laptop computers only: Windows, macOS, Linux and ChromeOS,
touch screens and 2-in-1s included. Phones, tablets (iPad also in "desktop website" mode),
smart TVs, TV sticks and consoles, automation and headless browsers, and virtual machines whose
display adapter names a hypervisor (VMware SVGA, VirtualBox, Parallels, QEMU/virtio, Hyper-V
Video) get one page that says the dashboard opens on a computer, and nothing else: no sign-in,
no data, no socket. Software graphics alone (SwiftShader, llvmpipe, Microsoft Basic Render
Driver, Remote Display Adapter) are not refused: a real computer shows them over remote desktop
or with hardware acceleration off, and remote desktop to a real computer keeps working.

Both sides use one classifier (`@agent-reverse/protocol`, `client-device.ts`). The panel checks
before it mounts, from the user agent, the client hints, touch points, `navigator.webdriver` and
the WebGL renderer. The cloud checks the browser sign-in routes (`/api/auth/*` except sign-out)
and the browser socket (`/ws`), from the `User-Agent` and the `Sec-CH-UA-Mobile` /
`Sec-CH-UA-Platform` client hints, and answers `403 DEVICE_NOT_ALLOWED`. Bridges, IDE clients
and the CLI are never checked. Remote desktop to a real computer works: weak signals such as
core count or memory are not used.

This is a deterrent, not a security boundary. Every one of these signals can be spoofed by
anyone who controls the browser. Passkeys and paired devices remain the real control.
`ALLOW_AUTOMATION_CLIENTS` lets headless browsers in for the test suites only; it is off by
default and the cloud refuses it unless `PUBLIC_ORIGIN` is localhost.

## The Osevel service across the products

`sudo osevel daemon install` (macOS and Linux) runs Osevel as its own system user; see
[Two modes](#two-modes-unisolated-and-daemon). The other products use the same service. What it
holds, and what the same thing is without it:

| Product  | With the service                                                                                                                            | Without it (and always on Windows)                                                                                  |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| OsVault  | The computer's Vault keys are sealed with the machine key; values are opened in the service; the user's side gets stand-ins for locked keys | Keys are in your own key store; a program that can read your processes' memory or edit the CLI can reach the values |
| OsApi    | The mode, the policy, the held calls and the records are in the service's folder                                                            | The agent can choose watch mode for its own run and rewrite the records and the policy                              |
| OsBox    | The box, the acceptances, the installs and the remote sign-in tokens are in folders your user cannot write                                  | Acceptances are advisory against a program running as you                                                           |
| OsMemory | The scope keys, the records and the opened notes are in the service                                                                         | A program running as you can read the memory and forge notes that look written by you                               |
| OsBrain  | The rules and the ledger are in the service's folder; its head is sealed in the cloud                                                       | The agent can write the rules and the ledger                                                                        |

- **Root commands go through the launcher.** With the service, deciding a held call and lowering
  a rule need `sudo /opt/osevel/bin/osevel …` and a typed code. The sudo password is the factor
  an agent running as you lacks.
- **The service is found without your settings.** The Vault commands look the service's user up
  by absolute path, ignore `OSEVEL_SOCKET`, and check who owns the socket before each connection.
  If the service's files exist but cannot be confirmed, Vault stops instead of falling back.
- **Only a person drops the service's Vault link:** the service refuses `forget` over its
  socket; `sudo /opt/osevel/bin/osevel vault forget --service` does it. Keys in a file
  (`--software-keys`) are refused while the service is installed.
- **Not covered:** an agent that can become root. An agent that rewrites your shell profile
  (a fake `sudo`, `NODE_OPTIONS`, a `node` shim) runs code in what you start from that shell; the
  panel's passkey is the channel that does not depend on the shell. An agent can also run its
  own copy of the CLI and start a Vault link with keys it holds: the 8-digit comparison is the
  boundary only when you started the command yourself. The panel cannot yet show that a link's
  keys are held by the service.

## OsVault

**What it protects.** Secrets are encrypted in your browser and stored by our cloud as
ciphertext, wrapped keys and signed records. An agent on a linked computer gets them only inside
the command it runs, and reads back masked output.

- **Your password is the key, and it does not reach us.** The browser turns it into a key with
  Argon2id and sends only a proof. The cloud refuses a password field that is not a proof.
- **The cloud cannot decide who gets in.** Members and their keys are a signed, chained log that
  each browser and computer verifies. A new person is confirmed once by a code compared between
  people. The cloud cannot forge, reorder, roll back or replay a change unseen by a holder that
  has seen the log before; a browser that has never opened a vault trusts the first log it sees.
- **Secret names are encrypted too.**
- **Linking a computer** compares 8 digits between the terminal and the browser. The computer's
  keys stay in the Secure Enclave (macOS), sealed for your Windows user (DPAPI), in the desktop
  keyring (Linux), or in the Osevel service.
- **Locked keys.** A key bound to a service reaches the program as a stand-in (`osv_ph_…`). A
  per-run proxy puts the real key in only on requests to the bound host, only where a credential
  goes, checks the service's certificate, and masks the key in the answer. The proxy does not
  tunnel into the computer itself.
- **Masking.** A value, or its base64, hex, URL or JSON form, shows as `[vault:NAME]`. If a masker
  fails, the output is withheld and the command stopped.
- **Hardening.** The process that holds values restarts itself without `NODE_OPTIONS`, preloads
  or the inspector, so the command it runs cannot open it and read the values.
- **Names that run code** (`PATH`, `NODE_OPTIONS` and the like) are never given from a vault.

**What it does not protect against.**

- **A hostile panel.** The panel is served by our cloud. A page we serve could take the password
  typed into it, and so everything that person can open. Pinned builds make this harder, not
  impossible.
- **The mailbox.** Recovery is by email: the recovery code mailed at set-up, a sign-in and a
  5-minute wait open the vaults. A password reset by email goes through at once. Whoever takes
  over the mailbox can take over the account. The recovery mail goes through our mail provider.
- **A stolen password** opens everything that person can open. A weak password falls to offline
  guessing if our database is stolen.
- **This browser.** The unlock key is kept in the panel's key store until sign-out or Lock. It is
  non-extractable, but someone who gets the browser profile while the session is valid opens the
  vaults without the password.
- **Use of a key.** An agent can use a locked key at its service, within what the service lets
  the key do, and nothing asks first. A hijacked agent uses live keys at once.
- **Keys that are not locked** are real values in the command's environment. Masking is a seat
  belt, not a boundary.
- **People a vault is shared with** can read its values.
- **A stolen, unlocked computer:** agents on it can use the secrets until you unlink it.

## OsApi

**What it protects.** A call an agent makes to Railway, Neon, Supabase, Render, Vercel or GitHub
with a locked key is read whole before the key is put in. Reads and everyday changes go through;
a call that could delete data or backups, reveal a secret or open access waits for a person.

| Threat                                                                     | Answer                                                                                                                   |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| GraphQL tricks: aliases, several operations, fragments, variables, batches | Parsed fully; every operation and root field classified; the strictest wins; anything not read whole is an unknown write |
| Method overrides, path encodings, other ports                              | One normal form; ambiguous spellings are refused                                                                         |
| Raw HTTP: pipelining, upgrades, `Expect: 100-continue`, smuggled lengths   | Each request on a connection is checked; upgrades are never forwarded with a key                                         |
| An approval used for another call, another key, another run, or twice      | Bound to the service, the key names, host, method, path, query and body; once; 15 minutes                                |
| The agent approves itself                                                  | Panel: a passkey. Terminal: an interactive terminal and a typed code, and with the service, sudo                         |
| Text from the agent misleads the person                                    | The catalogue's own words come first; request data is quoted and shown as data                                           |
| A dangerous operation lowered by policy                                    | One named operation, deliberate, never one whose loss cannot be undone, never an unknown call; asking always wins        |
| The waiting list filled to block the person                                | Calls without a locked key are refused, not held; limits per run and per key                                             |
| Records silenced, cut or changed                                           | Decisions are always written; a hash chain checked by `osevel api verify`                                                |
| The catalogue is wrong or out of date                                      | Unknown writes are held                                                                                                  |

**What it does not protect against.**

- **Keys outside a vault.** A key in a `.env` file, a shell profile or a CLI's sign-in file goes
  around OsApi. `osevel api scan` lists them; services reached without a locked key are recorded.
- **Deploys and code.** Deploys, jobs, functions and workflows run code with your secrets and go
  through as everyday changes, unless you add the `production-deploys` preset.
- **What you approve.** An approved call runs. OsApi takes no safety copy first.
- **The run's environment.** A run chooses its vault environment, so a rule for `production`
  does not cover an account-wide key kept in another environment.
- **Without the Osevel service,** enforcement is not a control against the agent (see above).
- The catalogue was checked against the providers' published documents, not with test accounts.

## OsBox

**What it protects.** A server runs only if it is the one you accepted: its version, every
dependency (the whole lockfile and the installed files), and its tool, prompt and resource
lists are pinned. A change is held until you look.

| Threat                                                          | Answer                                                                                                                                                    |
| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| An agent reads keys from the tools' config files                | No keys in them: one `osbox` entry per tool; keys come from OsVault at start                                                                              |
| A new version of a server is malicious                          | Pinned version and hashes; an update is shown and accepted, never automatic; install scripts are off                                                      |
| A server changes its tool descriptions                          | The lists are hashed; changed items are held until a person looks                                                                                         |
| One server's tool shadows another's                             | Tools are always `<server>__<tool>`; `__` is refused in a server's own names                                                                              |
| A server asks the person for a token, or pulls the conversation | Elicitation and sampling are refused unless declared and accepted                                                                                         |
| A server prints its key                                         | Masking on every message and on stderr; locked keys never reach the server's process                                                                      |
| A pinned server misbehaves                                      | The operating system's sandbox: it reads, writes and reaches only what it declared (see the limits)                                                       |
| A hostile repository's `osevel.yaml`                            | Nothing runs before a yes on this computer for that repository's real path; any edit asks again                                                           |
| Our cloud reads or forges an acceptance                         | Requests and answers are sealed end to end between the computer and the panel; the acceptance is signed with your account key and checked on the computer |
| A remote server's sign-in is pointed elsewhere                  | The sign-in provider first seen is the only one accepted; tokens are bound to one server's address                                                        |

**What it does not protect against.**

- **A server you accepted.** OsBox cannot make a server safe. It can still misuse what it was
  allowed to reach, and a remote server can change behaviour behind an unchanged tool list.
- **Prompt injection through tool results.** A result is the server's data; OsBox adds no trust
  to it and does not solve this.
- **A program running as you, without the service:** acceptances are then advisory. It can edit
  the box's files and the installed copies. This is always so on Windows.
- **The tools' own config files and the gateway** are yours even with the service. A program
  running as you can make a tool start something else, or start `osevel box mcp` itself.
- **The sandbox's edges.** No sandbox on Windows. On Linux a sandboxed server has no network. A
  file's existence and size can be learned anywhere. A server accepted with `--no-sandbox` can do
  whatever you can.
- **An old acceptance cannot be revoked yet.**
- A local command's pin covers the file, not the interpreter or what it loads.

## OsMemory

**What it protects.** Notes are sealed with a key per scope, wrapped to your account and your
linked computers. The log is append-only and chained. Our cloud sees random scope ids, how many
sealed notes each holds and when they change; never text, and never which repository a project
is.

| Threat                                               | Answer                                                                                                    |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| A page makes an agent remember an instruction        | Notes about you wait for you; obvious instruction text, hidden characters and secret paths are held       |
| A hostile repository claims another project's memory | A project is bound to a folder's real path with a random id, never to what a repository says about itself |
| An agent in one project writes into another          | The gateway binds the scope to the session's folder, never to a name the agent gives                      |
| Flooding and gradual poisoning                       | A daily limit on agent notes; your own notes rank first; agent notes are capped per recall                |
| Re-remembering a note you retired                    | A match with a retired or held note is held                                                               |
| An agent stores a secret                             | Known key formats are refused, also inside base64 and hex; with the service, also your OsVault values     |
| Guessing OsVault values through refusals             | After 5 matches in a day the service takes no notes on that computer until the next day                   |
| A note closes the untrusted-data block               | Angle brackets are escaped inside the block                                                               |
| Our cloud hands over a key it made itself            | A scope key is used only with a signature of its maker: your account, or a computer pinned by it          |
| One person approves their own team note              | Another member accepts it, when the team has more than one person; agents do not write team notes         |

**What it does not protect against.**

- **A model that follows what it recalls.** "Data, not instructions" is a label.
- **Paraphrased instructions.** The checks catch obvious instruction text. A project note an
  agent writes reaches that project's agents before you have read it.
- **Unusually encoded secrets.** Secret refusal is best effort.
- **An agent of the same user reading another project's notes.** It can start a session in that
  folder. Projects are kept apart against mistakes.
- **A team member who left** keeps what they read.
- **Labels.** An agent's tool, computer and session names are what it says, not proven.
- **A log cut short for a new reader.** A computer or browser that has never seen a memory can be
  served an older state.

## OsBrain

**What it protects.** One chained ledger of every decision across OsBase, OsApi and OsBox, and
rules that can only ask for more. While the Osevel service is paired with the panel, its
dashboard bridge seals the ledger's head in our cloud every 5 minutes, so the ledger cannot go
backwards unseen.

| Threat                                               | Answer                                                                                                             |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| The agent edits the rules to let itself through      | Rules can only hold or refuse. With the service they are in its folder; removing one needs sudo and a code         |
| A rules file that cannot be read                     | Changes wait for a person                                                                                          |
| The agent rewrites the ledger                        | A hash chain (`osevel brain verify`), and the head sealed in the cloud, which never accepts going backwards        |
| An approval for one move used for another            | The decision stays with each product, bound to the exact move, single use, 15 minutes                              |
| A product's own decision lowered through OsBrain     | Not possible: the mapping only keeps or raises a product's verdict                                                 |
| A flood of moves hides a held one                    | Held moves and a person's answers always get their own line                                                        |
| A rule dodged by batching, or by an agent name trick | Every operation of a call is judged and the strictest stands; names are compared folded, without hidden characters |
| OsBrain fails                                        | The product's own decision stands; what OsBrain would have raised waits for a person                               |

There is no AI model in a decision: verdicts are deterministic.

**What it does not protect against.**

- **Moves that do not pass through Osevel.** `osevel brain coverage` shows where that is possible.
- **OsVault uses.** A vault makes no per-use decision, so there is nothing for OsBrain to hold.
- **Without the Osevel service,** the agent can write the rules and the ledger, and no new cloud
  seal is made: the seal loop runs in the service's dashboard bridge.
- **Our cloud** is trusted not to lose the seal. The head is not signed by a separate device key
  and no outside timestamp authority is used.

## What osevel does not protect against

osevel records, gates and can undo what an AI agent does through its MCP server. It does not
make an agent safe in every respect. This list is about OsBase and the organization model; each
other product states what it does not protect against in its own section above
([OsVault](#osvault), [OsApi](#osapi), [OsBox](#osbox), [OsMemory](#osmemory),
[OsBrain](#osbrain)).

- **Your own database objects keep their own rights.** osevel stops the agent when it finds
  SECURITY DEFINER functions or triggers, foreign tables, or network or file capabilities the agent
  could use, until you remove or accept them. Once you accept them, the agent can use them, and
  their effects outside the managed tables are neither journaled nor undoable. Accepting a SECURITY
  DEFINER function also accepts whatever it calls or reads; changes made outside osevel to
  that code are not detected.
- **Approvals are only as good as the review.** Approved functions, triggers, views and code blocks
  are the agent's code running with the rights you gave them, including later during undo. An
  approved insert is bound to its row count, not its content. Unqualified writes and code blocks
  are approved without a measured impact.
- **Undo is best effort.**
  - It restores what the agent changed when nobody else has touched the same values since.
  - It cannot tell that your application later stored the same value the agent wrote (ABA).
  - It reports conflicts instead of overwriting.
  - Triggers that run during undo can read the change journal and leak what they read through
    channels a rollback does not undo (for example sequences). Changes to the journal are detected
    and roll the undo back.
  - An approved SECURITY DEFINER trigger that you have not accepted blocks undo on its table until
    you accept or remove it.
- **Not everything is a table row.** Large objects, `pg_notify` messages and consumed sequence
  values are not undone. The agent can create large objects and send `NOTIFY` messages that your
  application's listeners receive (reported as warnings).
- **Reads through inheritance.** Child tables in other schemas are readable through a managed
  parent table.
- **Credentials.** With the agent role's password, the policy, approvals, volume limits and read
  limits are gone. The database still prevents DDL, journal access and writes outside the managed
  tables, and still captures every row the agent changes.
- **Local shell access.** In unisolated mode an agent with shell access as the same OS user can
  read local secrets and imitate a terminal. Daemon mode closes this, except against an agent that
  can become root (see [local secrets](#local-secrets-and-the-confirmation-code)).
- **Metadata.** Journal table statistics (`pg_stat_user_tables` and similar) are visible to every
  role, so the agent can see how many approvals, changes and row images exist, but not their
  contents.
- **Application and admin writes** are not journaled, gated or undoable, by design.
- **What agents see has limits** (Agent 1). Column and table names, comments and enum labels are
  structure and are shown. A stand-in hides a value, not how often it occurs. A write can tell an
  agent that a value exists (a unique violation on a value it supplied), outside the guess
  budget. At `clear`, what the model provider does with revealed values is outside our control. An
  agent in an IDE may find the application's own connection string (`.env`) and connect without
  osevel: only the sandbox and daemon mode close that door.
- **D1** has no database roles: its output classes are enforced by the connector only.
- **The host of a team bridge** holds the team's database credentials. Whoever controls it
  controls those databases (the watcher on another machine still holds back strong decisions).
- **A malicious owner** can give any role, enrol devices for colluding members and remove others;
  everything they sign is a record every bridge and auditor can read.
- **Members who collude** can reach the number of signatures a decision needs.
- **The cloud's availability.** It can withhold records (a removal then takes effect only when it
  reaches the bridge; the offline policy stops writes after a set time without a verified sync),
  and it sees metadata: who belongs to which organization, which connectors are online, and the
  timing and size of channel traffic.
- **A lying panel within single-signature actions** (on `dev` and `staging`, approvals that are
  not terminal-only): it could have a passkey sign another of those actions than the one shown.
  Pin a self-hosted panel where that matters.
- **Proofs before journal v14 and on an individual's bridge** cannot be tied to a request or a
  device by the audit check (they are reported as warnings).
- **Clocks.** Record dates may drift by up to 10 minutes; the waiting period of strong actions
  uses the database's clock.

## What was tested and what was not

**Tested:**

- An independent red-team review in four rounds, each re-running every earlier attack. Every
  attack is a test that uses only the agent's MCP tools, with human steps performed exactly as the
  CLI performs them.

  | Round | Attacks tried | Held by the database | Held only by the proxy | Succeeded | Open findings |
  | ----- | ------------- | -------------------- | ---------------------- | --------- | ------------- |
  | 1     | 77            | 29                   | 23                     | 25        | 20            |
  | 2     | 91            | 38                   | 37                     | 16        | 14            |
  | 3     | 100           | 46                   | 42                     | 12        | 12            |
  | 4     | 104           | 53                   | 42                     | 9         | 9             |

  The 9 attacks that still succeed all need a human to approve or accept something first; six of
  them are accepted limitations. Final run: 490 adversarial tests across the images below plus the
  stdio server as a child process. See [security-findings.md](https://osevel.com/docs/security/red-team-findings/).

- Six local container images: `postgres:15-alpine`, `16-alpine`, `17-alpine`, `18-alpine` (admin
  is a superuser) and `supabase/postgres:15.19.0.019`, `17.11.0.019` (admin is `postgres`, not a
  superuser). The installer, executor and adversarial suites run on all six; the undo suite on
  Postgres 15, 16, 17, 18 and Supabase 17; the MCP suite on Postgres 17, 18 and Supabase 17; the
  capability suite on Postgres 17 and 18; the CLI suite on Postgres 17 and Supabase 17; the
  built CLI binary on the development machine.

- Daemon mode with two real OS users, in a Linux container (`e2e/daemon/two-users.test.ts`): after
  `daemon adopt`, all six old passwords fail to log in; the human user cannot list or read the
  daemon's state, read its `/proc` environment or memory, or signal it (each probe succeeds as
  root, as a control); an agent works through the socket with its token and its change is
  recorded; without `sudo` project commands only print the `sudo` command, and `sudo -n` asks for
  a password; as root the CLI drops to the daemon user and reads the journal; `daemon doctor`
  reports the setup. The daemon protocol, thin client, adopt / release with real rotation and the
  hosted bridge are also tested as one user on the development machine.

- The organization model (Phase 5), on Postgres 17 with the real cloud (its own Postgres), a
  team bridge paired at its terminal and real WebAuthn verification (software passkeys):
  - signed records against a lying cloud (altered, invented, reordered, dropped, replayed,
    rolled-back and forked records), records the signer may not make (skipped, and refused by
    the cloud), and the panel's own verification (`e2e/cloud/records.test.ts`,
    `e2e/cloud/panel-records.test.ts`, `packages/bridge/src/records.test.ts`);
  - the browser's WebAuthn verifier against the bridge's on every tampering case, ES256, EdDSA and
    RS256 (`packages/bridge/src/passkey-verify.test.ts`);
  - device enrolment through the panel's own code, the code comparison, a swapped key and a
    foreign nonce, and an enrolled browser reaching the bridge (`e2e/projects/ide-relay.test.ts`,
    `packages/panel/tests/unit/enrol.test.ts`);
  - approvals through panel channels: self-approval refused on prod, non-approvers refused, two
    different members needed, a member reading what they hold no role on, a member freezing the
    log, a cloud-only member reaching the bridge (`e2e/system/phase5-redteam.test.ts`);
  - what each member's own browser may read and do on the team bridge: no role, viewer,
    developer, a role revoked between prepare and commit, a restricted database, revoking a
    device, the owner (`e2e/system/member-roles.test.ts`);
  - the same on a Cloudflare D1 database in a team (D1 has no database roles, so the gate is the
    only check): no role, viewer reading the D1 journal and rows, developer undoing
    (`e2e/system/team-d1.test.ts`);
  - strong actions with two signatures, the waiting period, cancel, the database-enforced modes,
    the watcher and witness (`e2e/projects/strong.test.ts`, `e2e/projects/suite.ts`);
  - the self-hosted panel's pinned origin and published build hashes
    (`e2e/bridge/cloud.test.ts`, `e2e/cloud/self-hosted.test.ts`);
  - the proof check on honest decisions and each kind of forgery
    (`packages/bridge/src/audit-proofs.test.ts`, `e2e/projects/audit-proofs.test.ts`);
  - the panel in Chromium under its CSP, including organization views and record signing
    (`packages/panel/tests/browser/panel.spec.ts`).

- The other products. Each has attack tests, and each stage was followed by an independent
  review whose findings became regression tests ([security-findings.md](https://osevel.com/docs/security/red-team-findings/)):
  - OsVault: the core's attack suite (moved ciphertext, forged wraps, log rollback and forks,
    swapped keys, masking across chunks and encodings); the panel in Chromium, Firefox and WebKit
    against a real cloud; linking a computer, runs and locked keys end to end, with curl, Node
    `fetch` and Python 3.13 through the run proxy against a pretend service; the service mode.
  - OsApi: classification attacks (GraphQL, method and path tricks); raw-TLS attacks through the
    real proxy against a pretend provider; holds, policy, records and their chain; a red team of
    the whole path in daemon mode.
  - OsBox: acceptance attacks and hostile pretend servers in the gateway; acceptance in the panel
    against a real cloud; a repository's servers; the service mode; remote servers with OAuth
    against a pretend server; the sandbox on macOS, with probes run under the generated profile.
  - OsMemory: the core's rules against an agent holding the scope key; the tools through the real
    gateway; sync, the panel, import and team memory against a real cloud; the service mode.
  - OsBrain: the mapping against fixed vectors; ledger, seal and rules attacks; the executor hook
    on Postgres 17; a red team of the whole path.

**Not tested:**

- OsVault's key stores on a real Windows or Linux desktop (unit tests with a memory store only);
  the run proxy with `axios`, Python `requests`, the Stripe, OpenAI and Anthropic SDKs, or Node
  before 24;
- OsApi's catalogue against real provider accounts (it was checked against their published
  documents);
- OsBox's sandbox on Linux end to end, and the service relay for remote servers;

- daemon mode's service install for real: `daemon install` with launchd on macOS and systemd on
  Linux (the generated plist, unit and steps are unit-tested; the container has no init system);
- `sudo` with a real password prompt, and `tty_tickets` behaviour;

- hosted Supabase (network policies, SSL enforcement, Supavisor pooling);
- real network egress beyond loopback;
- the published npm package and binary on other operating systems;
- Windows;
- compromise of the journal, approver or admin credentials (the remote and journal passwords are
  tested directly against approvals, policy, sessions and tables in the adversarial suite);
- capabilities granted through shared-object commands (`GRANT <role> TO <agent role>`), catalog
  edits by a superuser, or a disabled event trigger;
- the exact timing window between a cut-off and `NOLOGIN` taking effect;
- the 10-minute edges of the volume rules;
- the organization model on Postgres other than 17 and on Supabase, with real hardware
  authenticators, and with a hosted (non-local) cloud deployment;
- a compromised team bridge host (out of scope by the threat model, except the watcher's hold on
  strong decisions).
