Skip to content

Commit

Permalink
🩹 (radar) Only check existing risk if typebot was not manually checked
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Dec 20, 2023
1 parent 780b4de commit 3919f75
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/builder/src/features/typebot/api/publishTypebot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3919f75

Please sign in to comment.