Security model
Scope. One deployment serves one household. The threat model covers a leaked database, a leaked MCP token, a malicious MCP client or prompt, and Plaid webhook spoofing.
| asset | protection |
|---|---|
| Provider credentials (Plaid access tokens, SimpleFIN and SnapTrade keys) | AES-256-GCM. The key is derived (HKDF) from OWNER_PASSPHRASE, a Worker secret that is never stored in D1. A database export alone is useless. |
| Financial data | Lives in your D1 database, which has no public endpoint. Only your Worker is bound to it. Money is stored as integer cents. |
| Dashboard | Passkey (WebAuthn) sign-in. Sessions are signed cookies (__Host-, HttpOnly, Secure, SameSite=Lax): 7 days idle, 60 days at most. (On plain-HTTP localhost the __Host- prefix and Secure flag are dropped, because browsers refuse them there.) Cloudflare Access in front is optional extra hardening. |
| Claiming the site | Needs the setup code (OWNER_PASSPHRASE). Wrong guesses are limited to 5 per 15 minutes, counted before the comparison so parallel guesses can't beat it. The limit is shared by everyone, so a stranger can delay your claim by 15 minutes but can't get in. After the first claim the code no longer works. |
| MCP | OAuth 2.1 (PKCE S256, dynamic client registration) with a consent page that only a signed-in owner can approve. It shows the app's real redirect host. Access tokens last 1 hour, refresh tokens 30 days. Optional static MCP_TOKEN (16+ characters; shorter values are ignored) for scripts. |
query_sql | One read-only statement (SELECT, WITH or VALUES) over the agent_* views only. D1 has no read-only logins, so a validator enforces this: single statement, no comments, no writes or PRAGMA/ATTACH, every internal table prefix blocked and only the known agent_* views allowed, and a 500-row cap. It is covered by tests that try to escape it, and a test checks that new tables follow the naming convention the validator relies on. |
| Webhooks | Plaid's ES256 JWT is verified, including the body SHA-256 and a 5-minute max age. |
| Daily sync | Starts from a Cloudflare Cron Trigger. To stay within per-request limits, it then calls your own site's /api/cron/connection once per connection. That endpoint accepts only a bearer token derived from OWNER_PASSPHRASE. |
Revocation. Revoking a connected app in Settings → AI access (MCP) deletes its grant. Its access token stops working immediately and its refresh token is rejected.
Ownership. There is a single owner row. Sessions and MCP grants are bound to it, so resetting the owner (RESET_OWNER) invalidates all of them. The reset happens on the first page load after you change RESET_OWNER, and the site is then unclaimed until you register a new passkey, so open it straight away. A static MCP_TOKEN is not bound to the owner: change or remove it separately. Anyone who can edit your Worker's secrets already controls the deployment, so recovery adds no new trust.
Passkeys and your address. A passkey only works on the hostname where it was created. Choose your final domain before you set one up. Changing it later means creating new passkeys (use RESET_OWNER) and connecting your AI assistants again.
Changing OWNER_PASSPHRASE. Dashboard sessions are signed out. Everything encrypted with the old passphrase (provider credentials, saved Plaid keys, plugin secrets) can't be read until you enter it again. Nothing is re-encrypted, so an earlier database export can still be decrypted with the old passphrase. Passkeys, connected AI apps and MCP_TOKEN keep working. If you are changing it because it may have leaked, also rotate your keys at Plaid, SimpleFIN and SnapTrade, revoke connected apps in Settings, and change MCP_TOKEN. Use a long random passphrase and keep it in a password manager.
No money movement. Only read access to transactions, balances and holdings is requested. No payment, transfer or trading APIs are used.
Prompt injection. Transaction descriptions are attacker-influenced text (e.g. a merchant name). The MCP tools are read-only, and refresh can only trigger a sync, so the worst case is an agent being misled about your data, not data leaving through this server. Be careful about combining this connector with tools that can send data elsewhere.
Static MCP_TOKEN. Anyone with the token can read all your data and trigger syncs. It doesn't appear under Connected apps and survives RESET_OWNER and passphrase changes. Generate it randomly (openssl rand -base64 32), send it only over HTTPS or to localhost, and revoke it by changing or removing the variable.
Network requests your site makes. Apart from one public data download that is on by default (FRED, below), your site only contacts outside services you have set up:
- Plaid, if you connected it, through Plaid's SDK, including fetching Plaid's webhook signing keys. While you link a bank, your browser loads Plaid Link from
cdn.plaid.comand talks to Plaid directly. - SimpleFIN, if you connected it: once to claim your setup token, then the Bridge address your token names. Only
httpsaddresses are accepted, and private or local hostnames are rejected. - SnapTrade (
api.snaptrade.com), if you connected it. - Plugins, if you installed any. A plugin runs inside your site with the same access as the app, including your data and decrypted secrets, and can make any request it likes, so install only plugins you have read. None are installed by default; the RentCast example calls
api.rentcast.io. - FRED (
fred.stlouisfed.org), for comparing your portfolio against the S&P 500. By default, about once a day alongside the scheduled sync, your site downloads the index's daily closing values from the Federal Reserve Bank of St. Louis—even before you connect any accounts (and right after startup in Docker, unlessOB_SYNC=offis set to turn off all automatic syncs in Docker). It skips the request if it already has yesterday's value or tried within the last 6 hours. The request comes from your server (Cloudflare Worker or Docker host) with theUser-AgentOpenBursar benchmark fetch, to a fixed address plus a start date (14 to 400 days back on the first download, based on your earliest holding snapshot if you have one, then 7 days before the latest stored value). It sends no cookies, credentials or account details, doesn't follow redirects, times out after 15 seconds and stops at 1 MiB. The values are stored in a table your AI assistant can't read. To stop future downloads, turn off Download the S&P 500 index for comparison in Settings → Privacy & data (values already downloaded stay in the database). The series is the price index, so it leaves out dividends. - Your own site: the daily sync calls
/api/cron/connectionon your site's public address (see the table).
Plaid's webhooks are requests to your site, verified as above. Nothing is sent to the OpenBursar project.
Reporting. Use GitHub Security Advisories on this repo.