Skip to content

Commit 8b86fb0

Browse files
committed
validate newAccountCount is number
1 parent bf3433a commit 8b86fb0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/libs/Middleware/FraudMonitoring.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ type FraudSignalFactory = (requestData?: Record<string, unknown>, responseData?:
1616

1717
// Flag commands that create new accounts so the fraud protection backend can detect invite spam.
1818
const createNewAccountCountSignal: FraudSignalFactory = (_, responseData) => {
19-
if (!responseData?.newAccountCount) {
19+
const newAccountCount = responseData?.newAccountCount;
20+
if (typeof newAccountCount !== 'number' || newAccountCount <= 0) {
2021
return undefined;
2122
}
22-
return {event: FRAUD_PROTECTION_EVENT.NEW_EMAILS_INVITED, attribute: {key: 'new_account_count', value: String(responseData.newAccountCount)}};
23+
return {event: FRAUD_PROTECTION_EVENT.NEW_EMAILS_INVITED, attribute: {key: 'new_account_count', value: newAccountCount.toString()}};
2324
};
2425

2526
const fraudSignalFactoryByApiCommand: Record<string, FraudSignalFactory> = {

0 commit comments

Comments
 (0)