diff options
| author | Adam Soltys <[email protected]> | 2026-06-14 12:33:35 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-17 07:47:46 -0700 |
| commit | 85849ede6fb6bd9151703ebb8cf1b2b2df385b99 (patch) | |
| tree | e96ed71ec318ae230b42a4b5a337379494382207 | |
| parent | 17a4461d8497f4f0f89871bb80604d449487a4c3 (diff) | |
| download | coinos-server-85849ede6fb6bd9151703ebb8cf1b2b2df385b99.tar.gz coinos-server-85849ede6fb6bd9151703ebb8cf1b2b2df385b99.zip | |
payments: freeze matches uid as well as username (rename-proof)
Port of master 43427afe. 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 <[email protected]>
| -rw-r--r-- | lib/payments.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index 0a27143e..e346e5f0 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -161,7 +161,12 @@ export const debit = async ({ const whitelisted = await db.sIsMember("whitelist", 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}`); |
