From 3919f75a366909bb3500269b50e1e8136590e5ba Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 20 Dec 2023 10:45:12 +0100 Subject: [PATCH] :adhesive_bandage: (radar) Only check existing risk if typebot was not manually checked --- .../src/features/typebot/api/publishTypebot.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/builder/src/features/typebot/api/publishTypebot.ts b/apps/builder/src/features/typebot/api/publishTypebot.ts index 354f732b3..ab78f0eaf 100644 --- a/apps/builder/src/features/typebot/api/publishTypebot.ts +++ b/apps/builder/src/features/typebot/api/publishTypebot.ts @@ -81,16 +81,20 @@ export const publishTypebot = authenticatedProcedure }) } - if (existingTypebot.riskLevel && existingTypebot.riskLevel > 80) + const typebotWasVerified = + existingTypebot.riskLevel === -1 || existingTypebot.workspace.isVerified + + if ( + !typebotWasVerified && + existingTypebot.riskLevel && + existingTypebot.riskLevel > 80 + ) throw new TRPCError({ code: 'FORBIDDEN', message: 'Radar detected a potential malicious typebot. This bot is being manually reviewed by Fraud Prevention team.', }) - const typebotWasVerified = - existingTypebot.riskLevel === -1 || existingTypebot.workspace.isVerified - const riskLevel = typebotWasVerified ? 0 : computeRiskLevel(existingTypebot) if (riskLevel > 0 && riskLevel !== existingTypebot.riskLevel) {