From e171361854d1e285a76696dcf3086650e02ed8d3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 25 Nov 2026 13:51:58 -0700 Subject: funds: serve fund history to anyone; close manager changes Funds are closed and every value-moving route refuses, so a rotated fund's old id now resolves to its history for any viewer, read-only. Adding and removing managers is refused as well, so a fund without managers can't be claimed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6W9CsdxmhFrfaKNVHU --- routes/payments.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'routes') diff --git a/routes/payments.ts b/routes/payments.ts index 491ee3cc..f9be4c34 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -42,11 +42,11 @@ import { v4 } from "uuid"; // INTO funds they were then unable to withdraw from. Every value-moving entry // point — deposit (POST /payments with `fund`), withdrawal (POST /take) and // pre-authorization (POST /authorize) — now refuses unconditionally, rather -// than depending on a redis flag someone can clear by accident. +// than depending on a redis flag someone can clear by accident. Adding and +// removing managers is closed too, so nobody can claim a manager-less fund. // -// Read paths are deliberately left working: GET /fund/:id and the manager -// endpoints still serve existing funds so balances stay visible and can be -// settled out of band. +// Read paths are deliberately left working: GET /fund/:id and the managers +// list still serve existing funds so their history stays visible. const fundsClosed = () => fail("Funds are no longer supported"); export default { @@ -286,17 +286,14 @@ export default { let fid = id; // A rotated fund no longer exists at its OLD id (security fix 2026-08-25: - // fund secret uids were rotated to invalidate an exfiltrated id list). Serve - // the new fund ONLY to an authenticated MANAGER of it — never anonymously or - // to a non-owner. An open old->new redirect would defeat the rotation, since - // the attacker holds the leaked OLD ids; gating on manager membership means a - // replayed old id reveals nothing unless you already control the fund. The - // route's `optional` auth populates req.user without requiring it. Bearer - // funds (no managers) are intentionally not recoverable this way. + // fund secret uids were rotated to invalidate an exfiltrated id list). + // That rotation existed to stop a leaked id being used to withdraw; funds + // are now closed and every value-moving route refuses (fundsClosed), so + // the old id resolves to the rotated fund for anyone, read-only, to keep + // its history viewable. if (typeof amount === "undefined" || amount === null) { const rotatedTo = await g(`fund:rotated:${id}`); - const uid = req.user?.id; - if (rotatedTo && uid && (await db.sIsMember(`fund:${rotatedTo}:managers`, uid))) { + if (rotatedTo) { fid = rotatedTo; amount = await g(`fund:${rotatedTo}`); } @@ -500,6 +497,8 @@ export default { }, async addManager(req, res) { + fundsClosed(); + const { id, username } = req.body; const { user } = req; @@ -527,6 +526,8 @@ export default { }, async deleteManager(req, res) { + fundsClosed(); + try { const { name } = req.params; const { id: uid } = req.body; -- cgit v1.2.3