⚡ (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
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((val) => val.split('/').map((s) => s.split(',')))
|
||||
.transform((val) =>
|
||||
val.split('/').map((s) => s.split(',').map((s) => s.split('|')))
|
||||
)
|
||||
.optional(),
|
||||
},
|
||||
client: {
|
||||
|
@ -13,12 +13,14 @@ export const computeRiskLevel = (typebot: any) => {
|
||||
if (
|
||||
env.RADAR_CUMULATIVE_KEYWORDS?.some((set) =>
|
||||
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
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
return 100
|
||||
if (
|
||||
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