From 75de9d68e136c01af91d3032e595d535cd93f450 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 15 Sep 2025 22:09:12 +0200 Subject: [PATCH] Delete NWC plaintext credentials that allow payments (#2367) * Delete NWC plaintext credentials that allow payments * Fix row in Wallet and WalletProtocol not deleted * Fix wallet delete because CTE evaluated too late iiuc * Mention badges * Fix missing semicolon --- .../migration.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 prisma/migrations/20250910153121_delete_nwc_recv_with_payments/migration.sql diff --git a/prisma/migrations/20250910153121_delete_nwc_recv_with_payments/migration.sql b/prisma/migrations/20250910153121_delete_nwc_recv_with_payments/migration.sql new file mode 100644 index 00000000..fdb5d6df --- /dev/null +++ b/prisma/migrations/20250910153121_delete_nwc_recv_with_payments/migration.sql @@ -0,0 +1,19 @@ +-- delete protocols that have accidentally been saved in plaintext with permissions to spend +DELETE FROM "WalletProtocol" +WHERE id IN ( + SELECT "protocolId" FROM "WalletRecvNWC" + WHERE id IN ( + 7, + 67, + 140, + 157, + 158, + 166 + ) +); + +-- delete wallets that now have no protocols +DELETE FROM "Wallet" +WHERE NOT EXISTS (SELECT 1 FROM "WalletProtocol" WHERE "walletId" = "Wallet"."id"); + +-- badges will not be updated but that's okay, not important enough for the effort