🛂 (radar) Improve radar regex
This commit is contained in:
@@ -4,7 +4,7 @@ export const computeRiskLevel = (typebot: any) => {
|
|||||||
const stringifiedTypebot = JSON.stringify(typebot)
|
const stringifiedTypebot = JSON.stringify(typebot)
|
||||||
if (
|
if (
|
||||||
env.RADAR_HIGH_RISK_KEYWORDS?.some((keyword) =>
|
env.RADAR_HIGH_RISK_KEYWORDS?.some((keyword) =>
|
||||||
new RegExp(`(?<!https?://[^\\s"]*)\\b${keyword}\\b`, 'gi').test(
|
new RegExp(`(?<!(https?://|@)[^\\s"]*)\\b${keyword}\\b`, 'gi').test(
|
||||||
stringifiedTypebot
|
stringifiedTypebot
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -14,7 +14,7 @@ export const computeRiskLevel = (typebot: any) => {
|
|||||||
env.RADAR_CUMULATIVE_KEYWORDS?.some((set) =>
|
env.RADAR_CUMULATIVE_KEYWORDS?.some((set) =>
|
||||||
set.every((keyword) =>
|
set.every((keyword) =>
|
||||||
keyword.some((k) =>
|
keyword.some((k) =>
|
||||||
new RegExp(`(?<!https?://[^\\s"]*)\\b${k}\\b`, 'gi').test(
|
new RegExp(`(?<!(https?://|@)[^\\s"]*)\\b${k}\\b`, 'gi').test(
|
||||||
stringifiedTypebot
|
stringifiedTypebot
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user