Skip to content

Commit

Permalink
🐛 (radar) Fix radar regex bug in prod env
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Oct 1, 2024
1 parent 5c4be51 commit 96ed700
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/radar/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const computeRiskLevel = (typebot: any, params?: Params) => {
env.RADAR_HIGH_RISK_KEYWORDS?.some((keyword) =>
new RegExp(
`(?<!(https?://|@)[^\\s"]*)\\b${keyword}${
keyword.includes("$") ? "" : `\\b`
keyword.includes("$") ? "" : "\\b"
}`,
"gi",
).test(stringifiedTypebot),
Expand All @@ -22,7 +22,7 @@ export const computeRiskLevel = (typebot: any, params?: Params) => {
env.RADAR_HIGH_RISK_KEYWORDS?.find((keyword) =>
new RegExp(
`(?<!(https?://|@)[^\\s"]*)\\b${keyword}${
keyword.includes("$") ? "" : `\\b`
keyword.includes("$") ? "" : "\\b"
}`,
"gi",
).test(stringifiedTypebot),
Expand All @@ -37,7 +37,7 @@ export const computeRiskLevel = (typebot: any, params?: Params) => {
set.every((keyword) =>
keyword.some((k) =>
new RegExp(
`(?<!(https?://|@)[^\\s"]*)\\b${k}${k.includes("$") ? "" : `\\b`}`,
`(?<!(https?://|@)[^\\s"]*)\\b${k}${k.includes("$") ? "" : "\\b"}`,
"gi",
).test(stringifiedTypebot),
),
Expand All @@ -52,7 +52,7 @@ export const computeRiskLevel = (typebot: any, params?: Params) => {
keyword.some((k) =>
new RegExp(
`(?<!(https?://|@)[^\\s"]*)\\b${k}${
k.includes("$") ? "" : `\\b`
k.includes("$") ? "" : "\\b"
}`,
"gi",
).test(stringifiedTypebot),
Expand Down

0 comments on commit 96ed700

Please sign in to comment.