From 3b7202a6625401e5e63f41abd962e7b4de1ffd8a Mon Sep 17 00:00:00 2001 From: xCyanGrizzly Date: Mon, 22 Jun 2026 12:14:32 +0200 Subject: [PATCH] harden(telegram): reject non-positive topic id in disableActiveTopic BigInt("") / BigInt("0") don't throw; guard against them since the action is exported and admin-callable independent of the UI button. Co-Authored-By: Claude Opus 4.8 --- src/app/(app)/telegram/actions.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/(app)/telegram/actions.ts b/src/app/(app)/telegram/actions.ts index dac1794..3df353b 100644 --- a/src/app/(app)/telegram/actions.ts +++ b/src/app/(app)/telegram/actions.ts @@ -482,6 +482,11 @@ export async function disableActiveTopic( } catch { return { success: false, error: "Invalid topic id" }; } + // BigInt("") / BigInt("0") don't throw — reject non-positive ids explicitly + // since this action is exported and admin-callable outside the UI button. + if (topicIdBig <= BigInt(0)) { + return { success: false, error: "Invalid topic id" }; + } try { await prisma.topicProgress.upsert({