Files
token-circles/SECURITY.md
Komediruzecki 9b1bdc0680 docs(encryption): record the follow-ups as done, and what is left
The plan's follow-ups become a record of what this branch did since
(rotation, the second sealing pass, security.txt, Content-Length, the
reseal orphan, the narrowed sort) and the things still open: immediate
crypto-shredding, which is a decision rather than a task (D1 Time
Travel keeps 30 days regardless, and keys held outside D1 would trade
away recoverability), the plaintext names, and uncapped keyed scans,
with the concurrency measurement that ruled out the easy fix. Bank and
OAuth tokens: nothing stores them yet.

Rollout and failure modes cover migrations 0032 and 0033 and the
rotation states. dev-changelog gets the follow-up commits, CHANGELOG
the one user-visible fix (numeric spreadsheet cells). SECURITY.md
points at this repository's advisories under its current name, and at
security.txt.
2026-09-11 10:30:08 +02:00

3.2 KiB

Security Policy

Reporting a Vulnerability

If you discover a security vulnerability in Token Circles, please use GitHub's private vulnerability reporting to disclose it securely. The same contact is published at tokencircles.com/.well-known/security.txt. Alternatively, you can open a public issue stating that you found a potential security issue and a maintainer will provide a private channel for details.

Do not include exploit details or sensitive information in public issues.

Supported Versions

Version Supported
5.x (latest) Yes
< 5.0 No

Security Features

These describe the Cloudflare Worker backend (worker/), which is the only server this project ships.

  • Passwords hashed with PBKDF2-HMAC-SHA256 (WebCrypto), per-user random salt, constant-time verification. Login is protected against user enumeration (a dummy hash is always verified) and rate-limited per IP and per email.
  • Authentication is a stateless HS256 JWT in an HttpOnly, SameSite=Lax, Secure cookie. "Sign out everywhere" is supported by bumping a per-user token version, which invalidates all outstanding tokens.
  • Parameterized SQL everywhere (D1); table/column identifiers in the query helpers are validated against an allowlist regex to prevent injection.
  • Per-request authorization: every data query is scoped to the caller's profile/user; foreign keys supplied by the client (accounts, categories, transactions, receipts, …) are ownership-checked.
  • Security headers on API responses (Content-Security-Policy, Strict-Transport-Security, X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Referrer-Policy) and on the static app responses.
  • Rate limiting on authentication endpoints and on expensive/destructive endpoints (imports, PDF/report generation, data export, and profile-data reset).
  • CORS locked to a single configured origin with credentials (fails closed if unset).
  • Bot protection via Cloudflare Turnstile on the auth forms.
  • Billing webhooks (Stripe) are verified by signature with a timestamp replay window, and the user's plan is only ever set from a verified webhook — never trusted from the client.

Data storage & encryption

Data is encrypted at rest by the platform (Cloudflare D1 and R2 use AES-256) and in transit via TLS. In the default local-first mode, data never leaves the browser (IndexedDB).

A deployment that configures a master key additionally seals the most identifying fields — transaction descriptions, counterparties and notes, bill and recurring-rule names, the notes on accounts, goals, loans, housing and holdings, learned category patterns, tag-rule criteria, and receipt files — under a per-user key, so a leaked database export or storage bucket is unreadable without the separately held master key. This is server-side encryption: the service holds the keys and decrypts to provide its features. It is not end-to-end or zero-knowledge encryption, and that is not planned. Design and threat model: docs/plans/field-encryption.md.