harden(telegram): reject non-positive topic id in disableActiveTopic
All checks were successful
continuous-integration/drone/push Build is passing

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 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 12:14:32 +02:00
parent 23f8e91c50
commit 3b7202a662

View File

@@ -482,6 +482,11 @@ export async function disableActiveTopic(
} catch { } catch {
return { success: false, error: "Invalid topic id" }; 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 { try {
await prisma.topicProgress.upsert({ await prisma.topicProgress.upsert({