Files
MichilisandClaude Opus 5.5 f09445b6ad
ci / check (push) Canceled after 0s
ci / images (push) Canceled after 0s
ci / e2e (push) Canceled after 0s
Initial commit
Paper Sats: design and print paper notes that carry sats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 05:15:30 +00:00

3.6 KiB

Security notes

For operators and reviewers. The rules come from about/10-security-edge-cases.md.

What the server never holds

Note tokens, spend secrets and backup files stay in the browser, on paper and in the user's backup file. The only secret the server receives is the creator fee token or fee note. It is redeemed on arrival, is not logged, and is not stored in plaintext. Held fee proofs are encrypted with AES-256-GCM under a key derived from SESSION_SECRET.

A token from a mint outside FEE_ACCEPTED_MINTS proves nothing by being signed, since anyone can run a mint. It counts as paid only once the payout side has seen the money.

Unsafe settings

A live web or worker exits at startup on an http APP_URL, test origins in SSRF_ALLOW_ORIGINS or CSP_EXTRA_ORIGINS, a placeholder secret, or missing required values (productionConfigIssues in packages/core/src/config.ts). PRODUCTION_CHECK=off skips this and also exposes /ui-kit, so it's for local test servers only.

Logs

Errors log the route, the error type and a stack passed through redact (apps/web/src/server/log.ts), which removes Cashu tokens, 64-hex values, bech32 secrets and invoices, and query strings. It works by pattern, so it can't catch a secret in an unexpected shape. Stacks are capped at 2000 characters.

Content security policy

connect-src allows any https: and wss: host. This is deliberate. Users choose their own mints, relays and Blossom servers, and the browser talks to them directly, so no fixed list can exist. img-src allows any https: host for thumbnails, which are only used through image elements.

This means an injected script could send data anywhere. So the other controls carry the weight:

  • Scripts need a per-request nonce with strict-dynamic, and no inline handlers exist.
  • dangerouslySetInnerHTML and eval are banned by a lint rule.
  • There are no third-party scripts, trackers or fonts.
  • Dependencies are pinned by the lockfile and audited in CI.
  • Designs from others are parsed with a schema, and SVG goes through an allow-list sanitizer and is only shown through image elements.

SSRF_ALLOW_ORIGINS and CSP_EXTRA_ORIGINS exist for local test containers. Both must be empty in production.

Requests to user-supplied URLs

Every server request to a mint goes through apps/web/src/server/ssrf.ts: https only, standard port, every DNS answer checked, the connection pinned to the checked address, redirects re-checked and limited to the same host, 8 second timeout (90 for a melt, which pays over Lightning), a 1 MB limit enforced while reading, no cookies or credentials.

Sessions and login

Cookies are HttpOnly, Secure when APP_URL is https, and SameSite=Lax, with only a SHA-256 stored. Mutating routes need the CSRF header and a matching Origin. Login events are one-time, valid for 60 seconds, and bound to the origin.

Known limits

  • Logging out leaves note secrets in this browser on purpose, because deleting them could destroy their value. The app warns first. Someone else using the same browser profile can spend them.
  • A mint can steal what it holds. The app shows the mint, defaults to the operator's list, and claims no safety for a custom one.
  • An attacker able to run script on this origin can read IndexedDB. The CSP and the rules above exist to prevent that, and nothing can fully compensate if they fail.
  • The extra-QR check covers QR codes the scanner can find at 300 dpi. A heavily distorted code could evade it.
  • A QR pass from the fallback grid reader proves the modules are correct, not that a phone reads it. Test a real print. This matters most for a dense QR a person has accepted, down to 0.17 mm modules.