⚡ (radar) Add radar cumulative keyword alternatives check
This commit is contained in:
4
packages/env/env.ts
vendored
4
packages/env/env.ts
vendored
@@ -79,7 +79,9 @@ const baseEnv = {
|
|||||||
RADAR_CUMULATIVE_KEYWORDS: z
|
RADAR_CUMULATIVE_KEYWORDS: z
|
||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.transform((val) => val.split('/').map((s) => s.split(',')))
|
.transform((val) =>
|
||||||
|
val.split('/').map((s) => s.split(',').map((s) => s.split('|')))
|
||||||
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ export const computeRiskLevel = (typebot: any) => {
|
|||||||
if (
|
if (
|
||||||
env.RADAR_CUMULATIVE_KEYWORDS?.some((set) =>
|
env.RADAR_CUMULATIVE_KEYWORDS?.some((set) =>
|
||||||
set.every((keyword) =>
|
set.every((keyword) =>
|
||||||
new RegExp(`(?<!https?://[^\\s"]*)\\b${keyword}\\b`, 'gi').test(
|
keyword.some((k) =>
|
||||||
|
new RegExp(`(?<!https?://[^\\s"]*)\\b${k}\\b`, 'gi').test(
|
||||||
stringifiedTypebot
|
stringifiedTypebot
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
return 100
|
return 100
|
||||||
if (
|
if (
|
||||||
env.RADAR_INTERMEDIATE_RISK_KEYWORDS?.some((keyword) =>
|
env.RADAR_INTERMEDIATE_RISK_KEYWORDS?.some((keyword) =>
|
||||||
|
|||||||
8
packages/radar/tsconfig.json
Normal file
8
packages/radar/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "@typebot.io/tsconfig/base.json",
|
||||||
|
"include": ["**/*.ts"],
|
||||||
|
"exclude": ["node_modules"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2015"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user