aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-13 14:21:39 -0700
committerAdam Soltys <[email protected]>2026-06-13 14:21:39 -0700
commit43427afe5b0b16d887163bd788360ac29105d69c (patch)
tree43863f8f27e9b0360e89663e558d2b81c54f8976
parenta44bcd511da7216c4cd3782ac24997cc7a82f186 (diff)
downloadcoinos-server-43427afe5b0b16d887163bd788360ac29105d69c.tar.gz
coinos-server-43427afe5b0b16d887163bd788360ac29105d69c.zip
payments: freeze matches uid as well as username (rename-proof)
The blacklist (send freeze) only matched the current username, so a compromised account could shake the freeze by renaming itself. Match on either the lowercased username OR the immutable uid; add the uid to the `blacklist` set to freeze durably. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
-rw-r--r--lib/payments.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/payments.ts b/lib/payments.ts
index f10559be..aeebcc48 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -101,10 +101,12 @@ export const debit = async ({
user?.username?.toLowerCase().trim(),
);
- const blacklisted = await db.sIsMember(
- "blacklist",
- user?.username?.toLowerCase().trim(),
- );
+ // Blacklist (freeze) matches on EITHER the current username OR the uid. The
+ // uid never changes, so renaming the account can't shake the freeze — add the
+ // uid to the `blacklist` set to freeze a compromised account durably.
+ const blacklisted =
+ (await db.sIsMember("blacklist", user?.username?.toLowerCase().trim())) ||
+ (!!user?.id && (await db.sIsMember("blacklist", user.id)));
if (hash && await db.sIsMember("blocked_addresses", hash)) {
err(`SECURITY: blocked send to ${hash} by ${user.username}`);