diff options
| author | Adam Soltys <[email protected]> | 2026-11-25 13:51:58 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-25 13:51:58 -0700 |
| commit | e171361854d1e285a76696dcf3086650e02ed8d3 (patch) | |
| tree | 4486f0bc63b164cf87e8844de0c13701a0a3aeb1 /routes | |
| parent | f95a81db20314b0cc5b31a968908ae86a5bcc22b (diff) | |
| download | coinos-server-e171361854d1e285a76696dcf3086650e02ed8d3.tar.gz coinos-server-e171361854d1e285a76696dcf3086650e02ed8d3.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6W9CsdxmhFrfaKNVHU
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.ts | 27 |
1 files changed, 14 insertions, 13 deletions
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; |
