2
0

🩹 (radar) Only check existing risk if typebot was not manually checked

This commit is contained in:
Baptiste Arnaud
2023-12-20 10:45:12 +01:00
parent 780b4dee18
commit 3919f75a36

View File

@ -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({ throw new TRPCError({
code: 'FORBIDDEN', code: 'FORBIDDEN',
message: message:
'Radar detected a potential malicious typebot. This bot is being manually reviewed by Fraud Prevention team.', '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) const riskLevel = typebotWasVerified ? 0 : computeRiskLevel(existingTypebot)
if (riskLevel > 0 && riskLevel !== existingTypebot.riskLevel) { if (riskLevel > 0 && riskLevel !== existingTypebot.riskLevel) {