Skip to content

Threat model ​

STRIDE over the architecture as it runs on 2026-10-09, including the two pieces added for launch: Stripe billing (ADR 0037, SPEC-016) and self-service sign-up (ADR 0038, SPEC-017), both built but not yet switched on. Each threat names the control and where it lives, and the gaps still open. For reporting an issue, see SECURITY.md.

Architecture ​

text
Owner's Claude (web, desktop, phone)          Owner's browser
        │  MCP over HTTPS, OAuth                │  sign-up, Stripe Checkout / Portal
        ▼                                       ▼
Cloudflare Access (Managed OAuth, policy, MFA) ─┘
        │  Cloudflare Tunnel (outbound only, no open ports)
        ▼
App: Node, Hono, MCP SDK (src/web, src/mcp) ──► Xero API (OAuth, tokens encrypted)
        │  role `app`, never the owner          Companies House API (public data)
        ▼                                       Stripe API and webhook
Postgres: row-level security on entity_id

Trust boundaries: (1) the internet to Cloudflare; (2) Cloudflare to the app; (3) the app to Postgres; (4) the app to Xero and Stripe; (5) the language model to the tools, since the model reads text an attacker may control (bank lines, invoice references, emails).

Assets ​

Customers' Xero access (encrypted refresh tokens), the books data read from Xero, statement contents in memory, the audit log of writes, subscription state, and the secrets in Doppler (database passwords, XERO_TOKEN_ENCRYPTION_KEY, ACTIVITY_LOG_HASH_KEY, Stripe keys).

Spoofing ​

ThreatControlWhere
A stranger calls /mcpCloudflare Access in front; the app verifies the Access JWT itself (signature against the team's keys, issuer, AUD, expiry) and returns 503 if Access is unconfigured, never opensrc/web/access.ts, src/web/app.ts, AUDIT C4, ADR 0020
A signed-in person acts for a company that is not theirsIdentity only from the verified token; a principal row with an entity_access grant is required; the company comes from the session, never from tool inputsrc/web/known-person.ts, semgrep mcp-entity-from-session, CLAUDE.md rule 4
Forged Stripe webhookStripe-Signature verified over the raw body with the webhook signing secret before any state changes; each subscription is re-read from Stripe before it is recordedsrc/web/billing.ts, SPEC-016 S5, ADR 0037
Self-service sign-up abused to create accountsA new account sees no company until it connects its own Xero organisation through Xero's consent screen (/mcp refuses a principal with no company), and the company's entitlement comes from Stripe, not from inputsrc/web/onboarding.ts, src/xero/connect.ts, src/mcp/context.ts, SPEC-017, ADR 0038

Tampering ​

ThreatControlWhere
Prompt injection in a bank line, invoice or email makes the model write to XeroEvery write is a preview; only Approve in an approval card makes the write. The card calls an app-only tool the model cannot see, with a one-time token only the card receives (hash stored); nothing in chat counts as approvalsrc/mcp/approval-card.ts, AUDIT C5, "C5:" tests in tests/mcp/bank-tools.test.ts
A write after the books are lockedRefused on or before Xero's period and year-end lock dates, at preview and at writeAUDIT C5 (#122)
A replayed or duplicated writePreview claimed once, by the same person, within 15 minutes; Xero Idempotency-Key on every writeAUDIT M4, M5
Changing the audit logledger_write append-only by RLS and revoked UPDATE/DELETEsrc/platform/policies.sql, bootstrap.sql, AUDIT M6
Model invents or alters a figureFigures come only from code; replies start with a code-built summary the model is told to show as it isCLAUDE.md rule 3, src/mcp/guidance.ts
A malicious deployA deploy user with a forced command, a root program that takes no input, and a compose check that refuses privileged settings; images built in CI, signed and deployed by digest are planned (ADR 0028, proposed; issue #75)ADRs 0023, 0028
Webhook replay changes a subscriptionStripe's signed timestamp checked within the SDK's tolerance; each event records Stripe's current subscription state, re-read from Stripe, so a replay changes nothingsrc/web/billing.ts, SPEC-016 S7, ADR 0037

Repudiation ​

ThreatControlWhere
"I didn't approve that"Every write logged with who approved, the exact entry, before and after, outcomeledger_write, AUDIT M6
What did the model propose, and why?Activity log of proposals, approvals and outcomes; bank line IDs only as keyed hashesADR 0033, SPEC-010
Who signed in?Cloudflare Access and Entra sign-in logsADR 0026

Information disclosure ​

ThreatControlWhere
One customer reads another's dataPostgres RLS on entity_id on every table but principal; the app connects as app, which cannot bypass it; RLS tests in CI against a real PostgresADR 0003, tests/platform/rls.test.ts, policies.test.ts
Stolen database copy exposes Xero accessTokens encrypted with AES-256-GCM; the key is in Doppler and the app's environment, never in the database or its backupssrc/platform/crypto.ts, AUDIT X1
Statement contents leakNever stored or logged; read in memory for one request; semgrep forbids logging statement textADR 0032, semgrep no-logging-statement-text
Bank credentials leakNone held: statement files only; the database refuses any other source and any stored credentialADR 0035, migration 0014
Secrets in the repositorygitleaks over full history in CI and before each commit; fixtures use fake valuesscripts/security/gitleaks.sh, AUDIT K2
Secrets or tokens in logssemgrep no-logging-credentials; structured loggersrc/platform/logger.ts
Error messages leak internalsPlain-English tool errors without stack tracesAUDIT C2
The statements folder is shared on a local serverThe owner confirms file names and dates before any file is usedsrc/mcp/guidance.ts, ADR 0032

Denial of service ​

ThreatControlWhere
Large requests1 MB body limit, 413src/web/app.ts
Exhausting the Xero rate limit (60 a minute)Calls in sequence, 429 back-off honouring Retry-After, exact call budgets per entry point in CIAUDIT X3, tests/performance/budgets.ts
Hanging upstreams30-second timeout on every outbound requestsrc/platform/timed-fetch.ts, AUDIT K3
Single hostThe NAS is one machine; Cloudflare in front; nightly backups with a restore testGap: no second host; recovery is restore from backup

Elevation of privilege ​

ThreatControlWhere
The model calls a tool it should notThe approval tool is app-only and hidden from the model; no MCP tool files with HMRC or Companies HouseAUDIT C5, CLAUDE.md rule 5, ADR 0036
Pull request steals deploy secretsDoppler tokens only on a dedicated deploy runner; repository write limited to the Product Owner and RobADR 0019 (#71)
The deploy SSH key is stolenrestrict, from= the runner, forced command; not in the docker group; root program takes no inputADR 0023
Database owner credentials misusedMigrations run only from the pipeline, backup first; developers use throwaway databasesADRs 0014, 0029, 0030

Open gaps (known, ranked) ​

  1. Single production host on FEAW premises; cloud hosting is still on not-doing.
  2. prd and dev secrets separation is incomplete (issue #63); migrate-nas still reads dev (ADR 0019).
  3. Retention periods proposed in ADR 0026 are not yet enforced by scheduled deletes. Account deletion is built: it cancels the subscription, revokes and deletes the Xero tokens, and deletes every row of a company only that person used, keeping only a pseudonymised activity log for 6 years (SPEC-017, migration 0018).
  4. Base image vulnerabilities are reported, not blocking, until #75.
  5. Sign-up and billing are built (SPEC-016, SPEC-017) but not switched on; review this page when they go live.