aboutsummaryrefslogtreecommitdiffstats
path: root/routes/payments.ts
diff options
context:
space:
mode:
Diffstat (limited to 'routes/payments.ts')
-rw-r--r--routes/payments.ts27
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;