Files
orangecat/tests
d08c182994 fix(wallets): an extended public key is not an address — stop publishing it (#743)
`GET /api/wallets?profile_id=<any>` served `address_or_xpub` to anonymous
callers through the admin client. One active wallet on production had a real
111-character zpub in that column, and it was readable without logging in — I
read it from the live site before fixing this.

A zpub is not an address. It is the key addresses are derived FROM, so
publishing one hands a visitor every past and future receiving address of that
wallet and its entire balance history, forever and irrevocably. On a platform
whose first principle is "pseudonymous by default", that is the whole game. It
also negates the feature it came from: users supply a zpub so the payments
domain can derive a FRESH address per invoice (#519) precisely to avoid address
reuse — and then the profile published the master key beside it.

The payments domain already held the right invariant; walletResolutionService
says an extended key "must never be handed to a payer verbatim". The public
wallet listing was the one surface that disagreed, and it is the only non-owner
read path for that column, so redacting there closes the class.

Redaction classifies by VALUE, not by the `wallet_type` label — a key pasted
into a row the user typed 'onchain' is still a key. Plain addresses pass through
untouched; withholding those would break the one thing the public list is for.
The public card for a withheld key now says "A fresh address is generated when
you pay" instead of falling through to the connection branch and claiming a
Bitcoin wallet "Receives Lightning payments".

Verified against the real leaking wallet: production returns the 111-char zpub
to an anonymous caller, this build returns null. Both branches proven on one
wallet — owner keeps the key intact, anonymous gets null, the wallet still lists
so payers know it exists. The temporary wallet used for that test was deleted.

Finding 6 of #563. npm run verify: exit 0 — tsc clean, lint 0 errors,
224 suites / 2244 tests.

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 21:29:33 +00:00
..

Tests Directory

This directory contains all test files organized by type and purpose.

Directory Structure

  • auth/ - Authentication-related tests
  • e2e/ - End-to-end tests using Playwright
  • manual/ - Manual testing scripts and utilities
  • security/ - Security-focused tests
  • setup/ - Test setup and configuration

Test Types

  • Unit Tests: Located in __tests__/ directories next to source files
  • Integration Tests: API and service integration tests
  • E2E Tests: Full user journey tests using Playwright
  • Security Tests: Security vulnerability and policy tests
  • Manual Tests: Scripts for manual testing scenarios

Running Tests

# All tests
npm test

# Unit tests only
npm run test:unit

# Integration tests
npm run test:integration

# E2E tests
npm run test:e2e

# Security tests
npm run test:security

# Auth tests
npm run test:auth

Test Configuration

  • jest.config.js - Jest configuration
  • playwright.config.ts - Playwright E2E configuration
  • setup.ts - Global test setup
  • TestWrapper.tsx - React testing utilities